Warn that search_params is ignored in local mode instead of silently dropping it (#1083)#1247
Warn that search_params is ignored in local mode instead of silently dropping it (#1083)#1247MushiSenpai wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
✅ Deploy Preview for poetic-froyo-8baba7 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@qdrant_client/local/qdrant_local.py`:
- Around line 413-420: The warning emitted via show_warning_once in
qdrant_local.py should point to the user call site instead of the helper itself.
Update the call that uses idx="local_query_points_search_params_ignored" to pass
an explicit caller-oriented stacklevel, matching the pattern used by the other
local-mode warnings in this file, so the warning is attributed to the API
caller.
- Around line 409-420: query_batch_points() is still dropping
request.search_params for local mode, so batched queries bypass the same
warning/behavior used by query_points(). Update the query_batch_points flow in
qdrant_local.py to pass request.search_params through to the same local query
path that handles search_params, using the existing query_points() /
show_warning_once behavior so batched requests inherit the warning and remain
consistent.
In `@tests/test_local_search_params_warning.py`:
- Around line 29-41: The
test_query_points_warns_when_search_params_passed_in_local_mode test mutates the
global warning cache and leaves _WARN_IDX recorded, which can affect later
tests. Update this test to snapshot client_warnings.SEEN_MESSAGES before
discarding _WARN_IDX and restore it afterward, or ensure the key is always
removed in a finally block. Keep the change localized to the test and use the
existing client_warnings.SEEN_MESSAGES and _WARN_IDX symbols to implement the
restore behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ed859070-c84b-47d7-b3a1-99b8520fbf30
📒 Files selected for processing (2)
qdrant_client/local/qdrant_local.pytests/test_local_search_params_warning.py
… cleanup - query_batch_points() now forwards search_params so batched local queries emit the same "ignored in local mode" warning as query_points() - pass stacklevel so the warning points at the caller (matches the sibling local-mode warnings in this file) - regression test restores the global warning cache (try/finally) so it no longer leaves order-dependent state, and adds batch-path coverage Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
qdrant_client/local/qdrant_local.py (1)
409-420: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winWarn in
query_points_groups()too.This fixes the silent-ignore behavior for
query_points()and batched requests, butQdrantLocal.query_points_groups()still acceptssearch_paramson Line 484 and drops it when callingcollection.query_groups(...)on Line 507. Local mode will therefore still ignore the parameter without any signal on that API surface.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@qdrant_client/local/qdrant_local.py` around lines 409 - 420, `QdrantLocal.query_points_groups()` still silently drops `search_params`, so add the same local-mode warning there as in `query_points()`. Update the `query_points_groups` path in `QdrantLocal` to detect when `search_params` is provided, emit a one-time warning via `show_warning_once`, and then continue passing through the exact-search behavior to `collection.query_groups(...)`. Reuse the same warning semantics/identifier style used by `query_points()` so both APIs behave consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@qdrant_client/local/qdrant_local.py`:
- Around line 409-420: `QdrantLocal.query_points_groups()` still silently drops
`search_params`, so add the same local-mode warning there as in
`query_points()`. Update the `query_points_groups` path in `QdrantLocal` to
detect when `search_params` is provided, emit a one-time warning via
`show_warning_once`, and then continue passing through the exact-search behavior
to `collection.query_groups(...)`. Reuse the same warning semantics/identifier
style used by `query_points()` so both APIs behave consistently.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 38fcee29-c8a1-4794-99ce-9fb3af83e9da
📒 Files selected for processing (2)
qdrant_client/local/qdrant_local.pytests/test_local_search_params_warning.py
…ient - query_points_groups() also accepted search_params and silently dropped it; it now emits the same one-time local-mode warning as query_points() - regenerate local/async_qdrant_local.py (Python 3.10 + pinned ruff/autoflake, matching CI) so AsyncQdrantLocal picks up all three warning paths — the earlier commits only touched the sync client, which would have failed the async-client-consistency check - add a groups-path regression test Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Added the same warning to |
Problem (#1083). Local mode has no ANN index — search is always exact (brute-force) — so search_params (exact, hnsw_ef, …) can't change results. But QdrantLocal.query_points accepted and silently dropped it, surprising users (the reporter saw exact=True "have no effect").
Fix. Emit a one-time UserWarning (via the existing show_warning_once) when search_params is passed in local mode, stating it's ignored and results are always exact. No change to results. query_batch_points inherits it (delegates to query_points). Addresses the local-mode aspect of #1083 (the remote-mode observation is separate).
Test. tests/test_local_search_params_warning.py — in-memory only.
Drafted with AI assistance (Claude); reviewed, tested, and submitted by me.