Skip to content

fix(edge-py): keep MatchValue(True) a boolean instead of 1 - #11324

Open
inamdarmihir wants to merge 1 commit into
qdrant:devfrom
inamdarmihir:fix/edge-py-match-value-bool
Open

inamdarmihir wants to merge 1 commit into
qdrant:devfrom
inamdarmihir:fix/edge-py-match-value-bool

Conversation

@inamdarmihir

@inamdarmihir inamdarmihir commented Oct 25, 2026 •

Copy link
Copy Markdown

Fixes #10846.

Problem

In qdrant-edge-py, MatchValue(value=True).value returned 1, so a filter on a boolean payload field matched nothing.

PyValueVariants::extract tried Integer before Bool. A Python bool is a subclass of int, so True extracted as an integer.

Change

  • Try Bool before Integer in lib/edge/python/src/types/filter/match.rs. Extracting a bool is strict, so a plain int is still taken as an integer. PyValue in types/value.rs already orders its variants this way.
  • Add examples/match_value_types.py, which the existing py-examples job runs. It asserts that True/False round-trip and that string, integer and boolean filters each match.

Testing

  • Built with maturin develop --no-default-features --features abi3 and ran the reproduction from the issue: likes == True returned 0 points before the change and 1 after.
  • The new example fails on the unfixed code (AssertionError) and passes with the fix.
  • cargo fmt --check -p qdrant-edge-py is clean.
  • I did not get a clean cargo clippy -D warnings run here: it stops on existing unnecessary_as_slice lints in lib/sparse, which this change doesn't touch.

AI disclosure

Commits:

  • [AI] fix(edge-py): keep MatchValue(True) a boolean instead of 1

Prompt, summarized from the instructions given to the AI tool: fix #10846, where MatchValue(value=True).value is 1 in qdrant-edge-py and boolean filters match nothing. Find the cause in lib/edge/python/src/types/filter/match.rs, keep the change to that file plus a regression example run by the existing py-examples job, build the bindings with maturin, reproduce the issue first, and confirm the new example fails on the old code.

I reviewed the result and can answer questions about it.

Authored by Mihir

PyValueVariants tried to extract an integer before a boolean. A Python
bool is a subclass of int, so True became 1 and False became 0, and a
filter on a boolean payload field matched nothing.

Try Bool before Integer. Extracting a bool is strict, so a plain int is
still taken as an integer. Add an example, run by the existing
py-examples job, that asserts the value round-trips and filters match.

Fixes qdrant#10846

Authored by Mihir
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c9641c00-d08a-423b-a3b6-615fb85eaa84
Commits

Reviewing files that changed from the base of the PR and between 0beaf51 and e6894ab.

Files selected for processing: 2
  • lib/edge/python/examples/match_value_types.py
  • lib/edge/python/src/types/filter/match.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The Python binding now extracts Bool before Integer when creating a match value. A new executable example checks that boolean, integer, and string values match the expected point IDs in scroll filters.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: generall

Merge Risk: Minimal · up to e6894

The change addresses boolean match values without an identified regression to integer or string matching. It is ready for normal merge checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: preserving MatchValue(True) as a boolean instead of converting it to 1.
Linked Issues check Passed Issue #10846 requires boolean MatchValue values to remain booleans, boolean payload filters to match, and integer matching to remain correct. PyValueVariants::extract now tries Bool before `Intege…
Out of Scope Changes check Passed The pull request changes only MatchValue extraction and adds a focused example for the affected boolean, integer, and string filter behavior. These changes directly support issue #10846.
Description check Passed The description states the problem (MatchValue(value=True).value returns 1 in qdrant-edge-py, so boolean payload filters match nothing), names the cause (Integer is tried before Bool in PyValueVariant…
Full details: Linked Issues check

Explanation

Issue #10846 requires boolean MatchValue values to remain booleans, boolean payload filters to match, and integer matching to remain correct. PyValueVariants::extract now tries Bool before Integer, while strict boolean extraction preserves plain integer handling. The new match_value_types.py example asserts boolean round-trips and checks boolean, integer, and string filters.

Full details: Description check

Explanation

The description states the problem (MatchValue(value=True).value returns 1 in qdrant-edge-py, so boolean payload filters match nothing), names the cause (Integer is tried before Bool in PyValueVariants::extract, and bool subclasses int), and lists the change (Bool tried first in match.rs, plus a new example run by py-examples). It also gives build, reproduction, and test results. It is directly related to the changeset, so it passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant