https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11175

--- Comment #522 from David Cook <[email protected]> ---
(In reply to Martin Renvoize from comment #520)
> Nice one.. faith in community restored.. sorry for being grumpy

Now I'm feeling grumpy reading through these patches again 😅.

(In reply to Marcel de Rooy from comment #499)
> Created attachment 126883 [details] [review]
> Bug 11175: (QA follow-up) Move get_component_part_query

This patch removed the double-quotes from the search terms which causes this to
break when using Zebra if you're using a title like "MyTitle: MySubtitle" since
the following query is a syntax error:

Host-item=(MyTitle= MySubtitle)

It should be:

Host-item=("MyTitle= MySubtitle")

According to
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax,
it looks like Elasticsearch works the same way. 

Single words don't need to be quoted but terms consisting of more than one word
do.

Regarding Zebra, we actually have the tools to easily catch this in our unit
tests:

#!/usr/bin/perl
use strict;
use warnings;
use C4::Context;
use ZOOM;
my $Zconn = C4::Context->Zconn;
eval {
    my $bad = ZOOM::Query::CCL2RPN->new("Host-item=(MyTitle=
MySubtitle)",$Zconn);
};
warn $@ if $@;
my $good = ZOOM::Query::CCL2RPN->new('Host-item=("MyTitle=
MySubtitle")',$Zconn);

That code will output the following error:

ZOOM error 10014 "CCL parsing error" (addinfo: "Unknown qualifier") from
diag-set 'ZOOM' at test.pl line 10.

It looks like
https://metacpan.org/pod/Search::Elasticsearch::Compat::QueryParser#check()
could provide similar error checking for Elasticsearch. 

If we just syntax checked our query strings, we'd run into far fewer
problems... 

Anyway, I'll open a new bug report for this one. I just figured it would be
good for folk to hear about it.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to