Bug 19197 - Lower case "or" results in broken ElasticSearch queries
Summary: Lower case "or" results in broken ElasticSearch queries
Status: RESOLVED DUPLICATE of bug 23322
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: David Gustafsson
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-29 13:42 UTC by David Gustafsson
Modified: 2020-05-28 12:46 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Change hardcoded instances of lower case "or" in search queries to be compatible with ElasticSearch query syntax (2.33 KB, patch)
2017-08-29 13:45 UTC, David Gustafsson
Details | Diff | Splinter Review
Change hardcoded instances of lower case "or" in search queries to be compatible with ElasticSearch query syntax (2.32 KB, patch)
2018-05-07 12:16 UTC, David Gustafsson
Details | Diff | Splinter Review
Bug 19197: Change lower case "or" to upper case (2.31 KB, patch)
2018-10-17 02:42 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 19197: Fix multibranch limits in ElasticSearch (2.29 KB, patch)
2019-09-05 13:19 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Gustafsson 2017-08-29 13:42:01 UTC
In some places a literal "or" is used to build search queries which probably works with Zebra, but not with ElasticSearch. Replacing theses occurrences fixes the problem in those cases. This is just a band aid, not addressing the real issue which is (I guess) that a query abstraction interface is needed, and zebra-specific syntax should not be used directly in search queries, but this will at least solve this particular issue.
Comment 1 David Gustafsson 2017-08-29 13:45:40 UTC
Created attachment 66583 [details] [review]
Change hardcoded instances of lower case "or" in search queries to be compatible with ElasticSearch query syntax
Comment 2 Katrin Fischer 2017-09-05 20:55:30 UTC
I think there are also some cases for or/OR in the XSLT templates probably.
Comment 3 David Gustafsson 2018-05-07 12:16:46 UTC
Created attachment 75114 [details] [review]
Change hardcoded instances of lower case "or" in search queries to be compatible with ElasticSearch query syntax
Comment 4 David Gustafsson 2018-05-07 12:17:00 UTC
Rebased against Koha master.
Comment 5 Cab Vinton 2018-08-18 03:03:11 UTC
Unable to apply patch to either Sandbox 11 or 13.
Comment 6 Mark Tompsett 2018-10-17 02:42:47 UTC
Created attachment 80688 [details] [review]
Bug 19197: Change lower case "or" to upper case

This makes the search queries compatible with ElasticSearch query syntax

-- rebased by Mark Tompsett <mtompset@hotmail.com>
Comment 7 Nick Clemens 2019-09-05 13:19:44 UTC
Created attachment 92607 [details] [review]
Bug 19197: Fix multibranch limits in ElasticSearch

Two issues here:
1 - OR must be capitalized
2 - The 'branch' is not analyzed and turned into 'homebranch' correctly. If we specify 'homebranch' we can later build in a 'holdingbranch' search too

To test:
 1 - Go to Administration -> Library Groups
 2 - Create a search group for staff and opac
 3 - Add two libraries
 4 - Perform an advanced search, limit to the group you just created
 5 - Note the number of results
 6 - Switch SearchEngine syspref to 'Elasticsearch'
 7 - Repeat search, note it fails
 8 - Apply patch
 9 - Restart all the things
10 - Repeat the search
11 - Success! Number of results should match previous search
12 - Switch SearchEngine to 'Zebra'
13 - Repeat search
14 - Success! Search works and number of results matches
Comment 8 Séverine Queune 2019-10-01 16:02:08 UTC
The patch works perfectly with ElasticSearch, whatever I search, using the search group.
But with Zebra, the search fails if "or" is a term I want to search (worked with ElasticSearch).
Comment 9 David Gustafsson 2020-05-28 11:10:10 UTC
Since this issue seams to have gone people by but the same changes has been introduced in Bug 23322 and bug 24506 respectively I will obsolete the current patch. Found another occurrence of hard coded boolean operator in bulkmarcimport.pl though.
Comment 10 David Gustafsson 2020-05-28 11:15:46 UTC

*** This bug has been marked as a duplicate of bug 23322 ***
Comment 11 David Gustafsson 2020-05-28 12:46:14 UTC
Created new issue for this (Bug 25616).