Trying to Filter Easy-search

I am using matteodem:easy-search and I am trying to limit the results to a specific email address.

Here is my code to create the index

OpportunitiesIndex = new EasySearch.Index({
    collection: Opportunities,
    fields: ['brand','name','city','description','user'],
    engine: new EasySearch.MongoTextIndex({
      selector: function (searchObject, options, aggregation) {
        // retrieve the default selector
        selector = this.defaultConfiguration().selector(searchObject, options, aggregation);
        selector.user = "";
        return selector;
    name: 'myAwesomeIndex',
    permission: (options) => {
      return true; // always return true or false here

Here is my client code:

"click .search": function(event) {
  Tracker.autorun(function () {
    cursor ="Cost"); // search all docs that contain "Marie" in the name or score field
    console.log(cursor.fetch()); // log found documents with default search limit
    console.log(cursor.count()); // log count of all found documents

When i call the search function it returns nothing. If i take the selector out of the index creation it will return values just fine (just not filtered by email). I was looking at the output of the selector and its printing out the following:

db.opportunities.find({ '$text': { '$search': 'Cost' }, user: '' }

I typed that into a mongo shell and it returned no results.
But the following worked just fine in Mongo

db.opportunities.find({ , user: '','$text': { '$search': 'Cost' } })

Any way anyone can see to get these switched around so that this will work?


Hi @kenny4444

Can you please create a github issue? I think it’s easier to have it all in one place.