matteodem / meteor-easy-search

Easy-to-use search for Meteor with Blaze Components
MIT License
437 stars 68 forks source link

Search issues on a collection with multiple arrays. #487

Closed phillipgore closed 8 years ago

phillipgore commented 8 years ago

With the following code I get a correct count of items (cursor.count) but it reverts to 0 at the final log. However, no actual documents seems to ever be returned (cursor.fetch). It does work if I only have one field that is an array or if I only have the four "addresses" fields that are arrays.

ContactsIndex = new EasySearch.Index({
  collection: Contacts,
  fields: [
    "prefix", 
    "first", 
    "middle", 
    "last", 
    "suffix", 
    "phonetic_first", 
    "phonetic_middle", 
    "phonetic_last", 
    "nickname", 
    "job_title", 
    "department", 
    "company", 
    "maiden", 
    "phones.phone", 
    "emails.email", 
    "urls.url", 
    "dates.date_entry", 
    "relateds.related", 
    "immps.user_name", 
    "addresses.street", 
    "addresses.city", 
    "addresses.state", 
    "addresses.postal_code" 
  ],
  engine: new EasySearch.MongoDB()
})
Tracker.autorun(function () {
      cursor = ContactsIndex.search('Marie');
      console.log(cursor.fetch());
      console.log(cursor.count());
});
matteodem commented 8 years ago

Is this only happening with certain indexes? Can you provide me with reproduction steps or a repository?