Wikantik Hybrid Search Architecture

Wikantik features a high-precision, multi-stage retrieval pipeline designed to serve both humans and AI agents. It goes beyond simple keyword matching by fusing lexical, semantic, and relational data.

1. The Retrieval Pipeline

When a query is submitted (via /api/search or the retrieve_context tool), it undergoes four distinct phases:

A. Lexical Retrieval (BM25)

The first stage uses Apache Lucene to perform a classic BM25 search.

B. Dense Retrieval (pgvector)

In parallel, the query is converted into a high-dimensional vector.

C. Hybrid Fusion (RRF)

The results from BM25 and Dense retrieval are combined using Reciprocal Rank Fusion (RRF).

D. Knowledge Graph Reranking

KG reranking is off by default (boost=0, never wired into production; shelved 2026-06-16 after a measured zero-lift ceiling spike). See KnowledgeGraphRerank.

2. The Embedding Infrastructure

Wikantik's dense search depends on a chunk-and-embed pipeline:

  1. Chunking: Pages are split into logical chunks (usually by headings) during the save process.
  2. Embedding: Chunks are processed by the EmbeddingClient (communicating with Ollama, OpenAI, or TEI).
  3. Storage: Vectors are stored in PostgreSQL with an HNSW index for fast O(\log n) nearest-neighbor retrieval.

3. Evaluation and Refinement

Search quality is measured by a standalone utility in the wikantik-tools module.


See Also: