improvement(knowledge): rank organization keyword search with Tin - #8007
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
All reported issues were addressed across 18 files
Tip: instead of fixing issues one by one fix them all with cubic
Re-trigger cubic
|
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 24 files
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Fix all with cubic | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 24 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
A member who reaches more of an organization search index than an exact ranking can afford searched keywords through the GIN projection, which scores every chunk matching the term before access is checked, so a common word cost seconds. Where the database provides the tin extension, a BM25 projection of search-index chunks is kept by embedding and knowledge-base triggers, and the keyword leg ranks with Tin first and checks access only on the top of that ranking, widening the window while too few ranked chunks are readable and leaving a page to GIN if the widest window cannot fill it. The query is analyzed by the same websearch_to_tsquery as the GIN path and translated to TINQL; shapes TINQL cannot express keep GIN. The path is gated by the knowledge-tin-keyword flag, a valid Tin index (built only after the backfill completes), and every base being a search index. Script migration 0019 installs the projection only where tin is available and creatable, so self-hosted databases keep an empty table and the GIN path.
4119ea6 to
844e40e
Compare
Summary
tinextension, a BM25 projection of organization-search-index chunks (embedding_keyword_tin) is kept by an embedding trigger. The keyword leg ranks with Tin, checks access on the top 2,000 ranked chunks, widens to 10,000 / 50,000 while too few are readable, and leaves the page to GIN if the widest window cannot fill itwebsearch_to_tsquery('english')as the GIN path and translated to TINQL (AND/OR/AND NOT/phrases/THEN/N); shapes TINQL cannot express (pure negation, negation inside OR, prefix matches) keep GINknowledge-tin-keywordflag (default off), a valid Tin index (built only after the backfill), every base being a search index, and no tag filters. Bounded members keep the permitted-set direct scan0019_tin_keyword_projection: installs the extension, functions, and trigger; backfills in keyset pages; builds the indexCONCURRENTLY(repairing an invalid one). A no-op wheretinis unavailable, and it skips instead of failing the deploy if the database refusesCREATE EXTENSIONkeyword.tinstage,keywordRanking: 'tin' | 'gin',keywordTinWindowMeasured on a production-sized copy (same cluster size, production JIT/planner settings)
Server critical path (permitted-set resolution + the slower retrieval leg), p50 over 4 queries each, a member reaching ~36% of the index:
"data pipeline"also matches "data for the pipeline"enabledupdates median 2.8 → 5.2 ms/row with occasional 7–12 ms spikesRollout
knowledge-tin-keywordin AppConfigMigration regenerated as
0367on top of #8005's0366.Type of Change
Testing
lib/knowledge+lib/core/config+connectors(5,668 passing), app and db type-check,bun run lint,check:audits,check:migrations origin/stagingChecklist