feat(playground): add full-text and hybrid search modes#181
Open
prsasattms wants to merge 2 commits into
Open
Conversation
The Search Playground was vector-only. Add a Mode selector (Vector / Full-Text / Hybrid) so users can exercise the search service's existing FTS capability and combine vector + FTS via reciprocal rank fusion. Backend (api/api.py): - PlaygroundSearchRequest gains search_mode and optional fts_field. - _build_index_specs emits vector and/or fts IndexSpecs per destination; hybrid produces two specs (ids suffixed ::vec / ::fts) sharing a fusion_group so the same document fuses into one RRF result. - Force rrf merge whenever FTS is involved (FTS hits have no comparable native score); reject fts without a text query; cap at 10 indexes; resolve friendly per-index names (stripping the ::vec/::fts suffix). Search service: - IndexSpec gains an optional fusion_group; _merge fuses indexes sharing a group under rrf on (fusion_group, doc_id) instead of (index_id, ...). Frontend (web/static/index.html): - Mode selector + RRF merge option; hybrid auto-selects rrf; full-text disables the image input; sends search_mode; renamed header to "Search Playground". Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Simplify the playground controls: remove the Merge strategy dropdown and always use RRF, the sensible default for vector, multi-index, full-text, and hybrid searches. The merge value is kept as a hidden input so the request shape is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Summary
Adds Full-Text and Hybrid search modes to the Search Playground, which was previously vector-only. The search service already supported FTS (#180) and RRF merge — this exposes them in the playground UI/API and adds rank fusion so hybrid results from the same source are combined rather than duplicated.
Changes
Frontend (web/static/index.html)
Backend API (�pi/api.py)
PlaygroundSearchRequestgainssearch_mode(vector|fts|hybrid) and optionalfts_field._build_index_specsemits vector and/or FTSIndexSpecs per destination. Hybrid produces two specs (ids suffixed::vec/::fts) sharing afusion_groupso a document found by both fuses into one result.rrfmerge whenever FTS is involved (FTS hits have no comparable native score), rejects FTS without a text query, caps a request at 10 indexes, and resolves friendly per-index names (X (vector)/X (full-text)).Search service (search/schemas.py, search/searcher.py)
IndexSpecgains an optionalfusion_group._mergefuses indexes sharing afusion_groupunder RRF on(fusion_group, doc_id)instead of(index_id, doc_id), so hybrid vector+FTS hits for the same document collapse into one result with a combined RRF score. Behavior is unchanged whenfusion_groupis unset.Testing
tests/unit/test_search_fts.py: 17 passed._mergefusion: a doc returned by both::vecand::ftsfuses to a single result with summed RRF score and ranks first; without fusion groups it appears twice (prior behavior)./api/playground/search; hybrid shows a per-index breakdown of(vector)and(full-text).Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com