Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensures that fiction metadata element is being stored in the search i… #1886

Merged
merged 4 commits into from
Jun 5, 2024

Conversation

dbernstein
Copy link
Contributor

@dbernstein dbernstein commented Jun 3, 2024

…ndex in lowercase so that searches for "fiction" and "nonfiction" produce the expected results.

Resolves: https://ebce-lyrasis.atlassian.net/browse/PP-1332

Description

This is the story as I understand it:

The "Fiction" and "Nonfiction" values associated with "fiction" search document property have been stored in a mix case way since at least 3/23/2022. At that time we did not have a classifier list filter in the custom list builder in circulation-admin. When that feature was introduced on 3/28/2024, the list values of "fiction" and "nonfiction" were defined. The client sends those values to the backend for processing. When @jonathangreen made that addition we had fuzzy filtering turned on so "fiction" and "nonfiction" in the query matched for "Fiction" and "Nonfiction" in the search index. However, when we disabled fuzzy they are no longer exact matches. I believe we are both normalizing our queries to use lowercase matching and lowercasing any text going into the search index in the author, title, summary, genre, audience etc fields. It appears that fiction was not being lowercased and thus the non-matching once fuzziness was disabled.

This update simply lowercases the fiction field value on the way into the search index. This way, search queries coming into palace using "fiction" and "Fiction" will produce the expected matches.

Motivation and Context

https://ebce-lyrasis.atlassian.net/browse/PP-1332

How Has This Been Tested?

I verified that the matches were not occurring. Then I verified that changing the incoming value from the client to mix case caused search results to appear. I wrote a failing end to end test that demonstrated the problem. I then put in the fix and confirmed the test was passing. Finally I verified that the UI was giving the expected results post fix.

I'll be adding an end to end test to bring this one to completion.

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@dbernstein dbernstein marked this pull request as draft June 3, 2024 23:36
@dbernstein dbernstein marked this pull request as ready for review June 4, 2024 19:56
@dbernstein dbernstein force-pushed the PP-1332-Classification-filter-not-working branch from 1593942 to 4285334 Compare June 4, 2024 19:56
@dbernstein dbernstein requested a review from jonathangreen June 4, 2024 19:59
Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.13%. Comparing base (d14b879) to head (b44fabc).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1886   +/-   ##
=======================================
  Coverage   90.12%   90.13%           
=======================================
  Files         322      322           
  Lines       39626    39626           
  Branches     8629     8629           
=======================================
+ Hits        35713    35716    +3     
+ Misses       2604     2602    -2     
+ Partials     1309     1308    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dbernstein dbernstein force-pushed the PP-1332-Classification-filter-not-working branch 3 times, most recently from d3249e4 to a90c43e Compare June 4, 2024 23:40
@dbernstein dbernstein requested a review from a team June 4, 2024 23:41
Copy link
Member

@jonathangreen jonathangreen left a comment

Choose a reason for hiding this comment

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

Made a couple comments on this one that would be nice to clean up before merging, but it looks good.

Since we've had this field in mixed case for some time, I'm a bit concerned that this change is going to break some other use of this field in the search index, where we are currently depending on it to be mixed case, instead of lower case. I'm assuming you've looked for uses like this already.

@@ -73,6 +75,36 @@ def test_search_reindex(
end_to_end_search_fixture.expect_results([work1, work2, work4], "", ordered=False)


def test_PP_1332_fiction_returns_results(
Copy link
Member

Choose a reason for hiding this comment

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

I don't think the test name here has to refer to a ticket. It would be nice to have the test name stand on its own, so we don't have to go digging in jira in the future when we are refactoring this test.

end_to_end_search_fixture.expect_results(
expect=[work1, work2], ordered=False, query_string=""
)
default_filter = Filter()
Copy link
Member

Choose a reason for hiding this comment

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

This isn't really the default filter, the default filter is what you get when you don't pass a filter into the query. This should probably be called filter or json_filter.

@dbernstein
Copy link
Contributor Author

@jonathangreen : yes, I reviewed all the instances of "Fiction" that may be affected by this change and I didn't see anything that would present a problem.

@dbernstein dbernstein force-pushed the PP-1332-Classification-filter-not-working branch from a90c43e to b44fabc Compare June 5, 2024 16:20
@dbernstein dbernstein added the bug Something isn't working label Jun 5, 2024
@dbernstein dbernstein merged commit f7a403f into main Jun 5, 2024
20 checks passed
@dbernstein dbernstein deleted the PP-1332-Classification-filter-not-working branch June 5, 2024 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants