remove 'must match'

This commit is contained in:
simon 2019-11-08 21:46:54 -05:00
parent d761a3b595
commit b0a868bb73
3 changed files with 5 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -32,10 +32,6 @@ window.onload = () => {
}) })
}; };
function toggleSearchBar() {
searchDebounced();
}
function toggleFuzzy() { function toggleFuzzy() {
searchDebounced(); searchDebounced();
} }
@ -222,7 +218,7 @@ function search() {
let query = searchBar.value; let query = searchBar.value;
let empty = query === ""; let empty = query === "";
let condition = $("#barToggle").prop("checked") && !empty ? "must" : "should"; let condition = empty ? "should" : "must";
let filters = [ let filters = [
{range: {size: {gte: size_min, lte: size_max}}}, {range: {size: {gte: size_min, lte: size_max}}},
{terms: {index: selectedIndices}} {terms: {index: selectedIndices}}
@ -275,7 +271,7 @@ function search() {
content: {}, content: {},
name: {}, name: {},
"name.nGram": {}, "name.nGram": {},
// font_name: {}, font_name: {},
} }
}, },
aggs: { aggs: {

View File

@ -24,10 +24,7 @@
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<div class="input-group-text"> <div class="input-group-text">
<span onclick="document.getElementById('barToggle').click()">Must match&nbsp</span> <span onclick="document.getElementById('fuzzyToggle').click()">Fuzzy&nbsp</span>
<input title="Toggle between 'Should' and 'Must' match mode" type="checkbox" id="barToggle"
onclick="toggleSearchBar()" checked>
<span onclick="document.getElementById('fuzzyToggle').click()">&nbsp&nbspFuzzy&nbsp</span>
<input title="Toggle fuzzy searching" type="checkbox" id="fuzzyToggle" <input title="Toggle fuzzy searching" type="checkbox" id="fuzzyToggle"
onclick="toggleFuzzy()" checked> onclick="toggleFuzzy()" checked>
</div> </div>