Bug 35676 - OPAC search results - link for "Check for suggestions" generates a blank page
Summary: OPAC search results - link for "Check for suggestions" generates a blank page
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Kyle M Hall
URL:
Keywords:
: 35958 (view as bug list)
Depends on: 34866
Blocks:
  Show dependency treegraph
 
Reported: 2023-12-31 18:56 UTC by David Nind
Modified: 2024-02-02 17:51 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.02


Attachments
Bug 35676: Fix DidYouMean when not configured (2.24 KB, patch)
2024-01-12 12:50 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 35676: Fix DidYouMean when not configured (2.29 KB, patch)
2024-01-12 13:34 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 35676: Fix DidYouMean when not configured (2.34 KB, patch)
2024-01-12 14:25 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Nind 2023-12-31 18:56:14 UTC
In the OPAC when searching, after the "Your search returned XX results" there is some text:

"Not what you expected? Check for suggestions"

'suggestions' is linked to /cgi-bin/koha/svc/suggestion?render=standalone&q=cat

This returns a blank page.

I could not see any error messages in the logs, or any JavaScript errors in the browser web developer tools console.

To replicate:
1. Go to the OPAC and perform a search (for example: cat) (it doesn't matter if you are logged in or not).
2. In the text area after "You search returned XX results" there is some text "Not what you expected? Check for suggestions)", 'suggestions' is linked.
3. Click on the link for 'suggestions'.
4. You get a blank page.
Comment 1 Jonathan Druart 2024-01-12 12:46:29 UTC
Caused by bug 34866
Comment 2 Jonathan Druart 2024-01-12 12:50:54 UTC
Created attachment 160942 [details] [review]
Bug 35676: Fix DidYouMean when not configured

When DidYouMean is not configured, there is the following message
displayed:
  "Not what you expected? Check for suggestions"
suggestions is a link to svc/suggestion which does not return content if
the feature is displayed
 90 unless ( @plugins ) {
 91     print $query->header;
 92     exit;
 93 }

We should not see this text, it is supposed to be replaced when the ft
is enabled.

However
  commit 79bf4485c1b2ae8059e2ee15ea1e67bba9961c34
  Bug 34866: Use template wrapper for breadcrumbs: OPAC part 4
made this change:
-                    [% IF ( DidYouMean ) %]
+                    [% #IF ( DidYouMean ) %]
                         <div id="didyoumean">Not what you expected? Check for <a href="/cgi-bin/koha/svc/suggestion?render=standalone&amp;q=[% querystring | uri %]">suggestions</a></div>
-                    [% END %]
+                    [% #END %]

Which is obviously wrong.

Test plan:
Do not have the ft configured and launch a search (OPAC) that will not
return any results.
=> Without this patch there is the message
=> With this patch applied it is no longer displayed
Comment 3 Owen Leonard 2024-01-12 13:34:30 UTC
Created attachment 160962 [details] [review]
Bug 35676: Fix DidYouMean when not configured

When DidYouMean is not configured, there is the following message
displayed:
  "Not what you expected? Check for suggestions"
suggestions is a link to svc/suggestion which does not return content if
the feature is displayed
 90 unless ( @plugins ) {
 91     print $query->header;
 92     exit;
 93 }

We should not see this text, it is supposed to be replaced when the ft
is enabled.

However
  commit 79bf4485c1b2ae8059e2ee15ea1e67bba9961c34
  Bug 34866: Use template wrapper for breadcrumbs: OPAC part 4
made this change:
-                    [% IF ( DidYouMean ) %]
+                    [% #IF ( DidYouMean ) %]
                         <div id="didyoumean">Not what you expected? Check for <a href="/cgi-bin/koha/svc/suggestion?render=standalone&amp;q=[% querystring | uri %]">suggestions</a></div>
-                    [% END %]
+                    [% #END %]

Which is obviously wrong.

Test plan:
Do not have the ft configured and launch a search (OPAC) that will not
return any results.
=> Without this patch there is the message
=> With this patch applied it is no longer displayed

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 4 Kyle M Hall 2024-01-12 14:25:31 UTC
Created attachment 160970 [details] [review]
Bug 35676: Fix DidYouMean when not configured

When DidYouMean is not configured, there is the following message
displayed:
  "Not what you expected? Check for suggestions"
suggestions is a link to svc/suggestion which does not return content if
the feature is displayed
 90 unless ( @plugins ) {
 91     print $query->header;
 92     exit;
 93 }

We should not see this text, it is supposed to be replaced when the ft
is enabled.

However
  commit 79bf4485c1b2ae8059e2ee15ea1e67bba9961c34
  Bug 34866: Use template wrapper for breadcrumbs: OPAC part 4
made this change:
-                    [% IF ( DidYouMean ) %]
+                    [% #IF ( DidYouMean ) %]
                         <div id="didyoumean">Not what you expected? Check for <a href="/cgi-bin/koha/svc/suggestion?render=standalone&amp;q=[% querystring | uri %]">suggestions</a></div>
-                    [% END %]
+                    [% #END %]

Which is obviously wrong.

Test plan:
Do not have the ft configured and launch a search (OPAC) that will not
return any results.
=> Without this patch there is the message
=> With this patch applied it is no longer displayed

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Katrin Fischer 2024-01-16 11:09:38 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 6 Fridolin Somers 2024-01-17 09:43:09 UTC
Pushed to 23.11.x for 23.11.02
Comment 7 Owen Leonard 2024-01-31 13:20:08 UTC
*** Bug 35958 has been marked as a duplicate of this bug. ***
Comment 8 Owen Leonard 2024-01-31 13:21:05 UTC
Based on Bug 35958 it looks like folks on 23.05 would like a backport.
Comment 9 Jan Kissig 2024-01-31 13:35:36 UTC
(In reply to Owen Leonard from comment #8)
> Based on Bug 35958 it looks like folks on 23.05 would like a backport.

Sorry for wrong version tag in bug 35958 as we ware already running 23.11.01.