Bug 40243 - Single word search terms for 'Title as phrase' searches don't limit properly
Summary: Single word search terms for 'Title as phrase' searches don't limit properly
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: 24.11
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-25 17:40 UTC by Sara Brown
Modified: 2025-06-27 12:41 UTC (History)
1 user (show)

See Also:
GIT URL:
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 Sara Brown 2025-06-25 17:40:10 UTC
When using the Title as phrase index on Elasticsearch, single-word searches return results with additional words in the title. A title as phrase search for 'gift horse' returns what I would expect - 'A gift horse', 'The gift horse', and 'Gift horse'. However, a title as phrase search for 'horse' returns 'The horse', 'War horse', 'The gift horse', 'Horse adventures' (etc.).

This happens regardless of whether the search term is surrounded by quotations. And in the testing above,  QueryAutoTruncate was set to 'only if * is added.'
Comment 1 Andrew Fuerste-Henry 2025-06-27 12:41:57 UTC
QueryAutoTruncate determines whether or not Koha truncates individual words within search -- so with QueryAutoTruncate on, a search for "horse" could return "horsefly" and "horsehair." 
(As opposed to QueryStemming, which would allow "horse" to return "horsing" -- the need to drop the "e" when adding the "ing" makes it more than QueryAutoTruncate can handle.) 

The search documentation says Title As Phrase is an exact phrase search and says this about exact searches.
"ext : exact search on whole subfield (does not work with icu)"

You're looking for this to mean "my entire search term must match the entire title." It appears to currently behave as "my entire search term must match part of the title."