[Koha-bugs] [Bug 31023] New: Cannot create new GENRE/FORM authorities when QueryRegexEscapeOptions set to 'Unescape escaped'

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Jun 23 12:08:29 CEST 2022


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

            Bug ID: 31023
           Summary: Cannot create new GENRE/FORM authorities when
                    QueryRegexEscapeOptions  set to 'Unescape escaped'
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Searching - Elasticsearch
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: nick at bywatersolutions.com

Bug 24286 and bug 24264 added some escaping for the forward slash in this
authtype, however, when we unescape escaped characters for regex, it appears we
break the escaping in FindDuplicateAuthority

To test:
0 - Have Koha using Elasticsearch
1 - Set  QueryRegexEscapeOptions to 'unescape escaped'
2 - Attempt to add a new 'GENRE/FORM' authority record
3 - On save you get a 500 error
Unable to understand your search query, please rephrase and try again.
 at /kohadevbox/koha/Koha/SearchEngine/Elasticsearch/Search.pm line 102

[2022/06/23 10:07:02] [WARN] [Request] ** [http://es:9200]-[400]
[query_shard_exception] Failed to parse query [(authtype:GENRE/FORM* AND
heading:"ddddd")], with:
{"index":"koha_kohadev_authorities","index_uuid":"I00T6jgPTKynx5kKc8heNQ"},
called from sub Search::Elasticsearch::Role::Client::Direct::__ANON__ at
/kohadevbox/koha/Koha/SearchEngine/Elasticsearch/Search.pm line 95. With vars:
{'request' => {'body' => {'query' => {'query_string' => {'query' =>
'(authtype:GENRE/FORM* AND heading:"ddddd")','analyze_wildcard' => bless(
do{\(my $o = 1)}, 'JSON::PP::Boolean' ),'default_operator' => 'AND','fuzziness'
=> 'auto','type' => 'cross_fields','lenient' =>
$VAR1->{'request'}{'body'}{'query'}{'query_string'}{'analyze_wildcard'},'fields'
=>
['lc-card-number','local-number','record-source','personal-name','meeting-name','personal-name-see-also-from','see-from','authtype','meeting-name-see-also-from','match-heading-see-from','heading-use-main-or-added-entry','subject-heading-thesaurus','match','heading-use-series-added-entry','kind-of-record','see-also-from','heading','corporate-name-see-also-from','descriptive-cataloging-rules','meeting-name-see-from','corporate-name-see-from','heading-use-subject-added-entry','personal-name-see-from','personal-name-heading','meeting-name-heading','heading-main']}},'size'
=> 1,'aggregations' => {'su-geo' => {'terms' => {'size' => '20','field' =>
'su-geo__facet'}},'location' => {'terms' => {'size' => '20','field' =>
'location__facet'}},'author' => {'terms' => {'field' => 'author__facet','size'
=> '20'}},'ln' => {'terms' => {'field' => 'ln__facet','size' =>
'20'}},'holdingbranch' => {'terms' => {'size' => '20','field' =>
'holdingbranch__facet'}},'subject' => {'terms' => {'field' =>
'subject__facet','size' => '20'}},'itype' => {'terms' => {'field' =>
'itype__facet','size' => '20'}},'title-series' => {'terms' => {'field' =>
'title-series__facet','size' => '20'}},'ccode' => {'terms' => {'field' =>
'ccode__facet','size' => '20'}}},'from' => 0},'mime_type' =>
'application/json','serialize' => 'std','method' => 'GET','ignore' => [],'path'
=> '/koha_kohadev_authorities/_search','qs' => {'track_total_hits' =>
'true'}},'status_code' => 400,'body' => {'error' => {'reason' => 'all shards
failed','phase' => 'query','type' =>
'search_phase_execution_exception','grouped' => bless( do{\(my $o = 1)},
'JSON::PP::Boolean' ),'failed_shards' => [{'node' =>
'8aathbKCRVmwFPakemaNEA','index' => 'koha_kohadev_authorities','reason' =>
{'reason' => 'Failed to parse query [(authtype:GENRE/FORM* AND
heading:"ddddd")]','index' => 'koha_kohadev_authorities','type' =>
'query_shard_exception','caused_by' => {'type' => 'parse_exception','caused_by'
=> {'type' => 'token_mgr_error','reason' => 'Lexical error at line 1, column
43.  Encountered: <EOF> after : "/FORM* AND heading:\\"ddddd\\")"'},'reason' =>
'Cannot parse \'(authtype:GENRE/FORM* AND heading:"ddddd")\': Lexical error at
line 1, column 43.  Encountered: <EOF> after : "/FORM* AND
heading:\\"ddddd\\")"'},'index_uuid' => 'I00T6jgPTKynx5kKc8heNQ'},'shard' =>
0}],'root_cause' => [{'index' => 'koha_kohadev_authorities','reason' => 'Failed
to parse query [(authtype:GENRE/FORM* AND heading:"ddddd")]','index_uuid' =>
'I00T6jgPTKynx5kKc8heNQ','type' => 'query_shard_exception'}]},'status' => 400}}

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list