Conversation
Why are these changes being introduced: * We want to be able to tune the semantic query parameters for better results. Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/USE-619 How does this address that need: * Introduces new semantic query tuning parameters to the GraphQL API. * Ensures those parameters are not documented publicly by prefixing them with `INTERNAL USE ONLY` in the description and skipping them in introspection queries.
❌ 9 blocking issues (14 total)
|
| def search(searchterm:, citation:, contributors:, funding_information:, geodistance:, geobox:, identifiers:, | ||
| locations:, subjects:, title:, index:, source:, from:, boolean_type:, fulltext:, per_page: 20, | ||
| query_mode: 'keyword', use_global_scoring: false, **filters) | ||
| query_mode: 'keyword', use_global_scoring: false, semantic_must_boost_threshold: nil, |
| @@ -4,12 +4,13 @@ class Opensearch | |||
| MAX_SIZE = 200 | |||
|
|
|||
| def search(from, params, client, highlight: false, index: nil, fulltext: false, query_mode: 'keyword', | |||
There was a problem hiding this comment.
Pull request overview
This PR adds internal semantic query tuning knobs to the GraphQL search API and threads them through to the semantic-query Lambda payload, while attempting to hide these knobs from public schema introspection.
Changes:
- Add
semantic_*tuning arguments to GraphQLsearchand pass them through to OpenSearch query building. - Extend
Opensearch,HybridQueryBuilder, andSemanticQueryBuilderto accept and forwardsemantic_options. - Add schema-level visibility logic intended to hide “INTERNAL USE ONLY” arguments from introspection.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| app/models/semantic_query_builder.rb | Accepts semantic tuning options and conditionally adds them to the Lambda invocation payload. |
| app/models/opensearch.rb | Stores semantic options and passes them only for semantic/hybrid query modes. |
| app/models/hybrid_query_builder.rb | Forwards semantic options into SemanticQueryBuilder. |
| app/graphql/types/query_type.rb | Adds internal GraphQL arguments and constructs the semantic_options hash passed to Opensearch. |
| app/graphql/timdex_schema.rb | Adds visibility hook intended to hide INTERNAL USE ONLY members during introspection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return false if is_introspection | ||
| end | ||
|
|
||
| super |
There was a problem hiding this comment.
| builder.build(@params, fulltext: @fulltext, semantic_options: @semantic_options || {}) | ||
| else | ||
| builder.build(@params, fulltext: @fulltext) | ||
| end |
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 are these changes being introduced:
Relevant ticket(s):
How does this address that need:
INTERNAL USE ONLYin the description and skipping them in introspection queries.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