Bug 11489 - OPAC search results in 404 error when the only search result is supressed
Summary: OPAC search results in 404 error when the only search result is supressed
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Kyle M Hall
QA Contact: Testopia
URL:
Keywords:
: 11432 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-01-07 17:19 UTC by Kyle M Hall
Modified: 2015-06-04 23:30 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 11489 - OPAC search results in 404 error when the only search result is supressed (2.05 KB, patch)
2014-01-07 17:24 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 11489 - OPAC search results in 404 error when the only search result is supressed (1.60 KB, patch)
2014-01-07 17:26 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 11489 - OPAC search results in 404 error when the only search result is supressed (1.66 KB, patch)
2014-01-14 16:45 UTC, sandboxes@biblibre.com
Details | Diff | Splinter Review
Hide facets if there are no results to show (because they are hidden) (1.57 KB, patch)
2014-01-14 17:34 UTC, Mark Tompsett
Details | Diff | Splinter Review
[SIGNED OFF] Bug 11489: Show facets only if there is result to display (1.52 KB, patch)
2014-01-14 17:40 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 11489 - OPAC search results in 404 error when the only search result is supressed (1.66 KB, patch)
2014-01-17 13:39 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 11489: Show facets only if there is result to display (1.51 KB, patch)
2014-01-17 13:39 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 11489: Show facets only if there is result to display (1.51 KB, patch)
2014-01-25 18:54 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 11489 - OPAC search results in 404 error when the only search result is supressed (1.70 KB, patch)
2014-03-11 09:56 UTC, sandboxes@biblibre.com
Details | Diff | Splinter Review
Bug 11489: Show facets only if there is result to display (1.55 KB, patch)
2014-03-11 09:56 UTC, sandboxes@biblibre.com
Details | Diff | Splinter Review
[PASSED QA] Bug 11489 - OPAC search results in 404 error when the only search result is supressed (1.76 KB, patch)
2014-04-07 22:32 UTC, Katrin Fischer
Details | Diff | Splinter Review
[PASSED QA] Bug 11489: Show facets only if there is result to display (2.34 KB, patch)
2014-04-07 22:33 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall 2014-01-07 17:19:24 UTC
If hidelostitems is enabled, and the result of an opac search is a single lost item, then the opac will display a 404 error, rather than a "no results" screen.
Comment 1 Kyle M Hall 2014-01-07 17:24:15 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall 2014-01-07 17:26:43 UTC Comment hidden (obsolete)
Comment 3 Christopher Brannon 2014-01-13 17:45:18 UTC
Kyle,
This issue appears to no longer apply.  I tested on a sandbox against master, and with hidelostitems set to show, item shows as lost.  If set to Don't show, record shows without any item showing.

Please confirm test parameters.
Comment 4 Kyle M Hall 2014-01-14 16:21:18 UTC
I'm still seeing this error in master: http://screencast.com/t/gvuoF4pyebF
Comment 5 Christopher Brannon 2014-01-14 16:36:54 UTC
My bad.  I don't know why it worked before.  I just tested it again and now I am getting the same results.  Thanks for confirming.

