meteorhacks / search-source

Reactive Data Source for Search
MIT License
146 stars 33 forks source link

Is it possible to use search-source with a few collections at once? #23

Open chompomonim opened 9 years ago

chompomonim commented 9 years ago

I have to implement global search in my app. It should show search results from Clients, Projects, Orders and Suppliers collections into one list.

Is search-source good choice to do that? If yes, any examples? If not, then also ok, I will just look for some other solutions... ;)

Thanks for any answers.

arunoda commented 9 years ago

Yes. You can search for multiple collections and need to generate a single array of results.

On Tue, May 19, 2015 at 12:19 PM Jaro notifications@github.com wrote:

I have to implement global search in my app. It should show search results from Clients, Projects, Orders and Suppliers collections into one list.

Is search-source good choice to do that? If yes, any examples? If not, then also ok, I will just look for some other solutions... ;)

Thanks for any answers.

— Reply to this email directly or view it on GitHub https://github.com/meteorhacks/search-source/issues/23.

chompomonim commented 9 years ago

@arunoda you mean I should do something like:

GlobalSearch = new SearchSource(['clients', 'projects'], fields, options);

or something like

ClientSearch = new SearchSource('clients', fields, options);
ProjectsSearch = new SearchSource('projects', fields, options);

client_res = ClientSearch.search(some_string);
project_res = ProjectsSearch.search(some_string);

result = client_res.concat(project_res);

And how about relevancy (ordering) of results then? Do you have already some solution or I should create own sorting on client side?

btbjosh commented 9 years ago

+1 I'm really looking for an answer to this question as I need a full app solution for searching multiple collections like this.

derwaldgeist commented 8 years ago

+1

krishnaff commented 8 years ago

+1 Searching multiple collections - some guidance would be really great.

Another question: how do we handle multiple keyword search in one collection? For example, I need to search for manager sales london contract through an Applicants collection which has various fields like location, skill, role, type etc.

What I could do right now is make multiple searches for each keyword, but merging the returned array for all keywords and then filtering/sorting is turning cumbersome. Any ideas/advice please?