Skip to content

fix: support legacy search query bodies#668

Open
pragnyanramtha wants to merge 1 commit into
pinecone-io:mainfrom
pragnyanramtha:pragnyan/fix-search-query-compat
Open

fix: support legacy search query bodies#668
pragnyanramtha wants to merge 1 commit into
pinecone-io:mainfrom
pragnyanramtha:pragnyan/fix-search-query-compat

Conversation

@pragnyanramtha
Copy link
Copy Markdown

@pragnyanramtha pragnyanramtha commented May 16, 2026

Summary

  • add a legacy query request-body parameter to sync, async, and gRPC-backed search() / search_records()
  • share search request-body validation while preserving existing dense-vector wire shapes
  • add regression coverage for the reported search(namespace=..., query={...}, fields=[...]) call shape

Fixes #661.

Validation

  • uv sync --dev --no-install-project
  • uv run --no-sync pytest tests/unit/test_index_search.py tests/unit/test_async_search.py tests/unit/test_grpc_index.py tests/unit/test_search_records_alias.py tests/unit/test_async_search_records_alias.py -q (142 passed)
  • uv run --no-sync pytest tests/unit/test_client_timeout_parity.py tests/unit/test_backcompat_search_shims.py tests/unit/test_response_info_populated.py tests/unit/test_async_response_info.py -q (75 passed)
  • uv run --no-sync ruff check pinecone/_internal/data_plane_helpers.py pinecone/index/__init__.py pinecone/async_client/async_index.py pinecone/grpc/__init__.py tests/unit/test_index_search.py tests/unit/test_async_search.py tests/unit/test_grpc_index.py tests/unit/test_search_records_alias.py tests/unit/test_async_search_records_alias.py
  • uv run --no-sync ruff format --check pinecone/_internal/data_plane_helpers.py pinecone/index/__init__.py pinecone/async_client/async_index.py pinecone/grpc/__init__.py tests/unit/test_index_search.py tests/unit/test_async_search.py tests/unit/test_grpc_index.py tests/unit/test_search_records_alias.py tests/unit/test_async_search_records_alias.py
  • uv run --no-sync mypy --strict pinecone/_internal/data_plane_helpers.py pinecone/index/__init__.py pinecone/async_client/async_index.py pinecone/grpc/__init__.py
  • git diff --check

Note

Medium Risk
Touches public search()/search_records() request building across sync, async, and gRPC clients, so regressions could affect search request shapes and validation. Risk is mitigated by added unit coverage for legacy query usage and param-mixing errors.

Overview
Adds support for passing a legacy query request-body object to search()/search_records() across the sync Index, AsyncIndex, and REST-backed GrpcIndex search APIs.

Centralizes search request-body construction/validation in _build_search_records_body, including mutual-exclusion rules (query vs direct params), top_k/source validation, rerank required keys checks, and consistent normalization of dense vs sparse/hybrid vector shapes (with a gRPC-specific option to preserve the existing dense-vector wire format).

Extends unit tests to cover legacy query passthrough, rejection of mixed query+direct params, and updated alias forwarding to include the new query argument.

Reviewed by Cursor Bugbot for commit 7fc0678. Bugbot is set up for automated code reviews on this repo. Configure here.

@pragnyanramtha pragnyanramtha marked this pull request as ready for review May 16, 2026 21:21
Copilot AI review requested due to automatic review settings May 16, 2026 21:21
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

[Bug] Index.search() failing to execute.

2 participants