Bug 24372 - Elasticsearch - cannot search for titles containing a colon next to a search term using the colon
Summary: Elasticsearch - cannot search for titles containing a colon next to a search ...
Status: RESOLVED DUPLICATE of bug 24567
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-07 19:30 UTC by Nick Clemens
Modified: 2022-11-22 16:26 UTC (History)
6 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2020-01-07 19:30:51 UTC
Using an example record in the testing DB, try searching for:
Pictura murală din nordul Moldovei: modificari estetice si restarare = Mural painting in the north of Moldavia: aesthetic modification and restoration

In ES the search fails. If you look at the query we end up with terms like:
Moldoveimodificari AND Moldaviaaesthetic

This is because of this line in Koha/SearchEngine/Elasticsearch/QueryBuilder.pm
 935     # Remove unquoted colons that have whitespace on either side of them
 936     $term =~ s/(\:[:\s]+|[:\s]+:)$lookahead//g;


Removing colons with a space on either side, we must be careful to put that space back:
 936     $term =~ s/(\:[:\s]+|[:\s]+:)$lookahead/ /g;
Comment 1 Fridolin Somers 2020-11-10 14:17:27 UTC
Code has changed :
    $term =~ s/(:+)(\s+)$lookahead/$2/g;
    $term =~ s/(\s+)(:+)$lookahead/$1/g;

But bug looks still valid.
Comment 2 Fridolin Somers 2020-11-10 14:22:40 UTC
Enable DumpSearchQueryTemplate syspref and look in HTML code to "query_string" > "query"
Comment 3 Joonas Kylmälä 2020-11-11 11:50:47 UTC
(In reply to Fridolin Somers from comment #1)
> Code has changed :
>     $term =~ s/(:+)(\s+)$lookahead/$2/g;
>     $term =~ s/(\s+)(:+)$lookahead/$1/g;
> 
> But bug looks still valid.

This new code should fix this, at least for me this search now works with this new code.
Comment 4 Christopher Brannon 2021-03-09 20:26:52 UTC
Running into this problem.  Would love for this fix to be released.
Comment 5 Nick Clemens 2021-03-12 13:24:03 UTC

*** This bug has been marked as a duplicate of bug 24567 ***