matteodem / meteor-easy-search

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

Error in documentation for selectors #648

Closed little-brain closed 3 years ago

little-brain commented 4 years ago

I think there's a typo in one of the examples on this page:

http://matteodem.github.io/meteor-easy-search/docs/recipes/

The first example for a custom selector is this:

import { Index, MongoDBEngine } from 'meteor/easy:search'

// Client and Server
const index = new Index({
  ...
  engine: new MongoDBEngine({
    selector(searchDefinition, options, aggregation) {
      // retrieve the default selector
      const selector = this.defaultConfiguration()
        .selector(searchObject, options, aggregation)

      // options.search.userId contains the userId of the logged in user
      selector.owner = options.search.userId

      return selector
    },
  }),
  permission: (options) => options.userId, // only allow searching when the user is logged in
});

If I copy this code into my app, I see an error that searchObject is not defined.

I think 'searchDefinition' needs to be 'searchObject'?

matteodem commented 4 years ago

Oh yeah you're right, thanks!