Skip to content

Commit 8194419

Browse files
jajmtomascohen
authored andcommitted
Bug 33353: Add compatibility with Search::Elasticsearch 8.0
For some reasons, with Search::Elasticsearch 8.0 JSON::true is interpreted as 1 and Elasticsearch will always respond that it found "at least 1 record". Something like this: { total => { value => 1, relation => 'gte' } } Replacing JSON::true by \1 works with every version of Search::Elasticsearch I tested (6.80, 7.717, 8.0) Also worth noting: Search::Elasticsearch will stop being supported by Elastic elastic/elasticsearch-perl#220 We might need to find an alternative for future versions of Elasticsearch Signed-off-by: Victor Grousset/tuxayo <[email protected]> Signed-off-by: Philip Orr <[email protected]> Signed-off-by: Tomas Cohen Arazi <[email protected]>
1 parent 24aab6b commit 8194419

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Koha/SearchEngine/Elasticsearch/Search.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ sub search {
9494
my $results = eval {
9595
$elasticsearch->search(
9696
index => $self->index_name,
97-
track_total_hits => JSON::true,
97+
track_total_hits => \1,
9898
body => $query
9999
);
100100
};
@@ -124,7 +124,7 @@ sub count {
124124
# and just return number of hits
125125
my $result = $elasticsearch->search(
126126
index => $self->index_name,
127-
track_total_hits => JSON::true,
127+
track_total_hits => \1,
128128
body => $query
129129
);
130130

0 commit comments

Comments
 (0)