Collection indexing not working with array fields

Hi all,

I’m using matteodem:easy-search and it works fine until I try to index an array field.

So, in my example below, I have a collection named MyCollection where each document has the fields ‘name’ and ‘surname’, as well as an array field (‘myarray’) which can contain multiple objects (so for instance I could reference myarray[0].arrayitem).

Here’s how I set up my indexing:

MyIndex = new EasySearch.Index({
    collection: MyCollection,
    fields: ['name', 'surname', 'myarray'],
    engine: new EasySearch.MongoDB()
});

And here’s how I’m doing a search (from a helper):

let cursor = TherapistsIndex.search(mysearchterm);
return cursor.fetch();

As I said, it’s working fine without the ‘myarray’ field defined in MyIndex. As soon as I add that, I get an error that reads something like “Exception while polling query…[lots of regex stuff here]…: Runner error: BadValue cannot sort with keys that are parallel arrays.”

Any idea what could be going wrong? Is this an issue with the easy search package or is there some limitation to indexing collections I’m not aware of?

1 Like