Module

FuzzySearch

component displays search input field; when initialized with data by init method it will trigger custom 'searchResultsReady' event with "fuzzy" (approximate) search results. Component internally uses fuse.js (https://fusejs.io) and shape of results returned in 'searchResultsReady' event.detail.results reflects results returned by fuse.js (https://fusejs.io/examples.html)

will generate only search input field. Providing data to search in and getting results of the search should be done with 'init' method and handling of 'searchResultsReady' event respectively

Properties:
Name Type Attributes Default Description
animate boolean

attribute adds animated transition from search button to search input on click

minLength number <optional>
2

min-length attribute is limiting minimal length of the input value to perform a search

maxResult number <optional>
100

max-result attribute is limiting the amount of result items returned

searchDelay number <optional>
200

search-delay attribute is number of ms between triggering search with 'input' event of the input field

threshold number <optional>
0.6

threshold param for the search (https://fusejs.io/api/options.html#threshold)

distance number <optional>
20

distance param for the search (https://fusejs.io/api/options.html#distance)

View Source frontend/components/generic/fuzzy_search.js, line 102

Example
<fuzzy-search max-result="10" distance="30"></fuzzy-search>

Classes

FuzzySearch