Skip to content

Commit

Permalink
Initital try with ES aggregations.
Browse files Browse the repository at this point in the history
  • Loading branch information
bompi88 committed Apr 24, 2017
1 parent 2e1b713 commit ecd4e1d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/easysearch:core/lib/core/search-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ class SearchCollection {
() => this.changed(
collectionName,
'searchCount' + definitionString,
{ count: cursor.mongoCursor.count && cursor.mongoCursor.count() || 0 }
// TODO: I substituted cursor.mongoCursor.count with cursor.count. will this break things?
{ count: cursor.count && cursor.count() || 0 }
),
collectionScope._indexConfiguration.countUpdateIntervalMs
);
Expand Down
4 changes: 2 additions & 2 deletions packages/easysearch:elasticsearch/lib/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ if (Meteor.isServer) {
}

indexConfig.searchCollection = new ESSearchCollection(indexConfig, this);
indexConfig.mongoCollection = indexConfig.searchCollection._hitsCollection;
indexConfig.mongoCollection = indexConfig.searchCollection._collection;

if (Meteor.isServer) {
indexConfig.elasticSearchClient = new elasticsearch.Client(this.config.client);
Expand Down Expand Up @@ -218,7 +218,7 @@ if (Meteor.isServer) {
})
}, { limit: options.search.limit });
} else {
cursor = EasySearch.ESCursor.emptyCursor;
cursor = ESCursor.emptyCursor;
}

fut['return'](new ESCursor(cursor, total, true, null, aggs));
Expand Down
2 changes: 1 addition & 1 deletion packages/easysearch:elasticsearch/lib/search-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ESSearchCollection extends SearchCollection {
let mongoCursor = this._getMongoCursor(searchDefinition, options);

if (!_.isNumber(count)) {
return new ESCursor(mongoCursor, 0, false, aggs);
return new ESCursor(mongoCursor, 0, false, null, aggs);
}

return new ESCursor(mongoCursor, count, true, publishHandle, aggs);
Expand Down

0 comments on commit ecd4e1d

Please sign in to comment.