From 9c22991692c5dec5a1a03ccef66a7a7757bf8ab3 Mon Sep 17 00:00:00 2001 From: Andrew Woods Date: Thu, 16 Nov 2023 18:45:01 -0500 Subject: [PATCH] Update search-ui.js : typo in query config The intent of the code is to perform an `AND` query with the terms provided in the search. However, there is a typo in the search fields configuration that results in the default `OR` behavior. We should be using `bool: "AND"` instead of 'boolean: "AND"'. See: https://github.com/weixsong/elasticlunr.js#522-boolean-model To test on the [demo site](https://minicomp.github.io/wax/search/), a search with "portrait" returns 3 results. * a search with "portrait Majnun" currently returns 4 results (`OR` behavior) * the search should return 1 result (`AND` behavior) --- assets/search-ui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/search-ui.js b/assets/search-ui.js index 96cd6eee6..ecb118909 100644 --- a/assets/search-ui.js +++ b/assets/search-ui.js @@ -51,7 +51,7 @@ function startSearchUI(fields, indexFile, url) { $('input#search').on('keyup', function() { var results_div = $('#results'); var query = $(this).val(); - var results = index.search(query, { boolean: 'AND', expand: true }); + var results = index.search(query, { bool: 'AND', expand: true }); results_div.empty(); results_div.append(`

Displaying ${results.length} results

`);