Lines 686-711
sub get_matches {
Link Here
|
686 |
my $total_hits; |
686 |
my $total_hits; |
687 |
if ( $self->{'record_type'} eq 'biblio' ) { |
687 |
if ( $self->{'record_type'} eq 'biblio' ) { |
688 |
|
688 |
|
689 |
my $phr = |
|
|
690 |
( C4::Context->preference('AggressiveMatchOnISBN') || C4::Context->preference('AggressiveMatchOnISSN') ) |
691 |
? ',phr' |
692 |
: q{}; |
693 |
$query = join( |
694 |
" OR ", |
695 |
map { "$matchpoint->{'index'}$phr=\"$_\"" } @source_keys |
696 |
); |
697 |
|
698 |
#NOTE: double-quote the values so you don't get a "Embedded truncation not supported" error when a term has a ? in it. |
699 |
|
700 |
# Use state variables to avoid recreating the objects every time. |
689 |
# Use state variables to avoid recreating the objects every time. |
701 |
# With Elasticsearch this also avoids creating a massive amount of |
690 |
# With Elasticsearch this also avoids creating a massive amount of |
702 |
# ES connectors that would eventually run out of file descriptors. |
691 |
# ES connectors that would eventually run out of file descriptors. |
703 |
state $query_builder = |
692 |
state $query_builder = |
704 |
Koha::SearchEngine::QueryBuilder->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); |
693 |
Koha::SearchEngine::QueryBuilder->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); |
705 |
( undef, $query ) = $query_builder->build_query_compat( |
694 |
$query = $query_builder->build_biblio_match_query_compat( |
706 |
undef, [$query], undef, undef, undef, undef, undef, |
695 |
{ matchpoint => $matchpoint, source_keys => \@source_keys } ); |
707 |
{ skip_facets => 1 } |
|
|
708 |
); |
709 |
state $searcher = Koha::SearchEngine::Search->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); |
696 |
state $searcher = Koha::SearchEngine::Search->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); |
710 |
( $error, $searchresults, $total_hits ) = |
697 |
( $error, $searchresults, $total_hits ) = |
711 |
$searcher->simple_search_compat( $query, 0, $max_matches, undef, skip_normalize => 1 ); |
698 |
$searcher->simple_search_compat( $query, 0, $max_matches, undef, skip_normalize => 1 ); |