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

Kevin Carnes kevin.carnes at ub.lu.se
Fri Feb 18 15:33:48 CET 2022


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20220218/f6ff600e/attachment.htm>


More information about the Koha-devel mailing list