Bug 41051 - QueryFuzzy system preference description is not clear about whether it works with Elasticsearch, or just Zebra
Summary: QueryFuzzy system preference description is not clear about whether it works ...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: David Nind
QA Contact: Testopia
URL:
Keywords: Academy
Depends on:
Blocks:
 
Reported: 2025-10-17 18:30 UTC by Alex Carver [Acerock7]
Modified: 2025-12-24 19:58 UTC (History)
6 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
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 Alex Carver [Acerock7] 2025-10-17 18:30:51 UTC
An otherwise intelligent sysadmin may wonder why Elasticsearch fuzzy searches with "~" don't work and go looking for answers. The current phrasing of the QueryFuzzy syspref is unclear and suggests that the syspref only affects users of Zebra. This is not the case, as the syspref must be set to "Try" on Elasticsearch systems as well in order to enable fuzzy searches.

Current phrasing:

[Try/Don't Try] to match similarly spelled words in a search. (For example, a search for flang would also match flange and fang; Currently only affects Zebra searches. Any Elasticsearch term can be made fuzzy by adding a ~ directly after the term.)

Suggested wording:

[Try/Don't Try] to match similarly spelled words in a search. (For example, a search for flang would also match flange and fang.) If using Zebra, searches become fuzzy by default. If using Elasticsearch, a term must be made fuzzy by adding a ~ directly after the term.
Comment 1 hebah 2025-10-17 20:22:04 UTC
Noting here that in addition to clarifying the system preference helper text, the manual has an explicit note saying it only works with Zebra, which we know is no longer true :https://koha-community.org/manual//25.05/en/html/searchingpreferences.html#queryfuzzy
Comment 2 Mathieu Saby 2025-10-19 16:44:16 UTC
Oh it works with Elasticsearch ?
Comment 3 Aude Charillon 2025-10-20 09:11:46 UTC
Is this bug about updating the Manual or changing the sys pref description in the staff interface? It sounds like both are needed, but if you want the sys pref description changed please use the Component = Staff interface.
Comment 4 Alex Carver [Acerock7] 2025-10-20 11:42:04 UTC
(In reply to Aude Charillon from comment #3)
> Is this bug about updating the Manual or changing the sys pref description
> in the staff interface? It sounds like both are needed, but if you want the
> sys pref description changed please use the Component = Staff interface.

Ok done! Thanks for the clarification. Both are needed but this bug was intended for the syspref description.
Comment 5 Alex Carver [Acerock7] 2025-10-20 11:42:44 UTC
(In reply to Mathieu Saby from comment #2)
> Oh it works with Elasticsearch ?

It does!
Comment 6 David Nind 2025-12-24 19:57:36 UTC
I was going to submit a patch to update the system preference description, 
as I can confirm that the example and system preference works with 
Elasticsearch.

However, I can't get the example and system preference to work with Zebra!

Using Zebra (using KTD):
1. Edit three records, so that they have these terms in the title:
   1.1 Record 1: flang
   1.2 Record 2: flange
   1.3 Record 3: fang
2. Search for flang with the different options for QueryFuzzy:
   2.1 Don't try: should return records 1 and 2 - it does!
   2.2 Try: should return all three records, however it doesn't - it only 
       returns records 1 and 2 (even after a re-index)

Does anyone have a better example of a fuzzy search that works with both 
Zebra and Elasticsearch, or does this indicate that something isn't 
working as it should for Zebra?

If it is the later, then it is a different problem to solve and 
way beyond my level of expertise to fix!

Draft commit message with test plan and updated system preference description
=============================================================================

Bug 41051: Update QueryFuzzy system preference description

This updates the description for the QueryFuzzy system preference to
make it clear that it works for both Zebra and Elasticsearch engines.
The current description implies that it only works with Zebra.

Test plan:
1. Start up KTD normally, using Zebra as the search engine 
   (the default): ktd up
2. Edit three records, so that they have these terms in the title:
   2.1 Record 1: flang
   2.2 Record 2: flange
   2.3 Record 3: fang
3. Search for flang with the different options for QueryFuzzy:
   3.1 Don't try: should return records 1 and 2
   3.2 Try: should return all three records
4. Shut down KTD and start up with Elasticsearch: 
   ktd --search-engine es7 up
5. Repeat step 2.
6. Search for flang with the different options for QueryFuzzy:
   3.1 Don't try: should only return records 1 and 2
   3.2 Try: should only return records 1 and 2
7. Search for flang~ with the different options for QueryFuzzy:
   3.1 Don't try: should only return record 1
   3.2 Try: should return all three records (plus other records as well)
8. Check the updated wording for the QueryFuzzy system preference and
   confirm that it is clear and makes sense:
   8.1 Current description: 
        [Don't try|Try] to match similarly spelled words in a search. (For example, a search for flang would also match flange and fang; Currently only affects Zebra searches. Any Elasticsearch term can be made fuzzy by adding a ~ directly after the term.)
   8.2 Updated description: 
        [Don't try|Try] to match similarly spelled words in a search (for example, a search for flang would also match flange and fang). Zebra searches are fuzzy by default. If using Elasticsearch, add ~ after the search term, for example: flang~.