matteodem / meteor-easy-search

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

No results from multi-word search in Input element #434

Closed ghost closed 8 years ago

ghost commented 8 years ago

I wanted to let you know that I verified my results. I've posted my configuration of EasySearch below:

When searching, I enter "smith benton" in the Input field. I know that several people with that last name exists AND that one of them ALSO lives in the county of "benton."

{{> EasySearch.Input index=personsIndex attributes=inputAttributes}}

Entering "smith benton" token combo returns no results.

PersonsIndex = new EasySearch.Index({
    collection: PersonsCollection,
    fields: ['name.last', 'name.first',
             'address.street_name', 'address.city', 'address.county',
             'status'],
    // MongoDB() = full collection search
    // Minimongo() = local collection
    engine: new EasySearch.MongoDB({
      sort: function () {
        return {'name.last': 1};
      }
    }),
    defaultSearchOptions: {
      limit: 12
    },
    permissions: () => {
      return true;
    }
});

The following versions are reported in the .meteor versions file:

easy:search@2.0.5
easysearch:components@2.0.5
easysearch:core@2.0.5

Thanks for all your help! Great search engine!

matteodem commented 8 years ago

so the right way to go about this is to either change the mongodb selector to match those keywords, https://docs.mongodb.org/manual/reference/operator/query/ or using ElasticSearch (with easysearch:elasticsearch) and using queries to better query your data. This is something that your application needs to specify.

ghost commented 8 years ago

Thanks Matt, I appreciate your time on this. I'm a NOOB and still learning the syntax for Mongo. By what your saying I should add a selector option that includes $or operators?

matteodem commented 8 years ago

exactly, and split up your search strings by whitespace if that's how you want to apply the logic