* fix: mirror server token-aware text/phrase matching on unindexed fields
qdrant/qdrant#10341 (dev) changed MatchText and MatchPhrase on fields
without a text index from a substring scan to token-aware matching via
the default word tokenizer: every query token must appear as a whole
document token (text, order-independent; consecutive for phrase), empty
queries match nothing. Local mode still substring-scanned, so congruence
tests randomly failed whenever the filter generator drew a MatchText
whose word is a substring of another fixture word ("fly" in "butterfly",
"ant" in "elephant"). MatchTextAny keeps substring semantics, matching
the server.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R25zh9xS78xMHgPcoFaUdw
* fix: match null elements inside arrays in local IsNull condition
qdrant/qdrant#10101 (dev) made the unindexed IsNull check inspect array
elements: a value like [null, 1] now satisfies IsNull (one level deep).
Local mode only matched values that were null themselves. This was the
second divergence behind the congruence CI failures, previously masked
by the MatchText one because pytest runs with -x.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R25zh9xS78xMHgPcoFaUdw
* fix: close local client before reopening storage in persistence tests
The persistence tests released the storage lock with `del local_client`,
relying on garbage collection timing; when the lock outlived the del,
reopening the same directory raised "Storage folder is already accessed
by another instance". test_query.py was already fixed to call close()
(90913f8); apply the same fix to the remaining five persistence tests.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R25zh9xS78xMHgPcoFaUdw
* fix: bound remote group hits by exact local hits instead of equality
Server-side grouping is best-effort within a request budget (qdrant
lib/shard/src/grouping/driver.rs): once the budget is spent, a group may
be filled with worse points than its true best, or stay below
group_size. Local mode groups exhaustively, so asserting exact per-rank
score equality of deep group hits randomly failed when the fill budget
missed a group member (test_query_group, local 0.6926 vs remote 0.6798
at rank 4). Compare one-sided instead: at any rank the remote hit may be
worse than the exact local one, never better; the top hit stays strict.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R25zh9xS78xMHgPcoFaUdw
* test: move local text-match and is-null tests to their conventional homes
The two new test files sat at the tests/ root. Local-mode behavior belongs in
qdrant_client/local/tests, and filter corner cases in
tests/congruence_tests/test_complex_filters.py.
- the check_match assertions mirroring the server's unindexed_text_match_test.rs
move into qdrant_client/local/tests/test_payload_filters.py, next to the other
filter unit tests
- the client-level cases become congruence tests in test_complex_filters.py, so
they compare local against a real server instead of asserting local behavior
alone: text/phrase/text-any matching on an unindexed field, and IsNull over
arrays holding a null
Both congruence tests fail against the pre-fix payload_filters and pass with it,
against qdrant 1.19.1-dev.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* tests: add non-consecutive case for match filter
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: George Panchuk <george.panchuk@qdrant.tech>
* Fix in-place mutation of inputs in cosine_similarity
cosine_similarity normalized its `query` and `vectors` arguments in place
via `/=`, which (1) mutated caller-owned arrays as a side effect and
(2) raised UFuncTypeError on integer-dtype inputs, unlike the dot,
euclidean, and manhattan distance functions. Switch to out-of-place
division so the inputs are left untouched. Computed results are unchanged.
Add regression tests asserting the query/vectors arguments are not mutated
(1D and 2D query paths) and that integer-dtype inputs are accepted.
* test: exercise 2D cosine query path with multiple rows
Use a two-row 2D query so the batched per-row normalization path is
verified, and assert the full distance matrix in addition to input
immutability.
* Keep vectors normalization in place per review, fix query only
@joein noted that vectors is always already normalized when reaching
cosine_similarity through the client API (cosine collections are
normalized on upsert), so copying it is unnecessary overhead on what
can be a large candidate set. Revert vectors to in-place normalization
and keep only the query-side fix, which he agreed is worth the
(minimal) copy cost since queries are fresh, user-supplied input each
call and aren't guaranteed to be pre-normalized.
Update tests to match: drop the vectors-not-mutated assertions and the
vectors integer-dtype case (vectors is always float32 in real usage),
keep the query-side mutation and integer-dtype coverage.
grpc.KeywordPrefixParams is an empty message: presence is the only
signal, so an explicit prefix=False cannot be represented in gRPC.
It is sent as absent (same server-side semantics, disabled) and is
recovered as None. Document this at both conversion sites and pin
the behavior with a reverse-direction (rest->grpc->rest) test.
`show_warning_once` defaults to `stacklevel=1`, which makes `warnings.warn`
attribute the warning to `qdrant_client/common/client_warnings.py:7` -- inside
the client -- instead of the caller's construction site.
Every other `show_warning_once` call in the package passes an explicit
stacklevel (4, 5, 6 or 10, depending on nesting); this is the only site that
omits it. Its two immediate siblings in the same `__init__` -- the
`api-key`-in-headers warning and the `grpc.primary_user_agent` warning -- both
pass `stacklevel=4`, so this brings it in line with them.
Before:
.../qdrant_client/common/client_warnings.py:7: UserWarning: `User-Agent` ...
After:
.../qdrant_client/qdrant_client.py:134: UserWarning: `User-Agent` ...
which is where the sibling warnings already point.
`async_qdrant_remote.py` is generated from the sync source; the hunk there
matches what `tools/generate_async_client.sh` emits (verified by running the
generator with ruff pinned to 0.4.3).
* fix: local mode matches wrong points on null and empty-should filters
* tests: move tests to complex filters
---------
Co-authored-by: George Panchuk <george.panchuk@qdrant.tech>
* new: 1.19.0 updates
* fix: fix search params as a dict in local mode
* fix: update qdrant backward compatibility version
* fix: add version check to the test
* fix: add version check to the test
* Fix local mode filters cross-matching booleans and integers
Python treats bool as a subclass of int (True == 1, False == 0), but Qdrant
keeps booleans and integers as distinct payload value types. Local mode
compared them with a plain `==` / `in` / `isinstance(value, (int, float))`, so:
- MatchValue(value=1) matched a payload of True, and MatchValue(value=True)
matched a payload of 1 (same for 0 / False)
- MatchAny / MatchExcept cross-matched the same way
- Range matched booleans as if they were 0 / 1
The server never cross-matches these (its ValueVariants keeps Integer and Bool
distinct, and booleans are not numeric for range conditions). Add a type-aware
equality helper used by the value-match conditions, and exclude booleans from
range checks. Adds an in-memory regression test.
* Cover MatchExcept in the bool/int cross-match test
MatchExcept also routes through values_match, so assert that except=[1]
keeps the True payload (bool is not the integer 1).
* Add isolated MatchAny and range asserts to the bool/int cross-match test
Lock the single-value MatchAny path and the check_range bool guard against
regressions, in addition to the existing combined-condition coverage.
* fix: handle floats in cross-match local mode filters, add congruence tests
---------
Co-authored-by: George Panchuk <george.panchuk@qdrant.tech>
* fix: spurious async client tests failures
* skip cluster-only test when server is standalone
* increase timeout for unit test performing multiple snapshot operations
* clean up stale snapshots left by previous runs
* fix: remove deleted methods, add/update cluster checks
* fix: remove unused import
* fix: remove redundant indent
---------
Co-authored-by: George Panchuk <george.panchuk@qdrant.tech>
* fix: check_match() raises TypeError when MatchText applied to non-string field
* tests: move non-string match test to test_nested_filter, cover MatchText and MatchTextAny
---------
Co-authored-by: George Panchuk <george.panchuk@qdrant.tech>
* fix: update poetry lock
* fix: add type annotations, update poetry.lock
* fix: fix local persistence tests
* fix: replace del client with client.close in local mode persistence tests
The client docstrings claimed gRPC timeout was unlimited, but
QdrantRemote.DEFAULT_GRPC_TIMEOUT is 5 seconds and is applied when
timeout=None. Align docs with implementation.
Fixes#1023
* ci: Pin all gh actions to commit SHAs
* new: update checkout to v2 in type check ci
---------
Co-authored-by: George Panchuk <george.panchuk@qdrant.tech>