Skip to main content
Zeus’s knowledge base retrieval uses a dual-path recall strategy combining vector semantic search + BM25 keyword matching, with results merged via RRF (Reciprocal Rank Fusion) to balance semantic understanding and exact matching.

Dual-path Recall + RRF Fusion

Retrieval Flow

Parameter Configuration

Fallback Strategy

When rank-bm25 or jieba is not installed, the system automatically falls back to vector-only search mode, using only pgvector for semantic retrieval. A log message is emitted: ⚠️ BM25 dependencies unavailable, using vector-only search mode.

BM25Store 3-tier Cache

The BM25 index uses a 3-tier cache architecture, supporting lazy loading and multi-instance deployments:

Cache Tiers

Index Lifecycle

Index Data Structure

PostgreSQL Persistence Table


Multi-Knowledge-Base Retrieval

When a user associates multiple knowledge bases in a conversation, the system performs dual-path retrieval independently on each knowledge base, then merges all results sorted by score: Each knowledge base has its own independent BM25 index, with no interference between them.

RAGService

RAGService is the service-layer wrapper for retrieval, providing: