Skip to content

Conversation

@JPrevost
Copy link
Member

@JPrevost JPrevost commented Dec 16, 2025

Why are these changes being introduced:

  • We are introducing a fulltext field in our OpenSearch index to allow searching the full text of documents. This change allows users to include the fulltext field in their search if they want. The default is false to support existing behavior (i.e. this is opt-in).

Relevant ticket(s):

How does this address that need:

  • Moves fields to search into its own method so that it can conditionally include the fulltext field based on a parameter passed to the search method.
  • Updates GraphQL query_type to accept a fulltext parameter (defaulting to false) and pass that to the OpenSearch search method.

Developer

  • All new ENV is documented in README
  • All new ENV has been added to Heroku Pipeline, Staging and Prod
  • ANDI or Wave has been run in accordance to
    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)
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated or is unnecessary
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

Requires database migrations?

NO

Includes new or updated dependencies?

NO

Changes GraphQL schema?

YES

Why are these changes being introduced:

* We are introducing a fulltext field in our OpenSearch index to allow
  searching the full text of documents. This change allows users to
  include the fulltext field in their search if they want. The default
  is false to support existing behavior (i.e. this is opt-in).

Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/TIMX-588

How does this address that need:

* Moves fields to search into its own method so that it can conditionally
  include the fulltext field based on a parameter passed to the search
  method.
* Updates GraphQL query_type to accept a fulltext parameter
  (defaulting to false) and pass that to the OpenSearch search method.
@mitlib mitlib temporarily deployed to timdex-api-p-timx-588-f-fwsgc4 December 16, 2025 19:32 Inactive
@matt-bernhardt matt-bernhardt self-assigned this Dec 18, 2025
Copy link
Member

@matt-bernhardt matt-bernhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me - I've been able to use this argument in the sandbox and see a different number of records come back (more records if I set fulltext to true, which is what I'd expect). I have one question about the conditions under which the internal argument might vary in the way we're permitting, but that's only so that I make sure I understand things, not with a concern that this is the wrong change.

Thanks!

:shipit:


# Only treat fulltext as true if it is boolean true or the string 'true' (case insensitive)
def fulltext?(fulltext_param)
fulltext_param == true || fulltext_param.to_s.downcase == 'true'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a question only so I can understand - is it possible for this argument to vary in this way, the way we've built this? The query schema enforces fulltext to be a Boolean, and errors if a string is provided (at least as I poke it in the sandbox on the review app). I'm happy for the internals to be a bit more permissive in this way, but if there's a way that this variation might occur in the wild I'm missing it at the moment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct in that if the GraphQL entry point is used this is enforced upstream. I don't necessarily trust future us to not use some other entry point that may not be enforced in the same way. In other words, I don't want to rely on GraphQL logic to ensure the OpenSearch logic is sound. Does that make sense?

@JPrevost JPrevost merged commit a383514 into main Dec 18, 2025
2 checks passed
@JPrevost JPrevost deleted the timx-588-fulltext-search branch December 18, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants