Minimal Text Search
This is a dependency free text substring search system that is meant to be small, fast enough and limited. I have tested this on a modern desktop and it takes about 16 ms to search for a substring in 5000 records. If you try to use this for more than a few thousand records it is going to be more than a few milliseconds to search, but as this is only meant for client side JS I think you may have other problems
install
npm install --save minimal-text-search
Similarities to Lunr.js
This is not meant to be a drop in replacement for Lunr.js, the only thing I have implement is a very simple substring search, but I have tried to emulate their interfaces where possible.
The only search capability that is currently implemented is exact substring match.
How to Index and Search:
; // same field config API as lunrconst search = { this; this; this;}; search; search; search; const results1 = search; // 1 resultconst results2 = search; // 0 resultsconst res3 = search; // 1 result
What does Result Structure look like?
// assume that the same dataset above has been used const res4 = search; // 2 results (Johannes and Angeles will match) console;
The log statment yields:
// You will get an array of hits. If no results you get empty array. document: // A link to the original document (not a copy) name: 'Elon Musk' address: 'Los Angeles, CA' dateOfBirth: 'N/A' id: 45400 hits: 1 // Total hits in this document matches: 19 // Hit position of where it found a match document: name: 'Johannes Brahms' address: 'Vienna, Austria' dateOfBirth: '7 May 1833' id: 45600 hits: 1 matches: 6