Skip to content

Adds about natural language search page and links#397

Merged
JPrevost merged 3 commits into
mainfrom
use-601
May 28, 2026
Merged

Adds about natural language search page and links#397
JPrevost merged 3 commits into
mainfrom
use-601

Conversation

@JPrevost

@JPrevost JPrevost commented May 28, 2026

Copy link
Copy Markdown
Member

Why are these changes being introduced:

  • To provide users with information about the natural language search
    feature, how to use it, and limitations to be aware of.

Relevant ticket(s):

How does this address that need:

  • Creates static page with content

NOTE: a separate commit adjusting index page title is also included
NOTE: a separate bugfix for geodata introduced recently is also included.

Developer

Accessibility
  • ANDI or WAVE has been run in accordance to our guide.
  • This PR contains no changes to the view layer.
  • New issues flagged by ANDI or WAVE have been resolved.
  • New issues flagged by ANDI or WAVE have been ticketed (link in the Pull Request details above).
  • No new accessibility issues have been flagged.
New ENV
  • All new ENV is documented in README.
  • All new ENV has been added to Heroku Pipeline, Staging and Prod.
  • ENV has not changed.
Approval beyond code review
  • UXWS/stakeholder approval has been confirmed.
  • UXWS/stakeholder review will be completed retroactively.
  • UXWS/stakeholder review is not needed.
Additional context needed to review

E.g., if the PR includes updated dependencies and/or data
migration, or how to confirm the feature is working.

Code Reviewer

Code
  • I have confirmed that the code works as intended.
  • Any CodeClimate issues have been fixed or confirmed as
    added technical debt.
Documentation
  • The commit message is clear and follows our guidelines
    (not just this pull request message).
  • The documentation has been updated or is unnecessary.
  • New dependencies are appropriate or there were no changes.
Testing
  • There are appropriate tests covering any new functionality.
  • No additional test coverage is required.

@qltysh

qltysh Bot commented May 28, 2026

Copy link
Copy Markdown

❌ 1 blocking issue (1 total)

Tool Category Rule Count
rubocop Lint Class has too many lines. [143/100] 1

Comment thread app/helpers/application_helper.rb Outdated
@mitlib mitlib temporarily deployed to timdex-ui-pi-use-601-tmvzxdfb1 May 28, 2026 15:56 Inactive
@JPrevost JPrevost temporarily deployed to timdex-ui-pi-use-601-tmvzxdfb1 May 28, 2026 18:05 Inactive
@coveralls

coveralls commented May 28, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 26600286704

Coverage increased (+0.001%) to 98.318%

Details

  • Coverage increased (+0.001%) from the base build.
  • Patch coverage: 2 of 2 lines across 2 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1427
Covered Lines: 1403
Line Coverage: 98.32%
Coverage Strength: 74.45 hits per line

💛 - Coveralls

@JPrevost JPrevost changed the title Use 601 Adds about natural language search page and links May 28, 2026
@JPrevost JPrevost requested a review from Copilot May 28, 2026 18:26
@JPrevost JPrevost requested a review from matt-bernhardt May 28, 2026 18:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a new static “About Natural Language Search” page and wires it into the UI so users can learn what NLS is, when it applies, and its limitations.

Changes:

  • Adds /about-natural-language-search route, controller action, view, and a basic integration test.
  • Updates “Learn more” links in the search form and NLS warning callout to point to the new page.
  • Adjusts index page title behavior and updates a TIMDEX source URL env var fetch behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
test/helpers/application_helper_test.rb Updates expectations for index page title format.
test/controllers/static_controller_test.rb Adds request specs for static pages.
config/routes.rb Adds route for the new about-NLS page.
app/views/static/about_natural_language_search.html.erb New static informational page for NLS.
app/views/search/_nls_alert.html.erb Updates “Learn more” link target in NLS warning.
app/views/search/_form.html.erb Updates “Learn more” link target in NLS toggle area.
app/models/normalize_timdex_record.rb Changes env var fetching for MIT Alma source URL construction.
app/helpers/application_helper.rb Changes index page title formatting when PLATFORM_NAME is set.
app/controllers/static_controller.rb Adds controller action for the new static page.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,44 @@
<% content_for :page_title, "About Natural Language Search" %>
Comment on lines +4 to +7
<h2>Opting in to Natural Language Search</h2>

