analyzer => {
analyser_phrase => {
tokenizer => 'keyword',
- filter => 'lowercase',
+ filter => ['lowercase'],
},
analyser_standard => {
tokenizer => 'standard',
- filter => 'lowercase',
+ filter => ['lowercase'],
}
- }
+ },
}
}
};
include_in_all => "false",
type => "string",
},
+ '_all.phrase' => {
+ search_analyzer => "analyser_phrase",
+ index_analyzer => "analyser_phrase",
+ type => "string",
+ },
}
}
};
phrase => {
search_analyzer => "analyser_phrase",
index_analyzer => "analyser_phrase",
- type => "string"
+ type => "string",
+ copy_to => "_all.phrase",
},
},
};
if ($op eq 'is' || $op eq '=') {
# look for something that matches completely
# note, '=' is about numerical vals. May need special handling.
- push @filter_parts, { term => { $wh => $val }};
+ # _allphrase is a special field that only groups the exact
+ # matches. Also, we lowercase our search because the ES
+ # index lowercases its values.
+ push @filter_parts, { term => { "$wh.phrase" => lc $val }};
} elsif ($op eq 'exact') {
# left and right truncation, otherwise an exact phrase
push @query_parts, { match_phrase => { $wh => $val }};
# 'should' behaves like 'or', if we want 'and', use 'must'
my $query_part = { bool => { should => \@query_parts } };
my $filter_part = { bool => { should => \@filter_parts }};
+ # extract the sort stuff
+ my %sort = ( sort => [ $search->{sort} ] ) if exists $search->{sort};
my $query;
if (@filter_parts) {
$query = { query => { filtered => { filter => $filter_part, query => $query_part }}};
for ( my $i = 0 ; $i < @$value ; $i++ ) {
push @searches,
{
- where => $marclist->[$i],
+ where => $koha_to_index_name{$marclist->[$i]},
operator => $operator->[$i],
value => $value->[$i],
};
: undef;
if ($sort_field) {
my $sort_order = ( $orderby =~ /Asc$/ ) ? 'asc' : 'desc';
- %sort = ( $orderby => $sort_order, );
+ %sort = ( $sort_field => $sort_order, );
}
my %search = (
searches => \@searches,
my $params = $self->get_elasticsearch_params();
$self->store(
- Catmandu::Store::ElasticSearch->new( %$params, trace_calls => 1, ) )
+ Catmandu::Store::ElasticSearch->new( %$params, trace_calls => 0, ) )
unless $self->store;
my $searcher = $self->store->bag->searcher(query => $query);