Skip to content

fix(qdrant): aquery() drops falsy shard_identifier values (e.g. 0)#22169

Open
aloktripathi1 wants to merge 1 commit into
run-llama:mainfrom
aloktripathi1:fix/aquery-shard-identifier-falsy
Open

fix(qdrant): aquery() drops falsy shard_identifier values (e.g. 0)#22169
aloktripathi1 wants to merge 1 commit into
run-llama:mainfrom
aloktripathi1:fix/aquery-shard-identifier-falsy

Conversation

@aloktripathi1

Copy link
Copy Markdown

aquery() uses if shard_identifier (truthiness check) instead of
if shard_identifier is not None. Every other method in this file,
including query(), add(), delete(), adelete(), get_nodes(), etc. (9/9
occurrences), correctly uses the is not None check.

This means a valid shard_identifier=0 is silently treated as "no shard
identifier provided" in the async path only, causing the query to run
against the wrong (or no) shard partition.

1-line fix, plus a regression test that mocks _generate_shard_key_selector
to confirm it's called with 0 specifically, not skipped, not coerced to
the default-shard path.

aquery() used `if shard_identifier` (truthiness check) instead of
`if shard_identifier is not None`. Every other method in this file --
query(), add(), delete(), adelete(), get_nodes(), etc. (9/9 occurrences) --
correctly uses the `is not None` check.

This means a valid shard_identifier=0 was silently treated as 'no shard
identifier provided' in the async path only, causing the query to run
against the wrong (or no) shard partition.

1-line fix, plus a regression test that mocks _generate_shard_key_selector
to confirm it's called with 0 specifically (not skipped).
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant