meteorhacks / search-source

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

how to search on multiple collection? #32

Closed achtan closed 9 years ago

achtan commented 9 years ago

Hi, how to search on multiple collection at same time?

arunoda commented 9 years ago

You can define the source and search from both. Then merge those two results. (two arrays) and return.

achtan commented 9 years ago

i but what about client side search? when i'am searching in a different fields

var options = {
  keepHistory: 1000 * 60 * 5,
  localSearch: true
};
var fields = ['name']; // ??? not every collection has a field 'name'

SuggestionsSearch = new SearchSource('skills', fields, options);
arunoda commented 9 years ago

Okay. I got it. SearchSource does not have a notion about collections. It gets a datastream and it do the search in the client. So, you need to add common field (may be generated a field) to search.

arunoda commented 9 years ago

Did you try that?

achtan commented 9 years ago

yes i did, for now i have the same field name in each collection, so thats works

arunoda commented 9 years ago

Okay. great.

On Mon, Jun 29, 2015 at 1:47 PM David Ďurika notifications@github.com wrote:

yes i did, for now i have the same field name in each collection, so thats works

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