Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Library Overview

The laurus crate is the core search engine library. It provides lexical search (keyword matching via inverted index), vector search (semantic similarity via embeddings), and hybrid search (combining both) through a unified API.

Module Structure

graph TB
    LIB["laurus (lib.rs)"]

    LIB --> engine["engine\nEngine, EngineBuilder\nSearchRequest, FusionAlgorithm"]
    LIB --> analysis["analysis\nAnalyzer, Tokenizer\nToken Filters, Char Filters"]
    LIB --> lexical["lexical\nInverted Index, BM25\nQuery Types, Faceting, Highlighting"]
    LIB --> vector["vector\nFlat, HNSW, IVF\nDistance Metrics, Quantization"]
    LIB --> embedding["embedding\nCandle BERT, OpenAI\nCLIP, Precomputed"]
    LIB --> storage["storage\nMemory, File, Mmap\nColumnStorage"]
    LIB --> store["store\nDocumentLog (WAL)"]
    LIB --> spelling["spelling\nSpelling Correction\nSuggestion Engine"]
    LIB --> data["data\nDataValue, Document"]
    LIB --> error["error\nLaurusError, Result"]

Key Types

TypeModuleDescription
EngineengineUnified search engine coordinating lexical and vector search
EngineBuilderengineBuilder pattern for configuring and creating an Engine
SchemaengineField definitions and routing configuration
SearchRequestengineUnified search request (lexical, vector, or hybrid)
FusionAlgorithmengineResult merging strategy (RRF or WeightedSum)
DocumentdataCollection of named field values
DataValuedataUnified value enum for all field types
LaurusErrorerrorComprehensive error type with variants for each subsystem

Feature Flags

The laurus crate has no default features enabled. Enable embedding support as needed:

FeatureDescriptionDependencies
embeddings-candleLocal BERT embeddings via Hugging Face Candlecandle-core, candle-nn, candle-transformers, hf-hub, tokenizers
embeddings-openaiOpenAI API embeddingsreqwest
embeddings-multimodalCLIP multimodal embeddings (text + image)image, embeddings-candle
embeddings-allAll embedding features combinedAll of the above
# Lexical search only (no embedding)
[dependencies]
laurus = "0.1.0"

# With local BERT embeddings
[dependencies]
laurus = { version = "0.1.0", features = ["embeddings-candle"] }

# All features
[dependencies]
laurus = { version = "0.1.0", features = ["embeddings-all"] }

Sections