View | Details | Raw Unified | Return to bug 19905
Collapse All | Expand All

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-9 / +1 lines)
Lines 801-814 sub _truncate_terms { Link Here
801
    my @tokens = split /((?:[\w-]+:)?"[^"]+"|\s+)/, $query;
801
    my @tokens = split /((?:[\w-]+:)?"[^"]+"|\s+)/, $query;
802
802
803
    # Filter out empty tokens
803
    # Filter out empty tokens
804
    my @words = grep { $_ !~ /^\s*$/ } @tokens;
804
    my @terms = grep { $_ !~ /^\s*$/ } @tokens;
805
806
    # Append '*' to words if needed, ie. if it's not surrounded by quotes, not
807
    # terminated by '*' and not a keyword
808
    my @terms = map {
809
        my $w = $_;
810
        (/"$/ or /\*$/ or grep {lc($w) eq $_} qw/and or not/) ? $_ : "$_*";
811
    } @words;
812
805
813
    return join ' ', @terms;
806
    return join ' ', @terms;
814
}
807
}
815
- 

Return to bug 19905