Skip to content

Full-Text Search

TensorDB includes a built-in full-text search (FTS) engine as a facet alongside the relational SQL surface.

Creating an FTS Index

// Enable FTS on a key prefix
db.create_fts_index("articles/")?;

Indexing Documents

db.put("articles/1", Value::Text(
"TensorDB is a bitemporal database with MVCC support".into()
))?;
db.put("articles/2", Value::Text(
"The LSM storage engine uses bloom filters for fast lookups".into()
))?;

Searching

let results = db.fts_search("articles/", "bitemporal MVCC")?;
for (key, score) in results {
println!("{}: relevance={:.2}", key, score);
}

Features

  • Tokenization: Text is split into tokens for indexing
  • Relevance scoring: TF-IDF based scoring ranks results by relevance
  • Prefix matching: Search for partial words
  • Boolean queries: AND, OR operators for combining terms

Use Cases

  • Document search within the database
  • Log analysis and filtering
  • Content-based retrieval alongside structured SQL queries