Bugzilla – Attachment 105472 Details for
Bug 24555
POC Elasticsearch - Use boolean queries instead of full text queries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24555: Fix search limits
Bug-24555-Fix-search-limits.patch (text/plain), 2.18 KB, created by
Julian Maurice
on 2020-06-01 12:04:52 UTC
(
hide
)
Description:
Bug 24555: Fix search limits
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2020-06-01 12:04:52 UTC
Size:
2.18 KB
patch
obsolete
>From f3effe70f00ebffa5301c42ea6390a77d46c5249 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 1 Jun 2020 15:21:56 +0400 >Subject: [PATCH] Bug 24555: Fix search limits > >--- > .../Elasticsearch/QueryBuilder.pm | 19 ++++++++++--------- > 1 file changed, 10 insertions(+), 9 deletions(-) > >diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >index 1efadf02c1..1a092d8b07 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -153,14 +153,13 @@ sub build_query_compat { > my $query; > my $query_str = ''; > my $search_param_query_str = ''; >- my $limits = (); >+ my $limits = $self->_fix_limit_special_cases($orig_limits); > if ( $scan ) { > ($query, $query_str) = $self->_build_scan_query( $operands, $indexes ); > $search_param_query_str = $query_str; > } else { > my @sort_params = $self->_convert_sort_fields(@$sort_by); > my @index_params = $self->_convert_index_fields(@$indexes); >- my $limits = $self->_fix_limit_special_cases($orig_limits); > if ( $params->{suppress} ) { push @$limits, "suppress:false"; } > # Merge the indexes in with the search terms and the operands so that > # each search thing is a handy unit. >@@ -796,7 +795,8 @@ Transform limit strings to Elasticsearch filters > > sub _build_limit_filters { > my ( $self, $limits ) = @_; >- my @res; >+ >+ my %facets; > foreach my $s (@$limits) { > next if $s eq ''; > my ( $field, $term ) = $s =~ /^\s*([\w,-]*?):(.*)/; >@@ -804,14 +804,15 @@ sub _build_limit_filters { > > my ($conv) = $self->_convert_index_fields($field); > my $facet_name = $conv->{field} . '__facet'; >- $facet_name =~ s/^mc-//; >- push @res, { >- term => { >- $facet_name => $term >- } >- }; >+ $facets{$facet_name} //= []; >+ push @{ $facets{$facet_name} }, $term; > } > >+ my @res = map { >+ my $name = ($_ =~ s/^mc-//r); >+ { terms => { $name => $facets{$_} } } >+ } sort keys %facets; >+ > return \@res; > } > >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24555
:
98242
|
98243
|
98247
|
98248
|
104419
|
104422
|
105061
|
105470
|
105471
| 105472 |
105744