Closed RequestForCoffee closed 7 years ago
Have the same issue. Using the latest version.
Exception in setInterval callback: TypeError: cursor.mongoCursor.count is not a function
at packages/easysearch:core/lib/core/search-collection.js:193:41
at [object Object]._.extend.withValue (packages\meteor.js:1122:17)
at packages\meteor.js:445:45
at runWithEnvironment (packages\meteor.js:1176:24)
I have tried to debug search-collection.js but never gets error like that so, I assume, there is some timing issue or smth like that.
any simple reproduction steps?
export const ProjectsIndex = new Index({
collection: Projects,
fields: ['title'],
engine: new ElasticSearchEngine({
body: function(){
body = {query:{match:{title:"Wooden"}},"_source":["title"]};
return body
}
}),
});
getting the same Exception
the Errors appears even if the searchObject is empty :/
those templates doesnt fix the error.
{{#EasySearch.IfInputEmpty index=projectsIndex}}
{{/EasySearch.IfInputEmpty}}
{{#EasySearch.IfNoResults index=projectsIndex}}
NO RESULTS!!!!
{{/EasySearch.IfNoResults}}
another tipp for ppl who have problems with the newst version of ElasticSearch and this package:
export const ProjectsIndex = new Index({
collection: Projects,
fields: ["title"],
engine: new ElasticSearchEngine({
query: (searchObject) => {
match : {
"title" : searchObject.title
}
}
},
body:(body) => {
body._source = ["_id"];
delete body.fields;
delete body.sort; //optional
return body;
},
}),
});
u have just to rebuild the body for the newst syntax of elasticSearch =)
Hello. I got the same error. Is there any fix for it?
Not sure if this is still helpful. But I found out that this error occurs when there is no result returned from searching. In this case, the cursor is an emptyCursor which has no count. So we get this error.
static get emptyCursor() {
return { fetch: () => [], observe: () => { return { stop: () => null }; }, stop: () => {} };
}
For people who intend, here is my setup for ElasticSearchEngine to work with the newest changes of ElasticSearch https://gist.github.com/sonnguyenthai/91164e0b4ccf1c878930bc9febb4f7dc. And as @AdrianAbba said, you should build your own query to match your requires
feel free to create a PR with these fixes included
Fix by @bompi88 is now released, please test this in the latest release v2.1.7
Exception in setInterval callback: TypeError: cursor.mongoCursor.count is not a function at packages/easysearch:core/lib/core/search-collection.js:189:37 at [object Object]._.extend.withValue (packages\meteor.js:1122:17) at packages\meteor.js:445:45 at runWithEnvironment (packages\meteor.js:1176:24)