Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Add Size Query Param for Elastic Search (#715)
Browse files Browse the repository at this point in the history
* added size for ES queries

* undelete example config folder

* oops

* update results to 25

* actually make ajax request with correct data

* learned that binding this works on promises too

* added new line on config

* forgot to change self
  • Loading branch information
donaldwasserman authored and jkleinsc committed Oct 17, 2016
1 parent a1e3b8a commit d59c43e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export default Adapter.extend(PouchAdapterUtils, {
'mapReduce'
],

_esDefaultSize: 25,

_executeContainsSearch(store, type, query) {
return new Ember.RSVP.Promise((resolve, reject) => {
let typeName = this.getRecordTypeName(type);
Expand Down Expand Up @@ -57,10 +59,16 @@ export default Adapter.extend(PouchAdapterUtils, {
reject('Search results are not valid');
}
};

if (Ember.isEmpty(query.size)) {
query.size = this.get('_esDefaultSize');
}

Ember.$.ajax(searchUrl, {
dataType: 'json',
data: {
q: queryString
q: queryString,
size: this.get('_esDefaultSize')
},
success: successFn
});
Expand Down Expand Up @@ -138,6 +146,7 @@ export default Adapter.extend(PouchAdapterUtils, {
break;
}
}

if (!specialQuery) {
if (query.options) {
this._init(store, type);
Expand Down

0 comments on commit d59c43e

Please sign in to comment.