FuzzySearch
FuzzySearch copied to clipboard
Highlight exact search query
Characters that are not present in a search query get highlighted:
Code
import FuzzySearch from 'fz-search'; // v1.0.0
const nodes = [
{
value: 'primer'
},
];
const fuzzy = new FuzzySearch({
source: nodes,
keys: 'value',
});
const [result] = fuzzy.search('pre').map(
item => fuzzy.highlight(item.value)
);
console.log(result);
Actual result
<strong class="highlight">prime</strong>r
primer
Expected result
<strong class="highlight">pr</strong>im<strong class="highlight">e</strong>r
primer
Problem
As you can see, symbols im
aren't present in a search query, but they are still highlighted.
Is it possible to avoid highlighting of symbols that are not present in a search query?
Sorry for late reply. Gap filling is a feature for less tech savy that prefer word and word-part than bag of letters. However it's optional, set this to 0:
highlight_bridge_gap: 0, // default 2