fix: preserve existing abstract during reindex#1419
Open
yc111233 wants to merge 1 commit intovolcengine:mainfrom
Open
fix: preserve existing abstract during reindex#1419yc111233 wants to merge 1 commit intovolcengine:mainfrom
yc111233 wants to merge 1 commit intovolcengine:mainfrom
Conversation
When `index_resource` rebuilds the vector index (e.g. after switching embedding models), it passes an empty `summary_dict` to `vectorize_file`. This overwrites the VLM-generated `abstract` field with an empty string, causing rerank to lose document differentiation — all documents receive identical scores because the rerank API receives empty text for comparison. Fix: before calling `vectorize_file`, query the existing vector index entry via `fetch_by_uri` and carry forward the old `abstract` value. This decouples reindex (embedding model change) from VLM summary generation, which are independent concerns. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
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.
Problem
When
index_resource()rebuilds the vector index (e.g. after switching embedding models viareindexwithregenerate=False), it passes an emptysummary_dicttovectorize_file:This causes
Context(abstract=""), which overwrites the existing VLM-generated abstract in the vector index with an empty string.Impact: Rerank relies on the
abstractfield to differentiate documents. With empty abstracts, all documents sent to the rerank API are identical ("[empty]"after the DashScope safety filter), resulting in uniform scores and no meaningful ranking.Root Cause
index_resourceand the normal write path use different code paths for theabstractfield:summary_dict["summary"]→ stored asabstractin vector indexsummary_dicthas no"summary"key →abstract=""→ overwrites old value via upsertReindex and VLM summary generation are independent concerns, but the current implementation couples them by discarding the old abstract during reindex.
Fix
Before calling
vectorize_file, query the existing vector index entry viafetch_by_uri(which already includesabstractin its output fields) and carry forward the old value:Test Plan
regenerate=Truepath (which usessummarize()instead ofbuild_index())