Christopher
Comment 6 sandboxes@biblibre.com 2014-01-14 16:45:12 UTC
Patch tested with a sandbox, by Christopher Brannon <cbrannon@cdalibrary.org>
Comment 7 sandboxes@biblibre.com 2014-01-14 16:45:31 UTC Comment hidden (obsolete)
Comment 8 Mark Tompsett 2014-01-14 16:45:58 UTC
Using a copy of our old data on a git install, I found we had a three copies of a book '101 Stupid Things Trainers Do To Sabotage Success' (1 biblio, 3 items), and one was lost. I deleted the two we had, and kept the lost one. I went to the system preferences and toggled it between looking at the OPAC search for 'stupid things' which was unique, and I have it showing and not showing the 1 item.
Comment 9 Christopher Brannon 2014-01-14 16:48:53 UTC
(In reply to M. Tompsett from comment #8)
> Using a copy of our old data on a git install, I found we had a three copies
> of a book '101 Stupid Things Trainers Do To Sabotage Success' (1 biblio, 3
> items), and one was lost. I deleted the two we had, and kept the lost one. I
> went to the system preferences and toggled it between looking at the OPAC
> search for 'stupid things' which was unique, and I have it showing and not
> showing the 1 item.

I had a similar result the first time, which prompted my request for confirmation above.  But when I went to try it today, it gave the error.

I have tested twice now, and the patch does work.

Christopher
Comment 10 Mark Tompsett 2014-01-14 17:13:12 UTC
Oops... I got a cross-problem with the OpacHiddenItems.
I'm doing further retesting.
Comment 11 Mark Tompsett 2014-01-14 17:30:12 UTC
TEST PLAN
---------
home
cataloguing
new from z39.50
purple
search
import (Abbott & Costello cartoons.)
9
set the default type.
save > save and edit items
add a lost item
rather than wait, I reindexed it immediately:
$ ./misc/migration_tools/rebuild_zebra.pl -b -a -z -v
made sure system preference for hidelostitems was Show
search Staff, found
search OPAC, found
toggle the systempreference
search staff, found
search OPAC, 404
apply patch
search OPAC, no results -- facets still show.
Comment 12 Mark Tompsett 2014-01-14 17:34:40 UTC Comment hidden (obsolete)
Comment 13 Mark Tompsett 2014-01-14 17:35:40 UTC
Comment on attachment 24292 [details] [review]
Hide facets if there are no results to show (because they are hidden)

It is a patch, but it isn't mine. It is from Jonathan Druart <jonathan.druart@biblibre.com>.
Comment 14 Mark Tompsett 2014-01-14 17:40:29 UTC Comment hidden (obsolete)
Comment 15 Mark Tompsett 2014-01-14 17:49:32 UTC
*** Bug 11432 has been marked as a duplicate of this bug. ***
Comment 16 Meg 2014-01-14 21:14:28 UTC
I have tested the patch and it works! OPAC hides lost/missing items and no longer displays 404 error.
Comment 17 Kyle M Hall 2014-01-17 13:39:24 UTC Comment hidden (obsolete)
Comment 18 Kyle M Hall 2014-01-17 13:39:36 UTC Comment hidden (obsolete)
Comment 19 Katrin Fischer 2014-01-25 11:45:24 UTC
Sorry, but there is a bug:

Testing notes:
- Record with 1 lost item, result list = 1
  - Verified without both patches 404 error page is shown
  - Verified with 1st patch, no results page is shown
  - Verified with 2nd patch, the still showing facets are gone
- Record with 1 lost item, result list > 1
  - Record is hidden from result list, but
    - result count is wrong
    - result numbering is wrong
    > This is an old problem, just noting
- Record with 1 lost and 1 available item, result list = 1
  - Detail page is shown, only lost item is hidden
- Record with 1 ost and 1 available item, result list > 1
  - Only available item is shown in result list
  BUT: FACETS ARE HIDDEN.

I think the problem was introduced by the second patch, but since it fixes a problem with the first patch, it also needs to be fixed before either patch can be passed QA.
Comment 20 Mark Tompsett 2014-01-25 16:01:26 UTC
Actually, in that last case which causes the problem, the page should be auto-redirecting, because there is only 1 visible result. The problem is there is a [0] hard coded into the one result redirection.
Comment 21 Katrin Fischer 2014-01-25 17:38:20 UTC
You misunderstood the test case - I did a search with a real result list, in my case 7 results matching the search term. The record with the lost item shows, but the lost item is not listed, because there is another item available. The only problem there is that the facets are gone.
Comment 22 Mark Tompsett 2014-01-25 18:05:45 UTC
I'm still not understanding. You searched for something, and there are 7 results in total. That implies items. How many biblios? Was the lost item the same or different biblio than the available one? And does that mean the other 5 were checked out?
Comment 23 Katrin Fischer 2014-01-25 18:08:56 UTC
7 records one of which was my testing record with 1 item and 1 normal item.
Comment 24 Katrin Fischer 2014-01-25 18:09:26 UTC
1 lost item... and 1 available item. I am talking of a normal result list, where one of the records happens to have a hidden item.
Comment 25 Mark Tompsett 2014-01-25 18:54:05 UTC Comment hidden (obsolete)
Comment 26 Mark Tompsett 2014-01-25 18:55:04 UTC
I changed hits to total because of line 683 in opac/opac-search.pl, and since hits is not set as a parameter to the template.
Comment 27 Owen Leonard 2014-02-06 20:23:10 UTC
Both of these patches appear to be signed off, so I'm changing this bug's status.
Comment 28 Mark Tompsett 2014-02-06 23:10:18 UTC
I'm not sure that is right, because I tweaked the second patch and signed it off. I think the second patch needs proper sign off by someone else before being marked as signed off.
Comment 29 michot 2014-03-11 09:52:28 UTC
We test today on sandbox and everything seems OK :
- request with 9 results, one of them with 2 items
- we mark one of the 2 items "lost"
- we enable prefsystem hidelostitems = "don't show"
- we search again on opac
- the lost item is hidden, in the list of results and on the biblio view
- the facets are displayed

We try another request with only one result and do the same process :
- we have the message "No results found " and no facets.
Comment 30 sandboxes@biblibre.com 2014-03-11 09:56:06 UTC
Patch tested with a sandbox, by Michot <nmichot@voila.fr>
Comment 31 sandboxes@biblibre.com 2014-03-11 09:56:34 UTC Comment hidden (obsolete)
Comment 32 sandboxes@biblibre.com 2014-03-11 09:56:38 UTC Comment hidden (obsolete)
Comment 33 Katrin Fischer 2014-04-07 22:32:35 UTC
Created attachment 26889 [details] [review]
[PASSED QA] Bug 11489 - OPAC search results in 404 error when the only search result is supressed

If hidelostitems is enabled, and the result of an opac search is a single lost item,
then the opac will display a 404 error, rather than a "no results" screen.

Test Plan:
1) Catalog a record/item such that it is the only result for some search
   e.g. Give it the title 'zxcvb'
