We have Elasticsearch 6.8.15 and the following error happens when trying to enter colon or exclamation point into 245$a as the last symbol [query_shard_exception] Failed to parse query [(host-item:osteuropa:)], with: {"index_uuid": ....} called from sub Search::Elasticsearch::Role::Client::Direct::__ANON__ at /usr/share/koha/lib/Koha/SearchEngine/Elasticsearch/Search.pm line 96 'Failed to parse query [(host-item:osteuropa:)]'}],'failed_shards' => [{'shard' => 0,'node' => 'node','reason' => {'type' => 'query_shard_exception','caused_by' => {'caused_by' => {'type' => 'parse_exception','reason' => 'Encountered " ":" ": "" at line 1, column 20. Error does not happen when entering either of these symbols in 245$b. Are these symbols not properly escaped in that subfield?
I'm just confirming this error occurs. Staff saw Internal Server Error when trying to view a bib record. Looking in the log files, I saw the "[query_shard_exception] Failed to parse query [(host-item: ...." message as per Bohdan's original post. Editing the bib record by directly bringing it up with addbiblio.pl?biblionumber= worked and I removed the colon at the end of the 245a. The record could then be viewed. Adding the colon back caused the error again.
(In reply to John Yorio from comment #1) > I'm just confirming this error occurs. > > Staff saw Internal Server Error when trying to view a bib record. > > Looking in the log files, I saw the "[query_shard_exception] Failed to parse > query [(host-item: ...." message as per Bohdan's original post. > > Editing the bib record by directly bringing it up with > addbiblio.pl?biblionumber= worked and I removed the colon at the end of the > 245a. The record could then be viewed. Adding the colon back caused the > error again. I did some further testing. In my testing of a 245$a ending in a colon, if the colon is preceded by a space, the error does not occur. So, something like "My Title :" works fine, but "My Title:" produces the error. Exclamation points failed regardless.
Created attachment 123045 [details] [review] Bug 28484: ES clean title in biblio detail Test plan: - Create a biblio with title like "osteuropa:" or "osteuropa!" - Go the this biblio detail pages (cgi-bin/koha/catalogue/detail.pl) => Error - Apply bug 28316 and this one - test again
Bug 28316 add some escapings for specials characters like exclamation mark or colon. But this works only for searches. In biblio detail, the query is built in the script, so the cleaning doesn't apply. The proposed patch clean the biblio title before the call to simple_search_compat.
Created attachment 123607 [details] [review] Bug 28484: ES clean title in biblio detail Test plan: - Create a biblio with title like "osteuropa:" or "osteuropa!" - Go the this biblio detail pages (cgi-bin/koha/catalogue/detail.pl) => Error - Apply bug 28316 and this one - test again Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Followed test plan, patch worked as described in kohadevbox running Elasticsearch. So signed off.
Created attachment 124379 [details] [review] Bug 28484: ES clean title in biblio detail Test plan: - Create a biblio with title like "osteuropa:" or "osteuropa!" - Go the this biblio detail pages (cgi-bin/koha/catalogue/detail.pl) => Error - Apply bug 28316 and this one - test again Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Trivial patch after the work carried out by bug 28316.. passing QA
*** Bug 28326 has been marked as a duplicate of this bug. ***
I don't recreate the work on master, can you provide more details please. I don't really see the point of the new method this patch adds: sub clean_search_term { my ( $self, $term ) = @_; return $term; } ...
(In reply to Jonathan Druart from comment #10) > I don't really see the point of the new method this patch adds: > > sub clean_search_term { > my ( $self, $term ) = @_; > > return $term; > } > > ... Never mind, it's for Zebra. Still cannot recreate the problem however.
(In reply to Jonathan Druart from comment #11) > (In reply to Jonathan Druart from comment #10) > > I don't really see the point of the new method this patch adds: > > > > sub clean_search_term { > > my ( $self, $term ) = @_; > > > > return $term; > > } > > > > ... > > Never mind, it's for Zebra. > > Still cannot recreate the problem however. hmm, seems like the dependency here, bug 28316, does the cleaning already so this seems to just call the cleaning function another time.
I don't recreate *on master*: - Create a biblio with title like "osteuropa:" or "osteuropa!" - Go the this biblio detail pages (cgi-bin/koha/catalogue/detail.pl) => Error There is no error for me.
Bug 28316 is waiting for SO, can we get your attention there please?
Switching back to PQA as the blocker has been pushed.
(In reply to Jonathan Druart from comment #13) > I don't recreate *on master*: > > - Create a biblio with title like "osteuropa:" or "osteuropa!" > - Go the this biblio detail pages (cgi-bin/koha/catalogue/detail.pl) > => Error > > There is no error for me. For the record, the error appears on the *OPAC* detail page.
And I am still getting the error after applying this patch: Unable to understand your search query, please rephrase and try again. at /kohadevbox/koha/Koha/SearchEngine/Elasticsearch/Search.pm line 100 In logs: ','type' => 'parse_exception'},'reason' => 'Failed to parse query [(host-item:(osteuropa!))]','index_uuid' => '-iKfKTkGSwCClT_0bcKLdQ','type' => 'query_shard_exception'},'node' => 'PCWsz1DTR6ybJJ3d0wR2YA'}],'t ype' => 'search_phase_execution_exception','reason' => 'all shards failed'}}}
There is also a QA script failure FAIL Koha/SearchEngine/Zebra/QueryBuilder.pm FAIL pod *** WARNING: =head2 without preceding higher level in file Koha/SearchEngine/Zebra/QueryBuilder.pm
Created attachment 125433 [details] [review] Bug 28484: ES clean title in biblio detail Test plan: - Create a biblio with title like "osteuropa:" or "osteuropa!" - Go the this biblio detail pages (cgi-bin/koha/catalogue/detail.pl) => Error - Apply bug 28316 and this one - test again Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 125434 [details] [review] Bug 28484: (QA follow-up) Add fix on OPAC Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 125435 [details] [review] Bug 28484: (QA follow-up) POD fix Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Pushed to master for 21.11, thanks to everybody involved!
Pushed to 21.05.x for 21.05.05