Lines 36-41
use Koha::ItemTypes;
Link Here
|
36 |
|
36 |
|
37 |
use Koha::SearchEngine; |
37 |
use Koha::SearchEngine; |
38 |
use Koha::SearchEngine::Search; |
38 |
use Koha::SearchEngine::Search; |
|
|
39 |
use Koha::SearchEngine::QueryBuilder; |
39 |
|
40 |
|
40 |
sub plugin_parameters { |
41 |
sub plugin_parameters { |
41 |
my ( $dbh, $record, $tagslib, $i, $tabloop ) = @_; |
42 |
my ( $dbh, $record, $tagslib, $i, $tabloop ) = @_; |
Lines 358-367
sub plugin {
Link Here
|
358 |
my $startfrom = $query->param('startfrom'); |
359 |
my $startfrom = $query->param('startfrom'); |
359 |
my $resultsperpage = $query->param('resultsperpage') || 20; |
360 |
my $resultsperpage = $query->param('resultsperpage') || 20; |
360 |
my $orderby; |
361 |
my $orderby; |
361 |
my $op = 'and'; |
362 |
my $limits = $itype ? ["mc-itype,phr:$itype"] : []; |
362 |
$search = 'kw:'.$search." $op mc-itemtype:".$itype if $itype; |
363 |
|
|
|
364 |
my $builder = Koha::SearchEngine::QueryBuilder->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); |
363 |
my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); |
365 |
my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); |
364 |
my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat($search, $startfrom * $resultsperpage, $resultsperpage ); |
366 |
|
|
|
367 |
my ($builderror, $es_query)= $builder->build_query_compat( undef, [$search], ['kw'], $limits, ['relevance']); |
368 |
my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat($es_query, $startfrom * $resultsperpage, $resultsperpage ); |
365 |
if (defined $errors ) { |
369 |
if (defined $errors ) { |
366 |
$results = []; |
370 |
$results = []; |
367 |
} |
371 |
} |
Lines 459-465
sub plugin {
Link Here
|
459 |
if ( $total_hits < $from + $resultsperpage ) { |
463 |
if ( $total_hits < $from + $resultsperpage ) { |
460 |
$to = $total_hits; |
464 |
$to = $total_hits; |
461 |
}else{ |
465 |
}else{ |
462 |
$to = $from + $resultsperpage ; |
466 |
$to = $startfrom * $resultsperpage + $resultsperpage ; |
463 |
} |
467 |
} |
464 |
my $defaultview = |
468 |
my $defaultview = |
465 |
'BiblioDefaultView' . C4::Context->preference('BiblioDefaultView'); |
469 |
'BiblioDefaultView' . C4::Context->preference('BiblioDefaultView'); |
466 |
- |
|
|