matteodem / meteor-easy-search

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

Elastic search document count changes to default limit after 2 seconds #622

Open lucased opened 7 years ago

lucased commented 7 years ago

Ive just upgraded to the latest version of Easy Search + Elastic Search and everything work as normal except the pagination component, 2 seconds after the search results load the pagination component disappears.

Ive had a look into the issue and can see the count() property on the cursor that gets returned changes from the total search document count to the defaultSearchOptions limit after 2 second which is occurring in the setInterval in search-collection.js of easysearch:core.

In search-collection.js If i change { count: cursor.mongoCursor.count && cursor.mongoCursor.count() || 0 } to { count: cursor.count && cursor.count() || 0 } everything seem to work again. https://github.com/matteodem/meteor-easy-search/blob/4829f47d251faff38e456874b3ca364416ed78ed/packages/easysearch:core/lib/core/search-collection.js#L195

Not sure if this is a bug or intender in the newer versions of ES.

matteodem commented 7 years ago

can you provide a PR? I'll have a closer look and check if Travis runs through with the tests

zeroonedev commented 7 years ago

Great thanks @matteodem have submitted a PR - #625