krisk / Fuse

Lightweight fuzzy-search, in JavaScript
https://fusejs.io/
Apache License 2.0
18.2k stars 768 forks source link

Custom results formatting function #482

Closed sytolk closed 4 years ago

sytolk commented 4 years ago

Description

A clear and concise description of the problem or missing capability... Now fuse.js return results like {item: {..}} I needs to reformat (strip item) and skip some properties from results. ### Describe the solution you'd like If you have a solution in mind, please describe it. Its better to have default getResults() function. User can provide custom getResults() like: ``` const customResults = (result) => { cutomItem: { customProps: result.props } } const fuse = new Fuse(results, fuseOptions); results = fuse.search('searchQuery', customResults); ``` ### Describe alternatives you've considered Have you considered any alternative solutions or workarounds? Alternatively results can be fultered after searching but if you search in bigger text and this text properties its not needed in result object this solution will be with very bad performance (its need extra RAM usage)
kesylo commented 4 years ago

yes this will be pretty handy. A way to get only the properties you need from the result instead of all the object

github-actions[bot] commented 4 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days