Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
docs: link pgvector issues in retrieval engine guide
younggglcy6da4b3acc73d
diff --git a/website-docs/03-features/05-retrieval-engines.md b/website-docs/03-features/05-retrieval-engines.mdindex 2997a65c3..4d2812b67 100644--- a/website-docs/03-features/05-retrieval-engines.md+++ b/website-docs/03-features/05-retrieval-engines.md@@ -118,7 +118,7 @@ flowchart TD`internal/application/repository/retriever/postgres/repository.go`。数据与业务库同库(`embeddings` 表,GORM 管理)。-- **向量检索**:pgvector `halfvec`(半精度,2 字节/维)。`embedding` 列不定维,HNSW 索引建在表达式 `(embedding::halfvec(dim)) halfvec_cosine_ops` 上——**ORDER BY 表达式必须与索引表达式完全一致**(两侧显式 cast),否则退化为顺序扫描(源码注释引 pgvector issue #702/#835)。查询用子查询先取 `expandedTopK`(TopK*2,夹在 [100,200],避免大 LIMIT 拖垮 HNSW)个候选算 `distance = embedding <=> query`,再按 `distance <= 1-threshold` 过滤,`score = 1 - distance`。事务内 `SET LOCAL hnsw.ef_search`(≥40)与 `SET LOCAL hnsw.iterative_scan = strict_order`(pgvector ≥ 0.8,选择性过滤下持续补召回),老版本 GUC 不存在时自动降级重试。+- **向量检索**:pgvector `halfvec`(半精度,2 字节/维)。`embedding` 列不定维,HNSW 索引建在表达式 `(embedding::halfvec(dim)) halfvec_cosine_ops` 上——**ORDER BY 表达式必须与索引表达式完全一致**(两侧显式 cast),否则退化为顺序扫描(源码注释引 pgvector issue [#702](https://github.com/pgvector/pgvector/issues/702)/[#835](https://github.com/pgvector/pgvector/issues/835))。查询用子查询先取 `expandedTopK`(TopK*2,夹在 [100,200],避免大 LIMIT 拖垮 HNSW)个候选算 `distance = embedding <=> query`,再按 `distance <= 1-threshold` 过滤,`score = 1 - distance`。事务内 `SET LOCAL hnsw.ef_search`(≥40)与 `SET LOCAL hnsw.iterative_scan = strict_order`(pgvector ≥ 0.8,选择性过滤下持续补召回),老版本 GUC 不存在时自动降级重试。- **关键词检索**:ParadeDB `pg_search` BM25——`content ||| query`(任意 token 匹配)+ `paradedb.score(id) as score`。- **过滤**:`knowledge_base_id` / `knowledge_id` / `tag_id` IN 过滤(AND 语义),`is_enabled` 为 NULL 或 true。- **建索引**:`BatchSave` + `ON CONFLICT DO NOTHING`;删除按 chunk/source/knowledge ID 物理删除。