feat: Super Search - Hybrid BM25 + Vector search#61
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
16921c6 to
617cb4e
Compare
617cb4e to
7220c48
Compare
7220c48 to
3c22cea
Compare
3c22cea to
5cbcfdf
Compare
Owner
Author
|
@greptile |
5cbcfdf to
de88982
Compare
Owner
Author
|
@greptile |
This comment was marked as outdated.
This comment was marked as outdated.
de88982 to
3bfd849
Compare
Owner
Author
|
@greptile |
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.
Summary
Implements hybrid search over PRs and Work Items using:
Features
Changes
toki-api/src/domain/search/- Core search moduletoki-api/migrations/- search_documents tabletoki-api/src/routes/search.rs- GET /search APIapp/src/components/cmd-k.tsx- Frontend search UIReview Fixes Applied
Greptile Overview
Greptile Summary
domain/searchmodule implementing hybrid BM25 full-text + pgvector semantic search fused via Reciprocal Rank Fusion (RRF).search_documentsschema/migration (tsvector + HNSW index) and a background index worker gated onGEMINI_API_KEY.GET /searchAPI endpoint and integrates results into the Cmd+K command palette with debouncing.Confidence Score: 3/5
sqlx::query_as!, which will break compilation or runtime query execution until corrected.Important Files Changed
Sequence Diagram
sequenceDiagram autonumber participant UI as Cmd+K UI (app) participant RQ as React Query participant API as toki-api /search participant SS as SearchService participant P as Query parser participant E as GeminiEmbedder participant DB as PgSearchRepository participant PG as Postgres (search_documents) UI->>RQ: queries.search.search(query, limit) RQ->>API: GET /search?q=...&limit=... API->>SS: search(q, limit) SS->>P: parse_query(trim(q)) alt parsed.search_text length >= 2 SS->>E: embed(parsed.search_text) E-->>SS: embedding[1536] SS->>DB: search(parsed, Some(embedding), limit) DB->>PG: BM25 CTE + vector CTE + RRF + LIMIT PG-->>DB: rows DB-->>SS: results else short query SS->>DB: search(parsed, None, limit) DB->>PG: BM25-only query PG-->>DB: rows DB-->>SS: results end SS-->>API: Vec<SearchResult> API-->>RQ: JSON results RQ-->>UI: render results / navigation