feat: add RECOMMEND statement for point recommendations#14
Merged
Conversation
- Introduced the RECOMMEND statement to allow users to find similar points based on known examples. - Implemented parsing, execution, and filtering logic for the RECOMMEND statement in the QQL parser and executor. - Updated the CLI to include documentation for the new RECOMMEND statement. - Enhanced the executor to handle positive and negative IDs, as well as optional query filters and strategies. - Added tests for the RECOMMEND statement to ensure correct functionality and error handling. - Updated the sample QQL script to demonstrate the usage of the RECOMMEND statement.
Add OFFSET, SCORE THRESHOLD, WITH clause, LOOKUP FROM, and USING
to RECOMMEND statements, closing the gap with the Qdrant query_points
recommend surface.
Parser:
- Parse LOOKUP FROM <collection> [VECTOR '<name>'] for cross-collection
recommendation
- Parse USING '<vector_name>' to target a specific named vector
- Parse OFFSET <n> for pagination
- Parse SCORE THRESHOLD <f> for minimum score filtering
- Parse WITH { exact: true, hnsw_ef: <n> } for query-time search params
Executor:
- Wire offset, score_threshold, search_params, using, and lookup_from
to Qdrant query_points()
- Use LookupLocation for cross-collection ID lookups
Tests:
- Parser coverage for all new clauses and combined forms
- Executor coverage verifying forwarding to the Qdrant client
Docs:
- Update README with full RECOMMEND syntax reference
- Update sample_v2.qql with OFFSET, SCORE THRESHOLD, WITH, and USING
examples
Collaborator
Author
|
Update — Full Qdrant Recommend API surface now covered The second commit (
Clause order: RECOMMEND FROM <collection>
POSITIVE IDS (<id>, ...)
[NEGATIVE IDS (<id>, ...)]
[STRATEGY '<strategy>']
[LOOKUP FROM <collection> [VECTOR '<name>']]
[USING '<vector_name>']
LIMIT <n>
[OFFSET <n>]
[SCORE THRESHOLD <f>]
[WHERE <filter>]
[WITH { exact: true, hnsw_ef: <n> }]Docs updated:
Tests:
|
Owner
|
Thanks for the feature enrichment contribution and PR. |
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
RECOMMENDsupport to QQL, plus explicit IDs onINSERT/INSERT BULKfor deterministic upserts.RecommendQuerywith positive/negative IDs, optional strategy, and optionalWHERE..qqldumps and makes script splitting recognizeRECOMMEND.resources/sample_v2.qqlthat showcases dense search, filters, query-time params, recommend, hybrid, and sparse search.wait=Trueon writes and waiting for new collections to become visible before continuing.Validation
uv run pytest tests/test_parser.py tests/test_executor.py tests/test_script.py tests/test_dumper.pyuv run qql execute resources\sample_v2.qql --stop-on-errorLive local Qdrant verification:
qql_sample_v2=6,qql_sample_v2_hybrid=3