Skip to content

Commit

Permalink
fix issue #313
Browse files Browse the repository at this point in the history
  • Loading branch information
ts-thomas committed Oct 3, 2022
1 parent c9308a7 commit a26cd53
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,19 +558,21 @@ Document.prototype.search = function(query, limit, options, _resolve){

for(let i = 0, res, key, len; i < field.length; i++){

let opt;
let field_options;

key = field[i];

if(!is_string(key)){

opt = key;
key = key["field"];
field_options = key;
key = field_options["field"];
query = field_options["query"] || query;
limit = field_options["limit"] || limit;
}

if(promises){

promises[i] = this.index[key].searchAsync(query, limit, opt || options);
promises[i] = this.index[key].searchAsync(query, limit, field_options || options);

// just collect and continue

Expand All @@ -584,7 +586,7 @@ Document.prototype.search = function(query, limit, options, _resolve){

// inherit options also when search? it is just for laziness, Object.assign() has a cost

res = this.index[key].search(query, limit, opt || options);
res = this.index[key].search(query, limit, field_options || options);
}

len = res && res.length;
Expand Down

0 comments on commit a26cd53

Please sign in to comment.