Conversation
❌ 7 blocking issues (8 total)
|
There was a problem hiding this comment.
Pull request overview
This PR updates semantic search query construction so UI tab/aggregation filters are applied in semantic mode, aligning behavior with lexical and hybrid search modes.
Changes:
- Apply
FilterBuilder-generated filters to the semantic query returned from the semantic-builder Lambda. - Update existing semantic query builder test expectations to include an explicit
filterclause. - Add new tests covering
source_filter,content_type_filter, and the “no filters” case for semantic queries.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| app/models/semantic_query_builder.rb | Adds FilterBuilder filters into the returned semantic bool query. |
| test/models/semantic_query_builder_test.rb | Extends assertions to verify filters are included in semantic queries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # to avoid redundant filter clauses | ||
| semantic_without_filters = if semantic_query.is_a?(Hash) && semantic_query[:bool] | ||
| { | ||
| bool: semantic_query[:bool].reject { |k, _| k == :filter } |
| filters = FilterBuilder.new.build(params) | ||
| semantic_query[:bool][:filter] = filters | ||
|
|
||
| semantic_query |
There was a problem hiding this comment.
Why these changes are being introduced: Semantic searches ignore filters, meaning that when semantic mode is enabled in the UI, the tabs do not filter as intended. Relevant ticket(s): - [USE-593](https://mitlibraries.atlassian.net/browse/USE-593) How this addresses that need: SemanticQueryBuilder now applies FilterBuilder filters to semantic queries, making it consistent with lexical and hybrid search. Side effects of this change: We should consider adding regression test coverage in the TIMDEX UI repo.
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.
Why these changes are being introduced:
Semantic searches ignore filters, meaning that
when semantic mode is enabled in the UI, the tabs
do not filter as intended.
Relevant ticket(s):
How this addresses that need:
SemanticQueryBuilder now applies FilterBuilder
filters to semantic queries, making it consistent
with lexical and hybrid search.
Side effects of this change:
We should consider adding regression test coverage in the TIMDEX UI repo.
Developer
our guide and
all issues introduced by these changes have been resolved or opened as new
issues (link to those issues in the Pull Request details above)
Code Reviewer
(not just this pull request message)
Requires database migrations?
NO
Includes new or updated dependencies?
NO