Porting SimpleSearch return changes to all code calling it.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
743fbda69d
commit
9b47b82a77
|
|
@ -802,7 +802,7 @@ sub FindDuplicateAuthority {
|
|||
# build a request for SearchAuthorities
|
||||
my $query='at='.$authtypecode.' ';
|
||||
map {$query.= " and he=\"".$_->[1]."\"" if ($_->[0]=~/[A-z]/)} $record->field($auth_tag_to_report)->subfields() if $record->field($auth_tag_to_report);
|
||||
my ($error,$results)=SimpleSearch( $query, 0, 1, [ "authorityserver" ] );
|
||||
my ($error, $results, $total_hits)=SimpleSearch( $query, 0, 1, [ "authorityserver" ] );
|
||||
# there is at least 1 result => return the 1st one
|
||||
if (@$results>0) {
|
||||
my $marcrecord = MARC::File::USMARC::decode($results->[0]);
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ sub authorities {
|
|||
my $self = shift;
|
||||
my $query = qq(Match-heading,ext="$self->{'search_form'}");
|
||||
$query .= $self->_query_limiters();
|
||||
my $results = SimpleSearch( $query, undef, undef, [ "authorityserver" ] );
|
||||
my ($error, $results, $total_hits) = SimpleSearch( $query, undef, undef, [ "authorityserver" ] );
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ sub preferred_authorities {
|
|||
my $self = shift;
|
||||
my $query = "Match-heading-see-from,ext='$self->{'search_form'}'";
|
||||
$query .= $self->_query_limiters();
|
||||
my $results = SimpleSearch( $query, undef, undef, [ "authorityserver" ] );
|
||||
my ($error, $results, $total_hits) = SimpleSearch( $query, undef, undef, [ "authorityserver" ] );
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -661,7 +661,7 @@ sub get_matches {
|
|||
# build query
|
||||
my $query = join(" or ", map { "$matchpoint->{'index'}=$_" } @source_keys);
|
||||
# FIXME only searching biblio index at the moment
|
||||
my ($error, $searchresults) = SimpleSearch($query);
|
||||
my ($error, $searchresults, $total_hits) = SimpleSearch($query);
|
||||
|
||||
warn "search failed ($query) $error" if $error;
|
||||
foreach my $matched (@$searchresults) {
|
||||
|
|
|
|||
|
|
@ -695,7 +695,7 @@ AND (authtypecode IS NOT NULL AND authtypecode<>\"\")|);
|
|||
# Search if there is any authorities to link to.
|
||||
my $query='at='.$data->{authtypecode}.' ';
|
||||
map {$query.= ' and he,ext="'.$_->[1].'"' if ($_->[0]=~/[A-z]/)} $field->subfields();
|
||||
my ($error,$results)=SimpleSearch( $query, undef, undef, [ "authorityserver" ] );
|
||||
my ($error, $results, $total_hits)=SimpleSearch( $query, undef, undef, [ "authorityserver" ] );
|
||||
# there is only 1 result
|
||||
if ( $error ) {
|
||||
warn "BIBLIOADDSAUTHORITIES: $error";
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ foreach my $thisframeworkcode ( keys %$frameworks ) {
|
|||
if ($query) {
|
||||
|
||||
# find results
|
||||
my ( $error, $marcresults ) = SimpleSearch($query);
|
||||
my ( $error, $marcresults, $total_hits ) = SimpleSearch($query);
|
||||
|
||||
if ( defined $error ) {
|
||||
$template->param( error => $error );
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ sub plugin {
|
|||
my $startfrom = $query->param('startfrom');
|
||||
my $resultsperpage = $query->param('resultsperpage');
|
||||
my $orderby;
|
||||
my ( $errors, $results ) = SimpleSearch($search);
|
||||
my ( $errors, $results, $total_hits ) = SimpleSearch($search);
|
||||
my $total = scalar(@$results);
|
||||
$resultsperpage = 20 unless $resultsperpage;
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ my $dbh = C4::Context->dbh;
|
|||
|
||||
my $startfrom = $query->param('startfrom') || 0;
|
||||
my ( $template, $loggedinuser, $cookie );
|
||||
my $total_hits;
|
||||
my (@marclist,@and_or,@excluding,@operator,@value,$orderby,@tags,$results,$total,$error,$marcresults);
|
||||
# XXX should this be maxItemsInSearchResults or numSearchResults preference instead of 19?
|
||||
my $resultsperpage = $query->param('resultsperpage') || 19;
|
||||
|
|
@ -74,8 +75,7 @@ if ( $op eq "do_search" ) {
|
|||
#catalogsearch( $dbh, \@tags, \@and_or, \@excluding, \@operator, \@value,
|
||||
# $startfrom * $resultsperpage,
|
||||
# $resultsperpage, $orderby );
|
||||
( $error, $marcresults, $total ) = SimpleSearch( $marclist[0], $startfrom, $resultsperpage );
|
||||
warn "\$total=$total";
|
||||
( $error, $marcresults, $total_hits ) = SimpleSearch( $marclist[0], $startfrom, $resultsperpage );
|
||||
if ($marcresults) {
|
||||
$show_results = scalar @$marcresults;
|
||||
} else {
|
||||
|
|
@ -150,6 +150,7 @@ if ( $show_results ) {
|
|||
}
|
||||
|
||||
my @numbers = ();
|
||||
$total = $total_hits;
|
||||
if ( $total > $resultsperpage ) {
|
||||
for ( my $i = 1 ; $i < $total / $resultsperpage + 1 ; $i++ ) {
|
||||
if ( $i < 16 ) {
|
||||
|
|
@ -183,7 +184,7 @@ if ( $show_results ) {
|
|||
startfromnext => $startfrom + min( $resultsperpage, scalar @results ),
|
||||
startfromprev => max( $startfrom - $resultsperpage, 0 ),
|
||||
searchdata => \@field_data,
|
||||
total => $total,
|
||||
total => $total_hits,
|
||||
from => $startfrom + 1,
|
||||
to => $startfrom + min( $resultsperpage, scalar @results ),
|
||||
numbers => \@numbers,
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ if ($RDF_update_needed) {
|
|||
);
|
||||
|
||||
warn "fetching $size results for $query";
|
||||
my ( $error, $marcresults ) = SimpleSearch( $query, 0, $size );
|
||||
my ( $error, $marcresults, $total_hits ) = SimpleSearch( $query, 0, $size );
|
||||
|
||||
my $hits = scalar @$marcresults;
|
||||
my @results;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ if ($op eq "do_search" && $query) {
|
|||
$resultsperpage= $input->param('resultsperpage');
|
||||
$resultsperpage = 19 if(!defined $resultsperpage);
|
||||
|
||||
my ($error,$marcrecords) = SimpleSearch($query);
|
||||
my ($error, $marcrecords, $total_hits) = SimpleSearch($query);
|
||||
my $total = scalar @$marcrecords;
|
||||
|
||||
if (defined $error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue