-
Notifications
You must be signed in to change notification settings - Fork 3
Hybrid search: PostgreSQL FTS + dense-vector retrieval with RRF fusion #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
samuelvkwong
wants to merge
68
commits into
main
Choose a base branch
from
feat/hybrid-search
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
f82f2f9
feat(pgsearch): add pgvector dependency for hybrid search
samuelvkwong ca89352
feat(pgsearch): add embedding and hybrid search settings
samuelvkwong 0477496
feat(pgsearch): add embedding backend protocol and built-in OpenAI/Ol…
samuelvkwong 3826215
feat(pgsearch): add sync EmbeddingClient with normalize, truncate, er…
samuelvkwong 8d4fa00
refactor(pgsearch): reuse httpx.Client across embedding batches; inli…
samuelvkwong 8376c63
feat(pgsearch): add close()/__enter__/__exit__ to EmbeddingClient
samuelvkwong afe5840
feat(pgsearch): add RRF fusion helper and empty-headline fallback
samuelvkwong ba9fa24
feat(pgsearch): install pgvector extension and swap to pgvector/pgvec…
samuelvkwong 3cee09e
feat(pgsearch): add nullable embedding column with HNSW cosine index
samuelvkwong ea620f2
feat(pgsearch): add embed_reports task on dedicated embeddings queue
samuelvkwong cbc798c
fix(pgsearch): close EmbeddingClient http pool in embed_reports final…
samuelvkwong 249d9ff
feat(pgsearch): enqueue embed_reports on Report post_save
samuelvkwong 8855dff
test(pgsearch): use Report.objects.create() to assert single post_sav…
samuelvkwong 23ed743
feat(pgsearch): add backfill_embeddings management command
samuelvkwong 4cd6343
feat(pgsearch): replace search() with hybrid FTS + vector RRF fusion
samuelvkwong d8f2da8
test(pgsearch): use module-level pytestmark for django_db in hybrid p…
samuelvkwong 8d576ae
feat(pgsearch): make retrieve() hybrid-aware to match search() order
samuelvkwong 6cb8d6f
feat(pgsearch): bump SearchProvider.max_results to hybrid bound
samuelvkwong d3c560c
feat(infra): add embeddings_worker container on dedicated queue
samuelvkwong 95b3ac1
docs(infra): document EMBEDDING_* env vars in example.env
samuelvkwong 2ed951d
test(search): verify FTS-only fallback when embedding URL is unset
samuelvkwong c485bcd
fix(test): strip debug_toolbar middleware so FTS-only smoke can asser…
samuelvkwong 218b0ca
fix(pgsearch): close EmbeddingClient http pool in search() and retrie…
samuelvkwong 16e3caa
feat(pgsearch): expose cosine_distance and rrf_score on ReportDocument
samuelvkwong 9763130
feat(search): surface cosine distance and RRF score in result header
samuelvkwong c4750af
feat(pgsearch): Matryoshka-truncate oversized embeddings to EMBEDDING…
samuelvkwong 15ded7a
ci: tag built dev image for embeddings_worker too
samuelvkwong 4e8d4a8
fix(pgsearch): satisfy pyright on report_id and Procrastinate __wrapp…
samuelvkwong c51b1e5
feat(pgsearch): validate embedding-client config and response shape
samuelvkwong 0d2abdb
fix(pgsearch): dedupe candidate rows in hybrid search with .distinct()
samuelvkwong 2ce60e8
fix(pgsearch): bulk_update embeddings, guard batch size, defer signal…
samuelvkwong 95d0172
feat(pgsearch): stream backfill ids and validate CLI bounds
samuelvkwong 8409fba
feat(pgsearch): system check for EMBEDDING_DIM vs migration parity
samuelvkwong 0faf3b0
fix(test): pass strict=False to rrf_score ordering zip
samuelvkwong 4f773b2
docs(pgsearch): add hybrid search design spec with embedding orchestr…
samuelvkwong 0822336
docs(pgsearch): add embedding orchestrator implementation plan
samuelvkwong d0e4231
docs(pgsearch): split hybrid-search spec into dated original + unifie…
samuelvkwong f358589
docs(pgsearch): promote NOT-stripping into the spec; regenerate plan
samuelvkwong 3737483
fix(plan): replace 'uv run cli shell -c' with manage.py invocations
samuelvkwong d29cb95
feat(pgsearch): add EMBEDDING_DRAIN_CRON and EMBEDDING_SYSTEM_USERNAM…
samuelvkwong 09a488a
feat(pgsearch): add EmbeddingJob and EmbeddingTask models
samuelvkwong d292fac
feat(pgsearch): add data migration for system user
samuelvkwong 26544ec
feat(pgsearch): add process_embedding_task on embeddings queue
samuelvkwong 9a44436
fix(test): fetch system user instead of creating it (collides with 00…
samuelvkwong ab06928
feat(pgsearch): add process_embedding_job orchestrator
samuelvkwong ed5b6a7
feat(pgsearch): add embedding_launcher periodic task
samuelvkwong 1116960
refactor(pgsearch): remove post_save embedding signal (replaced by or…
samuelvkwong 6c13830
refactor(pgsearch): remove embed_reports task and backfill_embeddings…
samuelvkwong a251c00
refactor(pgsearch): remove EMBEDDING_BACKFILL_PRIORITY setting
samuelvkwong 795f460
feat(infra): run embeddings_worker with --concurrency 4
samuelvkwong 88fdcc4
feat(search): add QueryParser.unparse_for_embedding that strips NOT b…
samuelvkwong 33ffb18
feat(pgsearch): use unparse_for_embedding to strip NOT branches befor…
samuelvkwong b426638
lint(pgsearch): drop unused import and unused 'succeeded' var in orch…
samuelvkwong 2e924e9
docs(pgsearch): spec for EMBEDDING_DIM check via MigrationLoader
samuelvkwong 98a67c2
docs(pgsearch): fold EMBEDDING_DIM check redesign into unified hybrid…
samuelvkwong 5a5ac32
docs(plan): append Task 14 (MigrationLoader-based EMBEDDING_DIM check)
samuelvkwong 17555ac
refactor(pgsearch): derive embedding-dim check from MigrationLoader, …
samuelvkwong 615f39f
lint(pgsearch): satisfy pyright in hybrid-search test files
samuelvkwong e73a7f5
docs(pgsearch): document cosine_distance and rrf_score on ReportDocument
samuelvkwong 997805f
refactor(pgsearch): squash hybrid-search migrations into 0002_hybrid_…
samuelvkwong 8fa1b5a
refactor(pgsearch): demote EMBEDDING_DRAIN_CRON from env to code cons…
samuelvkwong b0e24ef
refactor(pgsearch): all-deferred embedding via embed_reports_task; dr…
samuelvkwong fa72b59
refactor(pgsearch): subscribe to reports_*_handlers; viewsets.py lose…
samuelvkwong 5acdb17
refactor(pgsearch): sync embed task, chained ordering, bisect + stami…
samuelvkwong c6318a8
feat(pgsearch): subjob chunking + admin pipeline-status badge
samuelvkwong 5a33386
refactor(pgsearch): rename ReportSearchVector → ReportSearchIndex
samuelvkwong 49df71c
feat(pgsearch): admin clear-embeddings action; block delete; inline q…
samuelvkwong 1c6d690
refactor(pgsearch, search): rename indexing handler; squash migration…
samuelvkwong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.