matteodem / meteor-easy-search

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

Aggregation using $and behaves like $or #510

Closed tim-phillips closed 8 years ago

tim-phillips commented 8 years ago

Using the MongoTextIndex engine, specifying aggregation: '$and' does not seem to change away from default $or search behavior.

export const AssetsIndex = new EasySearch.Index({
  collection: Assets,
  fields: ['barcode', 'modelName', 'modelNumber', 'categoryName', 'manufacturerName', 'locationName'],
  defaultSearchOptions: { limit: 20 },
  engine: new EasySearch.MongoTextIndex({
    aggregation: '$and',
    sort() {
      return { createdAt: -1 };
    }
  })
});
matteodem commented 8 years ago

The docs are invalid, aggregation parameter is not configurable for the TextIndex engine. I'll change that now

tim-phillips commented 8 years ago

How does one aggregate using MongoDB engine? Zero results are returned when I apply aggregation: '$and'.