Bug 43320: Don't quoted already quoted searches and add feedback
Bug 31213 added a quoted search when no results were found,
this patch builds on that to:
1 - Notify the user when their search is repeated quoted
2 - Not repeat a search when already quoted
To test:
0 - Set system preferences
RedirectToSoleResult to 'Don't redirect'
IntranetAddMastheadLibraryPulldown to Show
IntranetCatalogSearchPulldown to Show
1 - Add the sample records to your catalog
2 - Search for the quoted phrase "happy family big" in the 'title' index
3 - Note you get a result
4 - Check the record - the phrase is not found, but the record contains all the terms
5 - Search for the unquoted phrase: 6:20 man
6 - Confirm search is quoted and result found
7 - Apply patch, restart all
8 - Repeat 5
9 - Confirm you are now told search was quoted and result found
10 - Repeat 2
11 - Confirm no result found, no notice of repeated search
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
b37d6989e5
commit
403288c5cd
|
|
@ -556,7 +556,8 @@ if ( $@ || $error ) {
|
|||
}
|
||||
|
||||
my $hits = $results_hashref->{$server}->{"hits"} // 0;
|
||||
if ( $hits == 0 && $basic_search ) {
|
||||
if ( $hits == 0 && $basic_search && $operands[0] !~ /^\".*\"$/ ) {
|
||||
my $og_query = $query_desc;
|
||||
$operands[0] = '"' . $operands[0] . '"'; #quote it
|
||||
## I. BUILD THE QUERY
|
||||
(
|
||||
|
|
@ -585,6 +586,10 @@ if ( $hits == 0 && $basic_search ) {
|
|||
};
|
||||
my $quoted_hits = $quoted_results_hashref->{$server}->{"hits"} // 0;
|
||||
if ($quoted_hits) {
|
||||
$template->param(
|
||||
quoted_hits => 1,
|
||||
og_query => $og_query,
|
||||
);
|
||||
$results_hashref->{$server} = $quoted_results_hashref->{$server};
|
||||
$hits = $quoted_hits;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,12 @@
|
|||
<h1>Search results</h1>
|
||||
|
||||
[% IF ( total ) %]
|
||||
[% IF quoted_hits %]
|
||||
<h4 class="info">
|
||||
No result(s) found for your original query: [% og_query %]<br />
|
||||
Your search was retried, quoted
|
||||
</h4>
|
||||
[% END %]
|
||||
<h3>
|
||||
[% total | html %] result(s) found
|
||||
[% IF ( query_desc ) %]for <span class="results_query_desc">'[% query_desc | html %]'</span>[% END %][% IF limit_desc %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue