Bug 22874: Use false instead of 0 value for limiting on availability

Test plan

  - Set up a elasticsearch 6 instance to work with Koha,
  - you may need to make koha works with ES 6 (see bug 20589),
  - make a search and limit it to available items only,
  => no result

  - Apply this patch,
  - make a search and limit it to available items only,
  - you should get some results

  - Do the same with ES 5.x

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Alex Arnaud 2019-05-09 12:39:51 +00:00 committed by Martin Renvoize
parent c474b16456
commit 7df185c783
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
2 changed files with 3 additions and 3 deletions

View File

@ -965,7 +965,7 @@ sub _fix_limit_special_cases {
push @new_lim, "copydate:$date";
}
elsif ( $l =~ /^available$/ ) {
push @new_lim, 'onloan:0';
push @new_lim, 'onloan:false';
}
else {
push @new_lim, $l;

View File

@ -346,10 +346,10 @@ subtest 'build_query tests' => sub {
"query of just '*' is unaltered when QueryAutoTruncate is enabled"
);
( undef, $query ) = $qb->build_query_compat( undef, ['"donald duck"'] );
( undef, $query ) = $qb->build_query_compat( undef, ['"donald duck"'], undef, ['available'] );
is(
$query->{query}{query_string}{query},
'("donald duck")',
'("donald duck") AND onloan:false',
"query with quotes is unaltered when QueryAutoTruncate is enabled"
);