Skip to main content

Module chunks

Module chunks 

Source
Expand description

Searchable chunks store backed by SQLite FTS5.

Port reference: Aonyx RAG rag_system/utils/bm25_store.py + utils/hybrid_search.py.

§V1 scope (this file)

  • Chunk = a piece of text + project + source + timestamp + free-form metadata.
  • SQLite FTS5 virtual table provides BM25-ranked full-text search out of the box, with a unicode61 remove_diacritics 2 tokenizer that survives accents.
  • search_bm25(project?, query, k) returns the top-k chunks ordered by relevance, with positive score = -bm25(...) so larger = better.

§V1.1 (deferred)

  • Local embeddings via fastembed-rs (ONNX, ~30 MB model).
  • HNSW index for vector ANN search.
  • RRF fusion with k = 60 combining BM25 + vectors.
  • Exponential temporal boost on recent chunks.

The trait signature already accepts a mode field so V1.1 can extend it without breaking callers.

Structs§

Chunk
A piece of indexable text.
ScoredChunk
A search hit: a chunk and its score (larger = more relevant).
SqliteChunksStore
SQLite-backed ChunksStore using FTS5 for BM25 ranking.

Traits§

ChunksStore
Async chunks store.

Type Aliases§

ChunkId
Stable identifier for a Chunk.