KiaraDB: Tree-Based Indexing for Multi-Field In-Memory Search in Java and TypeScript
Open-source in-memory search for Java and TypeScript: any mix of filters, typo fixes, and type-ahead. How KiaraDB works, and where it falls short.
KiaraDB is an open-source in-memory search library for Java and TypeScript, designed to handle complex search queries on multi-field data stored in memory. Users define their fields, load records, and prepare the indexes once, after which any combination of fields can be queried with a single operation. The library uses a tree-based indexing approach, where each field is represented by a path through a tree, allowing for efficient lookups and combining of fields without scanning records.
KiaraDB has two implementations: Kiara for Java and kiara-ts for TypeScript. Kiara is licensed under Apache-2.0, while kiara-ts is licensed under MIT and has zero runtime dependencies. Both libraries share the same search behavior and have been compared using a contract check. The library handles typo correction and type-ahead for text inputs, making it suitable for real-world applications where users may enter data with errors or typos.
The library supports various query operators, including inclusive BETWEEN for numeric ranges, "all of", "any of", and "none of" on lists, explicit null matching, and range fields. It also includes typo-tolerant text search, which corrects one wrong, missing, or extra letter per word and matches English word forms. Additionally, KiaraDB offers shorthand queries that interpret input, convert units, and throw errors for unresolved fragments.
Some strengths of KiaraDB include the ability to combine any number of fields in a single query, fast repeated queries, and low overhead compared to generic Array.filter and Fuse.js implementations. However, there are some limitations, such as storing lists as comma-separated strings instead of arrays and potential issues with fractional search values when using Native normalization. Overall, KiaraDB provides an efficient and flexible solution for in-memory search in Java and TypeScript applications.
Rewritten by urgent.news; may contain errors โ check the original.
Source: hackernoon.com
Read the original at hackernoon.com โ
More from HackerNoon on urgent.news
Report a problem with this story
Get the day's news by email. Daily, weekly or monthly. Sign up