|
Lines 35-40
use Koha::ItemTypes;
Link Here
|
| 35 |
|
35 |
|
| 36 |
use Koha::SearchEngine; |
36 |
use Koha::SearchEngine; |
| 37 |
use Koha::SearchEngine::Search; |
37 |
use Koha::SearchEngine::Search; |
|
|
38 |
use Koha::SearchEngine::QueryBuilder; |
| 38 |
|
39 |
|
| 39 |
sub plugin_parameters { |
40 |
sub plugin_parameters { |
| 40 |
my ( $dbh, $record, $tagslib, $i ) = @_; |
41 |
my ( $dbh, $record, $tagslib, $i ) = @_; |
|
Lines 341-348
sub plugin {
Link Here
|
| 341 |
my $orderby; |
342 |
my $orderby; |
| 342 |
my $op = 'AND'; |
343 |
my $op = 'AND'; |
| 343 |
$search = 'kw:'.$search." $op mc-itemtype:".$itype if $itype; |
344 |
$search = 'kw:'.$search." $op mc-itemtype:".$itype if $itype; |
|
|
345 |
my $limits = $itype ? ["mc-itype,phr:$itype"] : []; |
| 346 |
|
| 347 |
my $builder = Koha::SearchEngine::QueryBuilder->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); |
| 344 |
my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); |
348 |
my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); |
| 345 |
my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat($search, $startfrom * $resultsperpage, $resultsperpage ); |
349 |
|
|
|
350 |
my ($builderror, $es_query)= $builder->build_query_compat( undef, [$search], ['kw'], $limits, ['relevance']); |
| 351 |
my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat($es_query, $startfrom * $resultsperpage, $resultsperpage ); |
| 346 |
if (defined $errors ) { |
352 |
if (defined $errors ) { |
| 347 |
$results = []; |
353 |
$results = []; |
| 348 |
} |
354 |
} |
|
Lines 439-445
sub plugin {
Link Here
|
| 439 |
if ( $total_hits < $from + $resultsperpage ) { |
445 |
if ( $total_hits < $from + $resultsperpage ) { |
| 440 |
$to = $total_hits; |
446 |
$to = $total_hits; |
| 441 |
}else{ |
447 |
}else{ |
| 442 |
$to = $from + $resultsperpage ; |
448 |
$to = $startfrom * $resultsperpage + $resultsperpage ; |
| 443 |
} |
449 |
} |
| 444 |
# my $link="/cgi-bin/koha/cataloguing/value_builder/unimarc4XX.pl?op=do_search&q=$search_desc&resultsperpage=$resultsperpage&startfrom=$startfrom&search=$search"; |
450 |
# my $link="/cgi-bin/koha/cataloguing/value_builder/unimarc4XX.pl?op=do_search&q=$search_desc&resultsperpage=$resultsperpage&startfrom=$startfrom&search=$search"; |
| 445 |
# foreach my $sort (@sort_by){ |
451 |
# foreach my $sort (@sort_by){ |
| 446 |
- |
|
|