Skip to content

Refactor OpenSearch model into builder services#945

Open
jazairi wants to merge 1 commit intomainfrom
use-372
Open

Refactor OpenSearch model into builder services#945
jazairi wants to merge 1 commit intomainfrom
use-372

Conversation

@jazairi
Copy link
Contributor

@jazairi jazairi commented Feb 19, 2026

Why these changes are being introduced:

The OpenSearch model has become unwieldy, and will continue to grow as we add semantic search
functionality.

Relevant ticket(s):

How this addresses that need:

This breaks out the OpenSearch logic into multiple builder models: Filter Builder and Lexical Query
Builder (with Semantic Query Builder to come
later). This refactor is intended to improve
maintainability.

Side effects of this change:

  • The OpenSearch model still retains some query building logic, most notably search highlights.
    We could consider creating a very small
    HighlightBuilder service if we want to commit to
    this architectural pattern.
  • As discussed in the ADR for this change, we will not be implementing the 'Strategy' selector model
    at this time. That change will come later, once
    semantic search has been implemented.

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

Why these changes are being introduced:

The OpenSearch model has become unwieldy, and will
continue to grow as we add semantic search
functionality.

Relevant ticket(s):

- [USE-372](https://mitlibraries.atlassian.net/browse/USE-372)

How this addresses that need:

This breaks out the OpenSearch logic into multiple
builder models: Filter Builder and Lexical Query
Builder (with Semantic Query Builder to come
later). This refactor is intended to improve
maintainability.

Side effects of this change:

- The OpenSearch model still retains some query
building logic, most notably search highlights.
We could consider creating a very small
HighlightBuilder service if we want to commit to
this architectural pattern.
- As discussed in the ADR for this change, we will
not be implementing the 'Strategy' selector model
at this time. That change will come later, once
semantic search has been implemented.
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.

3 participants

Comments