2) Enable hidelostitems
3) Mark this item as lost
4) Perform an OPAC search that should result in a redirect to this record
5) Notice you a redirected to a 404 error
6) Apply this patch
7) Repeat step 4
8) Note you new get a "No results found!" page instead

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Michot <nmichot@voila.fr>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comment 34 Katrin Fischer 2014-04-07 22:33:06 UTC
Created attachment 26890 [details] [review]
[PASSED QA] Bug 11489: Show facets only if there is result to display

If all results are hidden, the facets are displayed.
With this patch, the facets are hidden too.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Michot <nmichot@voila.fr>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script. Tested:

- Record with 1 lost item, result list = 1
  - Verified without both patches 404 error page is shown
  - Verified with 1st patch, no results page is shown
  - Verified with 2nd patch, the still showing facets are gone
- Record with 1 lost item, result list > 1
  - Record is hidden from result list, but
    - result count is wrong
    - result numbering is wrong
    > This is an old problem, just noting
- Record with 1 lost and 1 available item, result list = 1
  - Detail page is shown, only lost item is hidden
- Record with 1 lost and 1 available item, result list > 1
  - Only available item is shown in result list

Also checked that the lost item shows up with hidelostitems off.
Comment 35 Galen Charlton 2014-04-19 16:23:45 UTC
Pushed to master.  Thanks, Kyle!
Comment 36 Fridolin Somers 2014-08-13 07:35:19 UTC
Pushed to 3.14.x, will be in 3.14.10
Comment 37 Kyle M Hall 2014-08-13 18:22:51 UTC
Picked for 3.12.15!