meteorhacks / search-source

Reactive Data Source for Search
MIT License
145 stars 33 forks source link

Exception in delivering result of invoking 'search.source': Error: Match failed [400] #20

Open Bandit opened 9 years ago

Bandit commented 9 years ago

Not sure where to even start with this one. Any ideas?

SearchSource.defineSource("bookings", function(searchText, options) {
      var options = (typeof options == "object") ? options : { sort: { isoScore: -1 }, limit: 20 };

      if(searchText) {

        var regExp = new RegExp("(" + searchText.trim().split(" ").join("|") + ")", "ig");

        console.info(searchText, regExp);

        var selector = { $or: [
          { customer: regExp },
          { notes: regExp }
        ]};

        return Bookings.find(selector, options).fetch();

      }
      else {

        return Bookings.find({}, options).fetch();

      }

    });
arunoda commented 9 years ago

not sure why? Here's the place we track that. You may need to send the searcText as string. See: https://github.com/meteorhacks/search-source/blob/master/lib/server.js#L10

svda commented 9 years ago

I have this same error when trying to send options to the server, i.e. PackageSearch('test', { limit: 100 }) gives the above error. It does work when the options are not an object but string, so it looks like a bug in checking the options parameter on the server.

svda commented 9 years ago

Never mind, this happened when using SearchSource 0.0.2. For some reason this is the default version that is being used when it's included in another package without specifying the package version. After using 'meteorhacks:search-source@1.3.1' in my package all was fine...