Bug 24895

Summary: Elasticsearch CCL searching with phr modifier doesn't work
Product: Koha Reporter: Andrew Fuerste-Henry <andrewfh>
Component: Searching - ElasticsearchAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P5 - low CC: dcook, katrin.fischer, lari.taskula, nick, severine.queune
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27307
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30745
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:

Description Andrew Fuerste-Henry 2020-03-18 15:21:18 UTC
To test:
- enable DumpSearchQueryTemplate so you can easily check the contents of your query
- enter a CCL search of ti,phr:batman
- confirm the query gets processed as just ti:batman
Comment 1 Katrin Fischer 2020-03-19 07:39:49 UTC
Hi Andrew, have you tried with more than one word?
Comment 2 Katrin Fischer 2020-04-28 22:57:02 UTC
I just realized this was filed for Elasticsearch.

For Zebra, it seems all good:
'query_cgi' => 'q=ccl=ti%2Cphr%3Astreet',
'querystring' => 'ti,phr:street',
'search_query' => '(rk=( ti,phr="street")) ',

I think for Elasticsearch you are correct, it doesn't look like phrase is always used. It appears to work when Title, phrase from advanced search is used, but not when you enter the ccl = is ccl understood by Elasticsearch at all?
Comment 3 Andrew Fuerste-Henry 2020-04-29 00:56:25 UTC
Oh, and I'm sorry I completely missed your earlier question. Yes, CCL works in Elastic broadly.
This isn't a huge deal, since Elastic lets you use quotation marks. So ti:"Batman Returns" does that ti,phr:Batman Returns fails to do. But it'd still be good to maintain some continuity for longtime Zebra users.
Comment 4 Nick Clemens (kidclamp) 2020-12-22 15:00:16 UTC
Koha/SearchEngine/Elasticsearch/QueryBuilder.pm :
 _convert_index_strings_freeform
 781 This is similar to L<_convert_index_strings>, however it'll search out the
 782 things to change within the string. So it can handle strings such as
 783 C<(su:foo) AND (su:bar)>, converting the C<su> appropriately.
 784 
 785 If there is something of the form "su,complete-subfield" or something, the
 786 second part is stripped off as we can't yet handle that. Making it work
 787 will have to wait for a real query parser.
Comment 5 David Cook 2024-05-03 02:04:29 UTC
'ti:batman adventures' also doesn't seem to work. You have to do 'ti:"batman adventures"' but that's also basically the same thing as 'ti,phr:"batman adventures"'

We've started using Elasticsearch more, and it looks like we're going to encounter some growing pains...
Comment 6 David Cook 2024-05-03 02:05:10 UTC
Seems to me like the whole of advanced search is a mess with Elastic but... I guess I'll see...