fix(qdrant): return vectors in fetch_data so set_tags works with dense-only configs#3189
Open
happychap189 wants to merge 1 commit into
Open
fix(qdrant): return vectors in fetch_data so set_tags works with dense-only configs#3189happychap189 wants to merge 1 commit into
happychap189 wants to merge 1 commit into
Conversation
…e-only configs The set_tags API (POST /api/v1/content/set_tags) fails with "Qdrant point requires at least one dense or sparse vector" when using the Qdrant backend with a dense-only embedding configuration (no sparse vector). Since add_resource does not accept a tags field, set_tags is the only way to attach k=v search tags, so this bug completely blocks the search_tags retrieval-filtering feature for Qdrant users. Root cause: update_search_tags reads the existing record via get -> fetch_data, but fetch_data sets with_vector=False, so the returned record has no dense_vector. The subsequent full upsert (_make_point) then finds no vector and raises. Fix: make fetch_data return vectors (with_vector=True) and extract them into DataItem.fields via _extract_named_vectors, so that metadata-only update flows (set_tags, and any get-modify-upsert caller) retain the vector and can upsert successfully. This is safe because _make_point already strips vector fields from the payload. Verified: set_tags (replace/append) succeeds; find with tags filter returns correct results across 6 test cases (single-tag, multi-tag OR, negative tag, etc.).
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.
What type of PR is this?
Summary
The
set_tagsAPI (POST /api/v1/content/set_tags) fails withQdrant point requires at least one dense or sparse vectorwhen OpenViking runs against the Qdrant backend with a dense-only embedding configuration (no sparse vector). Sinceadd_resourcedoes not accept atagsfield,set_tagsis the only way to attachk=vsearch tags — so this bug completely blocks thesearch_tagsretrieval-filtering feature for Qdrant users.Root cause:
update_search_tagsreads the existing record viaget→fetch_data, butfetch_datasetswith_vector: False, so the returned record has nodense_vector. The subsequent full upsert (_make_point) then finds no vector and raises.This PR makes
fetch_datareturn vectors (with_vector: True) and extracts them intoDataItem.fields, so that metadata-only update flows (set_tags, and any future get-modify-upsert caller) retain the vector and can upsert successfully.Changes
openviking/storage/vectordb/collection/qdrant_collection.py—fetch_data:"with_vector": False→True_extract_named_vectorsand store them in the returnedDataItem.fieldsSingle-method change, ~12 lines added.
Why this approach (and not alternatives)
fetch_datareturns vectors (this PR)_make_pointalready strips vector fields from the payload (line 348). ✅partial_update=Trueinupdate_search_tagsget→fetch_data(with_vector=False), so it still has no vector. ❌dense_vectortoFETCH_BY_URI_OUTPUT_FIELDSfilterpath, not byget/fetch_data; doesn't fix the actual read path. ❌setPayload-based metadata updateVerification
Before (broken)
After (fixed)
Full end-to-end retrieval matrix (tags written via
set_tags, queried viafind):tags=["version=v1"]tags=["version=v2"]tags=["version=v3"](nonexistent)tags=["product=alpha"]tags=["version=v1","version=v2"](OR)Root cause trace
Test plan
set_tags(replace mode) succeeds on Qdrant + dense-only configset_tags(append mode) succeedsfindwithtagsfilter returns correct results (6 test cases)fetch_dataconsumers that don't need vectors are unaffectedEnvironment
BAAI/bge-m3, dim 1024)