-
Notifications
You must be signed in to change notification settings - Fork 59
Adds optional text word weights to HybridQuery and TextQuery #410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds the ability to assign individual importance weights to specific words in text queries for both TextQuery and HybridQuery classes. This allows users to increase or decrease the score contribution of particular words during scored text matching.
- Adds
text_weightsparameter toTextQueryandHybridQueryconstructors - Implements
set_text_weights()method andtext_weightsproperty for both query types - Adds validation to ensure weights are positive numbers and applied to individual words only
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_query_types.py | Adds unit tests for text weight validation and query string generation in TextQuery, removes duplicate stopwords test code |
| tests/unit/test_aggregation_types.py | Adds unit tests for text weight validation and query string generation in HybridQuery |
| tests/integration/test_query.py | Adds integration tests verifying text weights affect scoring and result ordering for TextQuery |
| tests/integration/test_aggregation.py | Adds integration tests verifying text weights affect scoring and result ordering for HybridQuery |
| redisvl/query/query.py | Implements text weights feature in TextQuery including parameter, validation, and query string generation |
| redisvl/query/aggregate.py | Implements text weights feature in HybridQuery including parameter, validation, and query string generation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, the only minor thing is the duplication of _parse_text_weights()
This PR adds the ability to individually increase or decrease the score contribution of specific words when performing a scored text matching query.