<h3>What does turning on the Natural Language Search (NLS) do?</h3>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

FWIW this is incorrect. We have an H1 on the page and this starting at H2 is correct.

Comment on lines +19 to +43
<p>In our experience, NLS works well for:
<ul>
<li>Natural language queries ("what causes ocean acidification?")</li>
<li>Concept-based searches rather than exact phrases</li>
<li>Exploratory research where related terms are valuable</li>
</ul>
</p>
<p>Traditional keyword searching works well for:
<ul>
<li>Specific item searches (i.e. pasting an article title or full citation into the search box)</li>
</ul>
</p>
<p>Do you agree? <a href="https://libraries.mit.edu/use-feedback">Let us know what you think.</a></p>

<h3>Are there any limitations I should be aware of?</h3>

<p>This search tool (the default on the MIT Libraries homepage) searches across many MIT Libraries catalogs, indexes, and content sources and not all of these can be searched with NLS. You'll still get results from all sources - but we will revert to traditional keyword matching when NLS is not possible.</p>

<p>That means if you have enabled NLS, this is what you'll get on each tab:
<ul>
<li>All tab (default): results listing "Articles, Books &amp; More" as a source use traditional keyword matching, all other results use NLS</li>
<li>Articles/Books &amp; Media tabs: all results use traditional keyword matching</li>
<li>All other tabs: all results use NLS</li>
</ul>
</p>
Comment on lines +19 to +43
<p>In our experience, NLS works well for:
<ul>
<li>Natural language queries ("what causes ocean acidification?")</li>
<li>Concept-based searches rather than exact phrases</li>
<li>Exploratory research where related terms are valuable</li>
</ul>
</p>
<p>Traditional keyword searching works well for:
<ul>
<li>Specific item searches (i.e. pasting an article title or full citation into the search box)</li>
</ul>
</p>
<p>Do you agree? <a href="https://libraries.mit.edu/use-feedback">Let us know what you think.</a></p>

<h3>Are there any limitations I should be aware of?</h3>

<p>This search tool (the default on the MIT Libraries homepage) searches across many MIT Libraries catalogs, indexes, and content sources and not all of these can be searched with NLS. You'll still get results from all sources - but we will revert to traditional keyword matching when NLS is not possible.</p>

<p>That means if you have enabled NLS, this is what you'll get on each tab:
<ul>
<li>All tab (default): results listing "Articles, Books &amp; More" as a source use traditional keyword matching, all other results use NLS</li>
<li>Articles/Books &amp; Media tabs: all results use traditional keyword matching</li>
<li>All other tabs: all results use NLS</li>
</ul>
</p>
Comment on lines +19 to +43
<p>In our experience, NLS works well for:
<ul>
<li>Natural language queries ("what causes ocean acidification?")</li>
<li>Concept-based searches rather than exact phrases</li>
<li>Exploratory research where related terms are valuable</li>
</ul>
</p>
<p>Traditional keyword searching works well for:
<ul>
<li>Specific item searches (i.e. pasting an article title or full citation into the search box)</li>
</ul>
</p>
<p>Do you agree? <a href="https://libraries.mit.edu/use-feedback">Let us know what you think.</a></p>

<h3>Are there any limitations I should be aware of?</h3>

<p>This search tool (the default on the MIT Libraries homepage) searches across many MIT Libraries catalogs, indexes, and content sources and not all of these can be searched with NLS. You'll still get results from all sources - but we will revert to traditional keyword matching when NLS is not possible.</p>

