feat: add rerank_depth_start parameter to search() - #304
Open
vicilliar wants to merge 1 commit into
Open
Conversation
Introduces `rerank_depth_start` as an optional parameter in `Index.search()`. Maps to `rerankDepthStart` in the Marqo API request body. When provided, hits before `rerank_depth_start` are preserved with their original scores and ordering, while hits in [rerank_depth_start, rerank_depth) are subject to global score modifier reranking. Omitting or setting to 0 preserves existing behaviour. Changes: - `index.py`: add `rerank_depth_start` param, serialise as `rerankDepthStart` - `tests/v2_tests/test_score_modifier_search.py`: unit tests verifying correct serialisation and omission when None Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rerank_depth_start: Optional[int] = Noneparameter toIndex.search()rerankDepthStartin the Marqo API request bodyrerank_depth/rerankDepthNonevalue is omitted from the request body (existing behaviour preserved)Server-side PR: marqo-ai/marqo#1393
Test plan
test_rerank_depth_start_serialized_as_camel_case— verifies correct key name in request bodytest_rerank_depth_start_none_omitted_from_body— verifiesNoneis not senttest_rerank_depth_start_zero_included_in_body— verifies0(falsy but valid) is sent🤖 Generated with Claude Code
Note
Low Risk
Low risk: adds an optional search parameter that is omitted when
None, with unit tests covering serialization and the0edge case.Overview
Adds a new optional
rerank_depth_startparameter toIndex.search()and serializes it to the API asrerankDepthStart, enabling reranking/score modifiers to apply only to a specified slice of the toprerank_depthresults.Includes unit tests that mock the HTTP layer to verify camelCase serialization, omission when
None, and inclusion when set to0(falsy but valid).Written by Cursor Bugbot for commit 07f2288. This will update automatically on new commits. Configure here.