Skip to content

Warn that search_params is ignored in local mode instead of silently dropping it (#1083)#1247

Open
MushiSenpai wants to merge 3 commits into
qdrant:devfrom
MushiSenpai:fix/local-search-params-1083
Open

Warn that search_params is ignored in local mode instead of silently dropping it (#1083)#1247
MushiSenpai wants to merge 3 commits into
qdrant:devfrom
MushiSenpai:fix/local-search-params-1083

Conversation

@MushiSenpai

Copy link
Copy Markdown

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.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@netlify

netlify Bot commented Jun 26, 2026

Copy link
Copy Markdown

Deploy Preview for poetic-froyo-8baba7 ready!

Name Link
🔨 Latest commit 948d0ec
🔍 Latest deploy log https://app.netlify.com/projects/poetic-froyo-8baba7/deploys/6a458b7c4137bb0008440f31
😎 Deploy Preview https://deploy-preview-1247--poetic-froyo-8baba7.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8d4ced28-dd69-4563-b511-ee2d53757785

📥 Commits

Reviewing files that changed from the base of the PR and between 7bf91b7 and 948d0ec.

📒 Files selected for processing (3)
  • qdrant_client/local/async_qdrant_local.py
  • qdrant_client/local/qdrant_local.py
  • tests/test_local_search_params_warning.py
✅ Files skipped from review due to trivial changes (1)
  • qdrant_client/local/async_qdrant_local.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • qdrant_client/local/qdrant_local.py

📝 Walkthrough

Walkthrough

QdrantLocal and AsyncQdrantLocal now warn when search_params is supplied in local mode for query_points and query_points_groups, while query_batch_points forwards batch request params into query_points. A new test module creates an in-memory client with fixed data and verifies warning emission for query_points, query_batch_points, and query_points_groups, plus the no-warning case when search_params is omitted.

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

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: local mode now warns that search_params is ignored.
Description check ✅ Passed The description is clearly related to the patch and matches the warning behavior added for local-mode search_params.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4dc996a and 0f95398.

📒 Files selected for processing (2)
  • qdrant_client/local/qdrant_local.py
  • tests/test_local_search_params_warning.py

Comment thread qdrant_client/local/qdrant_local.py
Comment thread qdrant_client/local/qdrant_local.py
Comment thread tests/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>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Warn in query_points_groups() too.

This fixes the silent-ignore behavior for query_points() and batched requests, but QdrantLocal.query_points_groups() still accepts search_params on Line 484 and drops it when calling collection.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

📥 Commits

Reviewing files that changed from the base of the PR and between 0f95398 and 7bf91b7.

📒 Files selected for processing (2)
  • qdrant_client/local/qdrant_local.py
  • tests/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>
@MushiSenpai

Copy link
Copy Markdown
Author

Added the same warning to query_points_groups() in 948d0ec, and regenerated local/async_qdrant_local.py with CI's toolchain (Python 3.10, pinned ruff/autoflake) so the async client picks up all three paths — the earlier commits only touched the sync client, which would have tripped the async-client-consistency check.

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