Leaf is a C++20, in-memory full-text search engine for English TXT and EPUB documents. It builds a positional inverted index and returns BM25-ranked results with UTF-8 byte offsets.
- Term, exact-phrase, and prefix queries
- BM25 ranking and Top-K results
- VByte-compressed postings and skip pointers
- TXT and EPUB ingestion
Requirements: CMake 3.24+, a C++20 compiler, Catch2 3, libzip, Lexbor, and pugixml.
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build
ctest --test-dir build --output-on-failureAdd Leaf to your CMake build and link leaf-core:
add_subdirectory(<path-to-leaf>)
target_link_libraries(<your-target> PRIVATE leaf-core)Use LeafCore::AddTxt or LeafCore::AddEpub to add documents supplied by your application. Call Finalize once indexing is complete, then parse user input with ParseQuery and pass the query to Search.
Licensed under Apache-2.0.