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

ライブラリ概要

laurus クレートは検索エンジンのコアライブラリです。Lexical検索(転置インデックス(Inverted Index)によるキーワードマッチング)、Vector検索(Embeddingによるセマンティック類似度検索)、およびハイブリッド検索(両者の組み合わせ)を統一的なAPIで提供します。

モジュール構成

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"]

主要な型

モジュール説明
EngineengineLexical検索とVector検索を統合する検索エンジン
EngineBuilderengineEngineの設定・構築を行うBuilderパターン
Schemaengineフィールド定義とルーティング設定
SearchRequestengine統一的な検索リクエスト(Lexical、Vector、またはハイブリッド)
FusionAlgorithmengine結果マージ戦略(RRFまたはWeightedSum)
Documentdata名前付きフィールド値のコレクション
DataValuedataすべてのフィールド型に対応する統一的な値のenum
LaurusErrorerror各サブシステムのバリアントを含む包括的なエラー型

Feature Flag

laurus クレートはデフォルトではFeatureが有効化されていません。必要に応じてEmbeddingサポートを有効にしてください。

Feature説明依存クレート
embeddings-candleHugging Face CandleによるローカルBERT Embeddingcandle-core, candle-nn, candle-transformers, hf-hub, tokenizers
embeddings-openaiOpenAI API Embeddingreqwest
embeddings-multimodalCLIPマルチモーダルEmbedding(テキスト + 画像)image, embeddings-candle
embeddings-allすべてのEmbedding Featureを含む上記すべて
# Lexical検索のみ(Embeddingなし)
[dependencies]
laurus = "0.1.0"

# ローカルBERT Embeddingを使用
[dependencies]
laurus = { version = "0.1.0", features = ["embeddings-candle"] }

# すべてのFeatureを有効化
[dependencies]
laurus = { version = "0.1.0", features = ["embeddings-all"] }

セクション