Skip to content

Repository files navigation

Leaf

Leaf logo

Simplified Chinese

CI License C++20 Release

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.

Features

  • Term, exact-phrase, and prefix queries
  • BM25 ranking and Top-K results
  • VByte-compressed postings and skip pointers
  • TXT and EPUB ingestion

Build

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-failure

Use in your project

Add 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.

License

Licensed under Apache-2.0.

About

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.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages