A lightweight, index-free full-text search library for JavaScript with TF-IDF ranking.
libsearch is a lightweight JavaScript library that provides full-text search capabilities without requiring a pre-built index. It transforms search queries into regular expressions and uses a TF-IDF-like ranking algorithm to return relevant results from arrays of strings or objects. It solves the problem of adding simple, fast search to web applications without the complexity of setting up and maintaining a search index.
JavaScript developers building client-side web applications or Node.js projects that need to implement search functionality over small to medium datasets (up to thousands of documents). It's particularly useful for prototypes, personal projects, or applications where data changes frequently and indexing overhead is undesirable.
Developers choose libsearch for its simplicity and zero-configuration approach—it works out of the box without an indexing step. Its performance is sufficient for many real-time search scenarios, and it provides better ranking than basic string matching while remaining lightweight and easy to integrate.
Simple, index-free full-text search for JavaScript
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Doesn't require a pre-built index, enabling immediate search on dynamic datasets as emphasized in the README's philosophy of simplicity.
Supports 'word', 'prefix', and 'autocomplete' modes, allowing tailored search behaviors for use cases like autocomplete bars, with examples provided in the API section.
Returns sorted results using an approximated TF-IDF algorithm, offering better relevance than basic string matching, as explained in the 'How it works' section.
Works in both browser and Node.js with minimal setup, and includes built-in TypeScript definitions for enhanced developer experience, noted in the installation instructions.
Designed for small to medium datasets; the README admits performance relies on O(n) regex filtering, which degrades with larger data due to lack of indexing.
Uses document length instead of word count for TF-IDF, a simplification that might not always reflect true relevance, as detailed in the algorithm explanation.
Lacks capabilities like fuzzy matching or lemmatization compared to libraries like FlexSearch, as acknowledged in the 'How it works' section where it's described as a step above basic search.