feat(retrieval): add time filters to find and search#1429
Open
0xble wants to merge 4 commits intovolcengine:mainfrom
Open
feat(retrieval): add time filters to find and search#14290xble wants to merge 4 commits intovolcengine:mainfrom
0xble wants to merge 4 commits intovolcengine:mainfrom
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
Collaborator
|
I suggest just keep "--since, --until", and don't make it too complecated |
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.
Description
This PR adds native time filtering to retrieval.
findandsearchcan nowfilter semantic results by
created_atorupdated_atthrough the Python SDK,HTTP API, and Rust CLI.
OpenViking already stores these timestamps on indexed context records, but
retrieval could not query against them directly. This patch adds
since,until, andtime_fieldto the retrieval surface, adds CLI support for--since,--until,--time-field,--last, and--on, and preservescreated_aton rewrites so the filters stay meaningful after reindex andupdate flows.
Related Issue
None.
Type of Change
Changes Made
since,until, andtime_fieldrequest fields to retrieval in the Python SDK, local client, HTTP server, and Rust HTTP client.merge_time_filter()helper that compiles relative or absolute bounds into the existing metadata filter tree.ov findandov searchwith--since,--until,--time-field,--last, and--on.created_atfor leaf records on rewrite and reindex, and derived timestamps from canonical file metadata socreated_atandupdated_atkeep stable semantics.Testing
Validation run locally on macOS:
cargo test -p ov_cli --bin ov -- tests::resolve_time_flags_prefers_last_for_since tests::resolve_time_flags_expands_on_to_both_bounds tests::retrieval_time_field_maps_to_api_values✅uv run --with pytest-asyncio pytest tests/unit/test_search_filters.py tests/server/test_sdk_time_filters.py -qcould not complete locally because.venvhit a macOS code-signature mismatch while importingpydantic_core(mapping process and mapped file have different Team IDs). That looks environment-specific rather than a failure in the retrieval patch itself.Checklist
Screenshots (if applicable)
Not applicable.
Additional Notes
I kept this as an additive upstream change rather than the hard-cut CLI
migration used in my fork. If you would prefer an even smaller initial PR, I
can split the write-path timestamp preservation from the retrieval API and CLI
surface.