Skip to content

Tantivy

A Rust library for building full-text search into your own software, inspired by Apache Lucene.

Stars
16.4k
Forks
1k
Licence
MIT
Language
Rust
Last update
7 days ago
Type
Library

What it is

Tantivy is a full-text search library written in Rust. It is not a ready-made search server; it is a building block that developers use to create their own search engine, similar in design to Apache Lucene. It supports features such as BM25 scoring, phrase and range queries, faceted search, and incremental indexing.

  • Embed full-text search with phrase and boolean queries in a Rust application
  • Build a command-line search tool over local documents
  • Index a large text collection with multithreaded indexing
  • Add Chinese, Japanese, or Korean tokenization via third-party crates
  • Use it as a search backend in an email archiver or message indexer, as examples in the README show

Great for

  • Rust developers who need full-text search inside an application
  • Teams building a custom search engine who want Lucene-style design in Rust
  • Command-line tools that need search with fast startup (README cites under 10ms startup)
  • Projects needing multilingual tokenization through third-party tokenizer crates

Not ideal for

  • People who want an off-the-shelf search server with a REST API; the README says Tantivy is a crate, not a server, so tantivy-cli or Quickwit may suit better
  • Anyone needing distributed search across machines, which the README lists as out of scope (see Quickwit)
  • Non-Rust programmers who want to use it directly; bindings such as tantivy-py exist but are described as possibly less maintained for others
Step-by-step guide: how to use TantivyInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    You'll need: Rust stable toolchain (with cargo)

    Clone the repository

    git clone https://github.com/quickwit-oss/tantivy.git

    Enter the directory

    cd tantivy

    Run the tests

    cargo test
  2. 2

    Run it

    • Install the Rust stable toolchain
    • Clone the repository and run cargo test to confirm the build works
    • Read the basic search example linked in the README
    • Add tantivy as a dependency in your own Rust project and build an index
    • Commit the IndexWriter and reload the IndexReader before searching
  3. 3

    Get the most out of it

    • Use the tantivy-cli tutorial to get a working search engine running quickly
    • Add language-specific tokenizers such as tantivy-jieba or lindera for Asian languages
    • Use the aggregation collector for histograms, range buckets, and stats
    • Consult the docs.rs reference for the latest released version
    • Explore Quickwit if you later need distributed search

Downloads

Strengths

  • Written in Rust and designed after Apache Lucene, with BM25 scoring that the README says matches Lucene
  • Feature list is broad: facets, range queries, JSON fields, aggregations, and multiple compression options
  • MIT licensed and actively maintained, with a published API reference on docs.rs

Trade-offs

  • It is a library, so you must write code to build a working search product; there is no ready-made UI or server
  • Performance claims come from the project's own benchmark, and the README itself warns results will vary by query and load
  • Documents are immutable, so edits require delete and reindex, and changes only show after commit and reader reload

How it compares

ProjectStarsTypeLevelUpdatedBest for
tantivy (this)16.4kLibraryintermediate7 days agoRust developers who need full-text search inside an application
awesome-hacker-search-engines11.5kCurated listbeginner4 days agoSecurity professionals starting a penetration test or vulnerability assessment who need a place to look up data

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.