matteodem / meteor-easy-search

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

Remove __sortPosition hack #439

Closed dburles closed 7 years ago

dburles commented 8 years ago

Been digging into this one for a few hours today, not sure exactly the root cause but the order that the results are displayed do not seem to match the sort provided (have also tested on other fields). The results that I do see are close to being ok in that they are mostly correct (perhaps this is why it might be a bug that's gone unnoticed).

Running the same sort using curl returns the results in the correct order, so it's definitely not an indexing issue.

Might this be a bug in the package or something else?

bompi88 commented 8 years ago

Are you using mongo version above 2.6.x? I think easysearch uses the $or hack to get a sorted document list based on a sorted list of ids. This will not work for newer versions of mongo. Here's the issue over at mongo.

dburles commented 8 years ago

@bompi88 yeah that definitely sounds plausible

matteodem commented 8 years ago

It's really a rather bad hack and I didn't get around any solution that we could replace it with right now.

bompi88 commented 8 years ago

@matteodem A tought: is it possible to use aggregations to achieve this, like in Aaron Staple's post, if it is combined with the reactive aggregation package jcbernack:reactive-aggregate?

matteodem commented 8 years ago

Yeah might be, I'll investigate this when I have time for it

matteodem commented 7 years ago

Please comment here if this still is a problem. The core code should catch edge-cases for sort ordering when documents are changed.