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

            Bug ID: 39079
           Summary: Matchpoints with multiple fields require all fields to
                    match under Elasticsearch
 Change sponsored?: ---
           Product: Koha
           Version: Main
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Searching - Elasticsearch
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]

In zebra when matching an incoming file to existing records, we use 'OR' to
combine the fields

In elasticsearch we are combining multiple fields with 'AND' as a 'must' search

This means an incoming record with two control numbers will not match an
existing record with only one


The generated queries are like:
2025-02-10T14:59:07 zebrasrv(46) [request] Search authorities OK 0 1 1+0 RPN
@attrset Bib-1 @or @attr 1=Local-Number @attr 4=109 @attr 7=1 0 @or @or @attr
6=3 @attr 5=100 @attr 4=1 @attr 1=other-control-number (DE-588)4179998-7 @attr
6=3 @attr 5=100 @attr 4=1 @attr 1=other-control-number (DE-627)104628669 @attr
6=3 @attr 5=100 @attr 4=1 @attr 1=other-control-number (DE-576)209995106


versus
                       'bool' => {
                                   'must' => [
                                               {
                                                 'term' => {
                                                            
'other-control-number.ci_raw' => '(DE-588)4179998-7'
                                                           }
                                               },
                                               {
                                                 'term' => {
                                                            
'other-control-number.ci_raw' => '(DE-627)104628669'
                                                           }
                                               },
                                               {
                                                 'term' => {
                                                            
'other-control-number.ci_raw' => '(DE-576)209995106'
                                                           }
                                               }
                                             ]
                                 }
                     }



This is due to this bit of code:
ElasticSearch/QueryBuilder:
 469     # Merge the query parts appropriately
 470     # 'should' behaves like 'or'
 471     # 'must' behaves like 'and'
 472     # Zebra behaviour seem to match must so using that here
 473     my $elastic_query = {};
 474     $elastic_query->{bool}->{must} = \@query_parts;


We need to respect the and_or passed into build_auth_query_compat, but
currently:
 514 =item and_or
 515 
 516 Totally ignored. It is never used in
L<C4::AuthoritiesMarc::SearchAuthorities>.

-- 
You are receiving this mail because:
You are the assignee for the bug.
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