Browse Source

Bug 19580: Exclude period as splitting character for autotrunction

To test:
0 - Apply Unit test patch only
1 - prove t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t
2 - Should fail
3 - Apply this patch
4 - prove t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t
5 - should pass
6 - search for 'Local-number.raw:"4"' (or a vlid biblionumber)
7 - should get expected result

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
18.05.x
Nick Clemens 7 years ago
committed by Jonathan Druart
parent
commit
834b8c749b
  1. 4
      Koha/SearchEngine/Elasticsearch/QueryBuilder.pm

4
Koha/SearchEngine/Elasticsearch/QueryBuilder.pm

@ -603,7 +603,7 @@ will have to wait for a real query parser.
sub _convert_index_strings_freeform {
my ( $self, $search ) = @_;
while ( my ( $zeb, $es ) = each %index_field_convert ) {
$search =~ s/\b$zeb(?:,[\w-]*)?:/$es:/g;
$search =~ s/\b$zeb(?:,[\w\-]*)?:/$es:/g;
}
return $search;
}
@ -798,7 +798,7 @@ sub _truncate_terms {
# '"donald duck" title:"the mouse" and peter" get split into
# ['', '"donald duck"', '', ' ', '', 'title:"the mouse"', '', ' ', 'and', ' ', 'pete']
my @tokens = split /((?:[\w-]+:)?"[^"]+"|\s+)/, $query;
my @tokens = split /((?:[\w\-.]+:)?"[^"]+"|\s+)/, $query;
# Filter out empty tokens
my @words = grep { $_ !~ /^\s*$/ } @tokens;

Loading…
Cancel
Save