From 7c34b24b2301569f765f60afb867846f3ff5983e Mon Sep 17 00:00:00 2001
From: Alex Arnaud <alex.arnaud@biblibre.com>
Date: Fri, 22 Dec 2017 14:18:44 +0000
Subject: [PATCH] Bug 19873: Ability to search on 0 value
Test plan:
- create a st-numeric index in zebra conf related to
a numeric field
i.e:
yourindex 1=yourindex 4=109
- fill a field with 0 in a biblio,
- reindex your biblios,
- search yourindex=0,
- should not work,
- apply this patch,
- test again,
- should work
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
---
C4/Search.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/C4/Search.pm b/C4/Search.pm
index 172321292d..99953b2678 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -1532,7 +1532,7 @@ sub buildQuery {
for ( my $i = 0 ; $i <= @operands ; $i++ ) {
# COMBINE OPERANDS, INDEXES AND OPERATORS
- if ( $operands[$i] ) {
+ if ( $operands[$i] ne '' ) {
$operands[$i]=~s/^\s+//;
# A flag to determine whether or not to add the index to the query
@@ -1677,7 +1677,7 @@ sub buildQuery {
query_desc => $query_desc,
operator => ($operators[ $i - 1 ]) ? $operators[ $i - 1 ] : '',
parsed_operand => $operand,
- original_operand => ($operands[$i]) ? $operands[$i] : '',
+ original_operand => ($operands[$i] ne '') ? $operands[$i] : '',
index => $index,
index_plus => $index_plus,
indexes_set => $indexes_set,
--
2.14.2