Repository navigation
Conversation
The hydration threshold was also blocking the fallback after an empty Lance neighbor list, so small projects dropped into an Orama index with no vectors. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
审核时先看的边界
这支基于
v1.10.5(96ed8b77,#411)。1.10.5 已经把 Lance 行的身份改成联合键project_id + observation_id,补写和缓存按projectId:observationId判断,按项目删除只带项目条件。deleteMismatchedProjectRows不在这支里,也不会被加回来。这支只放宽「小项目能不能走进已有的
searchPersistentSemantically」。融合函数本身仍先看 Lance 的项目,再要求 canonical SQLite 的projectId与之相同。对不上的错标行不进排序。近邻重排、
vector匹配标记、--status传递在 #413,不在这支。前因
[retrieval] cjk = "vector"时,searchLanceInVectorOrder没有 10000 条门槛。小库上的中文查询可以走出向量序。10000 挡住的是下一条。近邻返回空之后,融合检索还要过
shouldUsePersistentSearch。默认门槛是MEMORIX_ORAMA_HYDRATION_THRESHOLD,不设就是 10000。条数低于这条线的项目,融合检索不跑。回退落到当次 Orama。一次性 CLI 调用
prepareSearchIndex({ skipCachedVectors: true }),Orama 文档的 embedding 是空的。近邻为空时,窗口只剩词法和 fuzzy。正文已经在 SQLite 里,搜索却回不到刚写入的那条。ascii = "hybrid"更直接:它不进searchLanceInVectorOrder。小库同样过不了 10000,Lance 和 FTS 不会融合。刚写入、Lance 还没 backfill 到的行,近邻路径本来就会空。这不是这支要修的门槛。
这次改了什么
src/store/orama-store.ts里,10000 继续只决定要不要把全库灌进 Orama。它不再决定「有查询向量时能不能读已有的 Lance」。查询向量已经算出来,并且
lexicalReady || persistentCorpusEligible时,调用现有的searchPersistentSemantically(options, projectIds, ...)。词法索引就绪的小项目因此也能融合。Lance 调用返回null(表不可用、重建中)时,仍退回现有 Orama。skipCachedVectors仍是true。近邻分数1 / (1 + 名次)不动。ascii的默认值仍是hybrid,不改成vector。新测试是
tests/search/small-corpus-lance-fallback.test.ts。它不靠把MEMORIX_ORAMA_HYDRATION_THRESHOLD设成1来假装小库。tests/search/orama-store-lexical-fallback.test.ts和tests/search/persistent-semantic-recovery.test.ts里仍有把门槛设成1的旧用例,这支没有改那些断言。明确不碰
mergeInsert(['project_id', 'observation_id']),不改按项目删除,不改按联合键补写。base_url和 5 分钟卸载。那是 fix: route Ollama embeddings with bounded probing #402,已在 1.10.5。--status。和相邻拉取请求
--status。它不改这道 10000 门槛。两支都改orama-store.ts,改的是不同函数。验收
cjk = "vector",Lance 近邻有命中:结果仍来自searchLanceInVectorOrder,模式仍是vector。null:退回现有 Orama。prepareSearchIndex({ skipCachedVectors: true })仍在。Orama 批量插入时缓存向量仍是空。tests/search/semantic-index.test.ts的回归,这支没有放宽它。提交前在本机跑过
tests/search/semantic-index.test.ts和tests/search/small-corpus-lance-fallback.test.ts,8 条通过。GitHub 运行46025892008的 7 项检查都成功,含 Ubuntu、Windows、macOS 测试。