Skip to content

Ett 1360 onephrase#130

Merged
liseli merged 1 commit intomainfrom
ETT-1360_onephrase
Mar 12, 2026
Merged

Ett 1360 onephrase#130
liseli merged 1 commit intomainfrom
ETT-1360_onephrase

Conversation

@liseli
Copy link
Contributor

@liseli liseli commented Mar 5, 2026

This PR fixes the issues reported on the Jira ticket

The cause of these issues was differences in the Solr query generated before and after refactoring the search application. To have the same queries on both versions, I have

  • Ensure onephrase clause is always wrapped in quotes - that is a previous behavior that In Solr, means an exact match query
  • Revised the and/or clause creation process to consistently include AND/OR between the escaped parts. Some edge cases didn't quite fit this rule. For example, in the input query NEUTRON ELASTIC- AND INELASTIC-SCATTERING CROSS SECTIONS, since the string has an AND operator, a onephrase was produced instead of combining the tokens with AND/OR operators.
  • I have updated the tests and documented the changes in the code.

This branch can be tested in https://test.catalog.hathitrust.org/Search/Home. Some of the queries I've tested:

title: Spencer A. Samuels & Company, Ltd, 1972 --> 0 results
title: Spencer A. Samuels & Company --> 3 results
title: NEUTRON ELASTIC- AND INELASTIC-SCATTERING CROSS SECTIONS FOR Mg IN THE ENERGY RANGE 4.19 TO 8.56 MeV --> 0 results
title: "Kilmacolm : a parish history" --> 1 result

@liseli liseli requested review from aelkiss and moseshll March 5, 2026 22:27
@aelkiss
Copy link
Member

aelkiss commented Mar 9, 2026

@liseli Prior to the changes regarding quoting, did the users' reported title search return any results? I'm guessing not, just double checking.

@liseli
Copy link
Contributor Author

liseli commented Mar 9, 2026

@liseli Prior to the changes regarding quoting, did the users' reported title search return any results? I'm guessing not, just double checking.

The user hasn't reported any previous results for this query. To provide some context, I'm referencing the results from an earlier version of the repository—before any changes were made.

I'm using a specific commit to compare the previous behavior with the current one.

git checkout ee0fe0b
commit url: Merge pull request #105 from hathitrust/ETT-636-trixie · hathitrust/catalog@ee0fe0b

Copy link
Member

@aelkiss aelkiss left a comment

Choose a reason for hiding this comment

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

This all looks fine to me.

Rebuilt the and/or value creation to always inject AND/OR between the escaped pieces
Updated unit test adding double quotes phrase query
Join phrases with operators before creating the semantic structucture to handle queries like apple OR orange
@liseli liseli force-pushed the ETT-1360_onephrase branch from e8bfcfb to 5927a46 Compare March 12, 2026 14:51
@liseli liseli merged commit ff38123 into main Mar 12, 2026
2 checks passed
@liseli liseli deleted the ETT-1360_onephrase branch March 12, 2026 16:34
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