<p>That means if you have enabled NLS, this is what you'll get on each tab:
<ul>
<li>All tab (default): results listing "Articles, Books &amp; More" as a source use traditional keyword matching, all other results use NLS</li>
<li>Articles/Books &amp; Media tabs: all results use traditional keyword matching</li>
<li>All other tabs: all results use NLS</li>
</ul>
</p>
Comment thread app/views/search/_nls_alert.html.erb Outdated
<aside class="nls-alert">
<i class="fa-regular fa-circle-exclamation"></i>
<p>Natural language search is not available for these results<a href="#">Learn more</a></p>
<p>Natural language search is not available for these results<a href="/about-natural-language-search" data-turbo-frame="_top">Learn more</a></p>
Comment thread app/views/search/_form.html.erb Outdated
<div class="semantic-search-toggle <%= @natural_language_search_optin ? 'toggled-on' : 'toggled-off' %>" data-controller="natural-language-search-toggle" data-matomo-seen="Semantic Search Toggle, Seen by user, Tab: {{getActiveTabName}}">
<button type="button" aria-pressed="<%= @natural_language_search_optin %>" data-action="click->natural-language-search-toggle#toggle" data-matomo-click="Semantic Search Toggle, Toggle Clicked, Was: {{getToggleState}}">Natural language search</button>
<a href="#" data-matomo-click="Semantic Search Toggle, Learn more Clicked, Tab: {{getActiveTabName}}">Learn more</a>
<a href="/about-natural-language-search" data-matomo-click="Semantic Search Toggle, Learn more Clicked, Tab: {{getActiveTabName}}">Learn more</a>
Comment on lines 13 to 15
'MIT Alma' => ['MIT Libraries Catalog',
"#{ENV.fetch('MIT_PRIMO_URL')}/discovery/search?vid=#{ENV.fetch('PRIMO_VID')}&lang=en"]
"#{ENV.fetch('MIT_PRIMO_URL', nil)}/discovery/search?vid=#{ENV.fetch('PRIMO_VID', nil)}&lang=en"]
}.freeze

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is a quick bug fix for geodata, a ticket to address it more robustly will be opened.

Comment on lines 16 to 18
def index_page_title
ENV.fetch('PLATFORM_NAME', nil) ? "Search #{ENV.fetch('PLATFORM_NAME')} | MIT Libraries" : 'Search | MIT Libraries'
ENV.fetch('PLATFORM_NAME', nil) ? ENV.fetch('PLATFORM_NAME') : 'Search | MIT Libraries'
end
Comment on lines +5 to +11
get '/about-natural-language-search'

assert_response :success
end

test 'style guide page returns success' do
get '/style-guide'
@JPrevost JPrevost requested review from Copilot and removed request for matt-bernhardt May 28, 2026 18:45
@JPrevost JPrevost temporarily deployed to timdex-ui-pi-use-601-tmvzxdfb1 May 28, 2026 18:54 Inactive

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@JPrevost JPrevost requested a review from matt-bernhardt May 28, 2026 19:29
@matt-bernhardt matt-bernhardt self-assigned this May 28, 2026

@matt-bernhardt matt-bernhardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think there's an improper closing tag in the page content, but from looking in the inspector it appears that browsers are correcting for this appropriately. The W3C's validator does flag it as a broken closing tag, however.

All this said, if you want to merge I'm not going to block it.

The rest of the changes all look good. I've confirmed that running this in Geodata mode doesn't crash anymore - feeling guilty that I missed that the first time.

<h3>How can I tell you what I think about NLS?</h3>

<p><a href="https://libraries.mit.edu/use-feedback">Send us your feedback!</a> Sharing your experiences (good and bad) will help us understand how to make these search options work better.</p>
<p>In our experience, NLS works well for:</>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is a broken closing tag? Should it be </p> ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Doh, will fix. Great catch and yeah modern browsers are super forgiving but we should still write valid code!

JPrevost added 3 commits May 28, 2026 16:27
Why are these changes being introduced:

* To provide users with information about the natural language search
  feature, how to use it, and limitations to be aware of.

Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/USE-601

How does this address that need:

* Creates static page with content
This is not necessarily the final version of this, but it addresses a current double "search" while we await final intent
I'll open a separate ticket to fix this better, but for now this should allow us to deploy geodata again.
@JPrevost JPrevost temporarily deployed to timdex-ui-pi-use-601-tmvzxdfb1 May 28, 2026 20:27 Inactive
@JPrevost JPrevost merged commit 2d58d19 into main May 28, 2026
6 checks passed
@JPrevost JPrevost deleted the use-601 branch May 28, 2026 20:29
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.

5 participants