[Koha-devel] Elasticsearch query with suppress:false not returning expected results

Philippe Blouin philippe.blouin at inlibro.com
Wed Feb 23 21:52:33 CET 2022


Hi Kevin,

You were right, one of the indexed record was "hidden" so the second 
result was correct (24 Acceptabilité + 1 Expropriation).  I skipped it 
thinking the 25 was actually just 25 "acceptabilité" returned.


Now, writting the query differently does it.

  *
    (title:acceptabilité) OR (title:expropriation)
    ANDsuppress:false        1 résultat
  *
    ((title:acceptabilité) OR (title:expropriation))
    ANDsuppress:false      25 résultats

But it's not what Koha is doing.  Can I interpret that this is a bug I 
should open and provide a fix for ?


Thanks a lot,

Philippe



On 2022-02-18 09:33, Kevin Carnes wrote:
> Hi Philippe,
>
> Your second query appears to be correct. Is it possible that one of 
> the "expropriation" records is suppressed in the the OPAC? Try 
> searching for "title:expropriation AND suppress:true" (without 
> QueryAutoTruncate).
>
> It's possible to automatically add parentheses to both the query and 
> the limits by editing the 
> Koha/SearchEngine/Elasticsearch/QueryBuilder.pm file. After 
> "$search_param_query_str = join( ' ', 
> $self->_create_query_string(@search_params) );" add:
>         if ($search_param_query_str) {
>             $search_param_query_str = "($search_param_query_str)";
>         }
>         my $search_param_limits_str = $self->_join_queries( 
> $self->_convert_index_strings(@$limits) );
>         if ($search_param_limits_str) {
>             $search_param_limits_str = "($search_param_limits_str)";
>         }
>
> And then change the "$query_str" to:
>         $query_str = join( ' AND ',
>             $search_param_query_str || (),
>             $search_param_limits_str || () );
>
> Hopefully that will produce the correct results.
>
> Regards,
> Kevin
>
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha-community.org
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website :https://www.koha-community.org/
> git :https://git.koha-community.org/
> bugs :https://bugs.koha-community.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20220223/bebeda42/attachment.htm>


More information about the Koha-devel mailing list