Summary: | Limiting subtypes by Braille doesn't work when searching with Elasticsearch | ||
---|---|---|---|
Product: | Koha | Reporter: | Peter Vashchuk <stalkernoid> |
Component: | Searching | Assignee: | Peter Vashchuk <stalkernoid> |
Status: | Failed QA --- | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | david, lin-wei.li, nugged, slavashishkin |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | --- | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: | ||
Attachments: | Bug 39770: Fix wrong Braille format search for Elasticsearch |
Description
Peter Vashchuk
2025-04-29 09:38:17 UTC
Created attachment 181640 [details] [review] Bug 39770: Fix wrong Braille format search for Elasticsearch ElasticSearch couldn't find any books that have Braille: No results match your search with limit(s): 'ff7-01-02:("tc or fb")'. It was a problem because the "l-format:tc or fb" only works for Zebra and is incorrect way to search with OR for ElasticSearch. Elastic requires the syntax to be l-format:"tc" OR "fb” (uppercase OR and each format in double quotes) instead. This patch fixes it by checking which search engine you use depending on the current syspref SearchEngine and provides the correctly formatted format. To reproduce: 1. Have ElasticSearch enabled and check that you have books with braille, or make up one yourself by adding "tc" (text - Braille) or "fb" (tactile material - braille) to 007 MARC field. 2. Go to catalogue/advanced search and select format: braille, from the dropdown. 3. Try to find anything, if you are using ElasticSearch you will see: No results match your search with limit(s): 'ff7-01-02:("tc or fb")' 4. Do the same with Zebra instead of Elastic, it should work properly and you should see all the books that have Braille. 5. Apply the patch. 6. Repeat same search both using ElasticSearch and then Zebra. Both ElasticSearch and Zebra should work without any issues. Do we really need the check on SearchEngine here? AFAIK Zebra also works with both upper and lower case boolean, so we could just switch this like we did in other places? Unfortunately, yes, because it's not just about the OR being upper case, Elasticsearch needs the terms to be quoted like: "tc" OR "fb", to parse them properly, otherwise it treats it as a singular term "tc OR fb" and finds nothing. (In reply to Peter Vashchuk from comment #3) > Unfortunately, yes, because it's not just about the OR being upper case, > Elasticsearch needs the terms to be quoted like: "tc" OR "fb", to parse them > properly, otherwise it treats it as a singular term "tc OR fb" and finds > nothing. Thanks for explaining :) # Test Results - ElasticSearch: Expected behavior. - Zebra: Does not work. # Test Execution 0. Create new Catalog with "fb" in 007. 1. Advanced search > Subtype limits > Format > Braille (Default search engine: ElasticSearch). 2. No results match your search with limit(s): 'ff7-01-02:("tc or fb")'. 3. Switch search engine to Zebra. 4. No results match your search with limit(s): 'l-format:tc or fb'. 5. Apply patch. 6. No results match your search with limit(s): 'l-format:tc or fb'. 7. Switch search engine back to ElasticSearch. 8. ElasticSearch finds my Catalog. # Notes - Zebra seems to not work at all for me (even on simple searches that I know should work), so it's likely be a problem on my end. - I can sign-off for ElasticSearch, but I don't know for Zebra. - Someone else might be able to verify that Zebra still works with Braille after the patch. - I will leave the status as "Needs Signoff." I tested in Zebra and Elasticsearch: 1. Zebra: works as expected before and after the patch, for both the staff interface and the OPAC. 2. Elasticsearch: - Before the patch: no results in staff interface and OPAC before the patch - After the patch: results in the staff interface, no results in the OPAC: . URL for the OPAC, in case that helps troubleshoot: /cgi-bin/koha/opac-search.pl?advsearch=1&weight_search=on&limit=branch%3ACPL&sort_by=relevance&limit=l-format%3Atc+or+l-format%3Afb&do=Search . Message displayed in the OPC: No results found! No results found for that in catalog. - I reindexed, in case that makes a difference (it didn't for my testing) I've failed QA, as I think this should be fixed for the OPAC as well. |