Bug 32040 - Default operator of 'AND' for search terms should be configurable
Summary: Default operator of 'AND' for search terms should be configurable
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-28 19:03 UTC by Nick Clemens (kidclamp)
Modified: 2022-10-28 19:03 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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