karmi / ember-data-elasticsearch

elasticsearch adapter for Ember Data
http://karmi.github.com/ember-data-elasticsearch
MIT License
93 stars 22 forks source link

strange results in findQuery function #3

Open opennomad opened 11 years ago

opennomad commented 11 years ago

I was having issues with returning results via findQuery. The returned array contained the right number of results, but they all only showed the first result repeated.

I modified the code to use the same approach as findAll function and that produced the desired results.

Here is a patch to elasticsearch_adapter.js

186c186,188
<       recordArray.load(data['hits']['hits'].map( function(i) { return i['_source'] } ));

---
>       recordArray.load(data['hits']['hits'].map( function(i) {
>         return Ember.Object.create(i['_source']).reopen({id: i._id, version: i._version})
>       } ));

\@matthias