|
Lines 918-923
if ($query_desc || $limit_desc) {
Link Here
|
| 918 |
$template->param(searchdesc => 1); |
918 |
$template->param(searchdesc => 1); |
| 919 |
} |
919 |
} |
| 920 |
|
920 |
|
|
|
921 |
# III. LOOK FOR SEARCH SUGGESTIONS IN AUTHORITIES |
| 922 |
|
| 923 |
if (C4::Context->preference('OPACSearchSuggestions')) { |
| 924 |
# Search for authorities that could better represent the search query |
| 925 |
my @suggestions; |
| 926 |
|
| 927 |
# Set the index of all operands for Match-heading-see-from search |
| 928 |
my @indexes_match; |
| 929 |
foreach(@operands){push(@indexes_match, 'Match-heading-see-from,ext');} |
| 930 |
|
| 931 |
# Build the query and do a simple search with it |
| 932 |
($error, $query) = buildQuery(\@operators,\@operands,\@indexes_match,0,0,0,$lang); |
| 933 |
my ($error2, $results, $total_hits) = SimpleSearch( $query, undef, undef, [ "authorityserver" ] ); |
| 934 |
|
| 935 |
# Add the main Heading of each search result and add it to the suggestion list |
| 936 |
foreach my $r (@$results) |
| 937 |
{ |
| 938 |
my $record = MARC::Record->new_from_usmarc( $r ); |
| 939 |
my @subfields = ($record->field('1..'))[0]->subfields(); |
| 940 |
|
| 941 |
# Fuse the subfields |
| 942 |
my $suggestionterm = ''; |
| 943 |
foreach(@subfields){$suggestionterm .= $_->[1] . ', ';} |
| 944 |
$suggestionterm =~ s/,\s+$//; |
| 945 |
|
| 946 |
my $suggestion = {'suggestionterm' => $suggestionterm, 'suggestionquery' => $suggestionterm}; |
| 947 |
push(@suggestions, $suggestion); |
| 948 |
} |
| 949 |
|
| 950 |
$template->param( 'suggestionsloop' => \@suggestions ); |
| 951 |
} |
| 952 |
|
| 921 |
# VI. BUILD THE TEMPLATE |
953 |
# VI. BUILD THE TEMPLATE |
| 922 |
# Build drop-down list for 'Add To:' menu... |
954 |
# Build drop-down list for 'Add To:' menu... |
| 923 |
my ($totalref, $pubshelves, $barshelves)= |
955 |
my ($totalref, $pubshelves, $barshelves)= |
| 924 |
- |
|
|