Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Restore previous behavior of search.

The callback gets the embedded response object, not the entire
result.
  • Loading branch information...
commit 5667e043d3dbc99b0e6aa40524a5c2351640705f 1 parent d769c4c
@roidrage roidrage authored
Showing with 13 additions and 5 deletions.
  1. +8 −0 lib/http-search-client.js
  2. +5 −5 test/http-client-search-test.js
View
8 lib/http-search-client.js
@@ -63,6 +63,14 @@ HttpSearchClient.prototype.remove = function(index, documents, callback) {
*/
HttpSearchClient.prototype.find = function(index, query, options, callback) {
var meta = new HttpSearchMeta(this._defaults, options, {callback: callback, index: index, operation: 'select', q: query, wt: 'json', });
+ this._run(meta);
+}
+
+HttpSearchClient.prototype._run = function(meta) {
+ var callback = meta.callback;
+ meta.callback = function(err, data, meta) {
+ callback(err, data.response, meta);
+ }
this._execute(meta);
}
View
10 test/http-client-search-test.js
@@ -46,13 +46,13 @@ seq()
})
.seq(function(data) {
test('Finds one result');
- assert.equal(data.response.numFound, 1);
- assert.equal(data.response.docs[0].id, "test-search@gmail.com");
+ assert.equal(data.numFound, 1);
+ assert.equal(data.docs[0].id, "test-search@gmail.com");
this.ok(data)
})
.seq(function(data) {
test('Includes the document');
- assert.equal(data.response.docs[0].fields.email, "test-search@gmail.com");
+ assert.equal(data.docs[0].fields.email, "test-search@gmail.com");
this.ok();
})
.seq(function() {
@@ -70,7 +70,7 @@ seq()
})
.seq(function(data) {
test('Includes the added document');
- assert.equal(data.response.docs[0].fields.name, "Sean Cribbs");
+ assert.equal(data.docs[0].fields.name, "Sean Cribbs");
this.ok();
})
.seq(function() {
@@ -87,7 +87,7 @@ seq()
}.bind(this));
})
.seq(function(data) {
- assert.equal(data.response.numFound, 0);
+ assert.equal(data.numFound, 0);
this.ok();
})
.seq(function() {
Please sign in to comment.
Something went wrong with that request. Please try again.