|
Lines 780-785
if ($query_desc || $limit_desc) {
Link Here
|
| 780 |
$template->param(searchdesc => 1); |
780 |
$template->param(searchdesc => 1); |
| 781 |
} |
781 |
} |
| 782 |
|
782 |
|
|
|
783 |
# III. LOOK FOR SEARCH SUGGESTIONS IN AUTHORITIES |
| 784 |
|
| 785 |
if (C4::Context->preference('OPACSearchSuggestions')) { |
| 786 |
# Search for authorities that could better represent the search query |
| 787 |
my @suggestions; |
| 788 |
|
| 789 |
# Set the index of all operands for Match-heading-see-from search |
| 790 |
my @indexes_match; |
| 791 |
foreach(@operands){push(@indexes_match, 'Match-heading-see-from,ext');} |
| 792 |
|
| 793 |
# Build the query and do a simple search with it |
| 794 |
($error, $query) = buildQuery(\@operators,\@operands,\@indexes_match,0,0,0,$lang); |
| 795 |
my ($error2, $results, $total_hits) = SimpleSearch( $query, undef, undef, [ "authorityserver" ] ); |
| 796 |
|
| 797 |
# Add the main Heading of each search result and add it to the suggestion list |
| 798 |
foreach my $r (@$results) |
| 799 |
{ |
| 800 |
my $record = MARC::Record->new_from_usmarc( $r ); |
| 801 |
my @subfields = ($record->field('1..'))[0]->subfields(); |
| 802 |
|
| 803 |
# Fuse the subfields |
| 804 |
my $suggestionterm = ''; |
| 805 |
foreach(@subfields){$suggestionterm .= $_->[1] . ', ';} |
| 806 |
$suggestionterm =~ s/,\s+$//; |
| 807 |
|
| 808 |
my $suggestion = {'suggestionterm' => $suggestionterm, 'suggestionquery' => $suggestionterm}; |
| 809 |
push(@suggestions, $suggestion); |
| 810 |
} |
| 811 |
|
| 812 |
$template->param( 'suggestionsloop' => \@suggestions ); |
| 813 |
} |
| 814 |
|
| 783 |
# VI. BUILD THE TEMPLATE |
815 |
# VI. BUILD THE TEMPLATE |
| 784 |
# Build drop-down list for 'Add To:' menu... |
816 |
# Build drop-down list for 'Add To:' menu... |
| 785 |
my ($totalref, $pubshelves, $barshelves)= |
817 |
my ($totalref, $pubshelves, $barshelves)= |
| 786 |
- |
|
|