fix(vikingdb): correct inverted branch polarity in genFilter partition filter#2721
Open
nankingjing wants to merge 1 commit into
Open
fix(vikingdb): correct inverted branch polarity in genFilter partition filter#2721nankingjing wants to merge 1 commit into
nankingjing wants to merge 1 commit into
Conversation
Author
Review: fix-vikingdb-genfilter-polarity (#2721)Verdict: LGTM Classic inverted boolean condition. The genFilter function builds a composite filter by iterating over partitions. When building the first partition filter, The old code had No issues found. Merge-ready. |
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
In
backend/infra/document/searchstore/impl/vikingdb/vikingdb_searchstore.go, thegenFilterfunction combines a DSL scope filter with the partition filter. The branch polarity is inverted:Consequences:
filter != nil),filter = opsilently discards it, keeping only the partition filter. Retrieval then ignores the caller's scope constraints, returning documents that should have been filtered out.filter == nil), theelsebranch builds{"op":"and","conds":[op, filter]}wherefilterisnil, embedding a nil map into the conds slice.Fix
Swap the condition so the branch bodies match their intent. The bodies are already correct for the swapped condition, so this is a minimal one-character change:
Now:
filter = op(partition-only), no nil embedded.{op:and, conds:[op, filter]}, preserving both constraints.Verification
Verified by reading the source; not executed (no Go toolchain available in this environment). The change is a +1/-1 diff limited to the single inverted condition; the unrelated correct usage of
if filter != nilat the call site (SetFilter) is untouched.