From c9308a70fdcc0c797b6a9f5d3ec227ed4d7a5280 Mon Sep 17 00:00:00 2001 From: Thomas Wilkerling Date: Mon, 3 Oct 2022 11:16:23 +0200 Subject: [PATCH] fix issue #264 --- src/document.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/document.js b/src/document.js index d93c61b..ae7b0da 100644 --- a/src/document.js +++ b/src/document.js @@ -484,7 +484,7 @@ Document.prototype.search = function(query, limit, options, _resolve){ if(!limit && is_object(query)){ options = /** @type {Object} */ (query); - query = options["query"]; + query = ""; } else if(is_object(limit)){ @@ -506,12 +506,13 @@ Document.prototype.search = function(query, limit, options, _resolve){ } else{ + query = options["query"] || query; pluck = options["pluck"]; field = pluck || options["index"] || options["field"] /*|| (is_string(options) && [options])*/; tag = SUPPORT_TAGS && options["tag"]; enrich = SUPPORT_STORE && this.store && options["enrich"]; bool = options["bool"] === "and"; - limit = options["limit"] || 100; + limit = options["limit"] || limit || 100; offset = options["offset"] || 0; if(tag){