Bug 32040

Summary: Default operator of 'AND' for search terms should be configurable
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: SearchingAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: Main   
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:

Description Nick Clemens (kidclamp) 2022-10-28 19:03:15 UTC
When a librarian or a patron makes a mistake on a title:
i.e.: what color is my parachute
for: what color is your parachute

They can end up with no results.

In playing around in Elastic, changing default operator to 'OR' and providing a 'minimum_should_match' allow for this search to succeed - the lower the should was, the more hits I got, but making it an option would be interesting.

Koha/SearchEngine/Elasticsearch/QueryBuilder.pm
 200     $res->{query} = {
 201         query_string => {
 202             query            => $query,
 203             fuzziness        => $fuzzy_enabled ? 'auto' : '0',
 204             default_operator => 'AND',
 205             fields           => $fields,
 206             lenient          => JSON::true,
 207             analyze_wildcard => JSON::true,
 208         }
 209     };

Will try to poc something