If you set up the OpacHiddenItems syspref to hide based on homebranch and then do a "Title Phrase" search for a title that on the hidden branch owns you get a 404 error rather than the "No Item found" message.
I don't think this is related to the type of search, I think it has to do with the fact that the search is returning only one record. Normally a search with one result redirects to the detail page for that result. It sounds like the fact that the result is hidden by OpacHiddenItems makes it behave as if the record doesn't exist.
I agree but that was the best example I could use to get the error to show. You are correct it is not the search that is at issue it is the fact that it is trying to display something that is hidden.
I resolved a similar situation by re-indexing (koha-rebuild-zebra on my Ubuntu system). Before, the hidden item type was still appearing on search results, and clicking the link to the item would result in a 404 error. After, the item type was correctly hidden from all search results.
I think 2 different problems here:
- when there is only one result of the search, that is hidden due to opachiddenitems, then the 404 displays. Maybe we should implement something like OpacSuppressionRedirect and OpacSuppressionMessage for opachiddenitems?
- The item information in the result list is coming from the Zebra index, so this might be the reason a reindex was necessary to make it work - maybe the item was not indexed yet before?
Created attachment 41194 [details] [review]
Bug 9966 - Incorrect 404 when a search returns one result hidden by OpacHiddenItems
This patch disables throwing the 404-error. We should be able to show the
opac-detail.pl regardless of hidden items or not.
This doesn't fix the availability on opac-search.pl,
but gets us out of a very awkward predicatement.
1. You can now access opac-detail.pl for Biblios whose ALL Items are hidden by the
s'il vous plaît.
If I understand you correctly this will make the record visible, even if all items are hidden. I think this breaks a feature/user expectation. A lot of libraries use the fact the record is hidden with the last item to their advantage and the feature has been explicitly build to function this way from the beginning.
This fix is too simple - it needs to be optional.
(In reply to Katrin Fischer from comment #7)
> If I understand you correctly this will make the record visible, even if all
> items are hidden. I think this breaks a feature/user expectation. A lot of
> libraries use the fact the record is hidden with the last item to their
> advantage and the feature has been explicitly build to function this way
> from the beginning.
> This fix is too simple - it needs to be optional.
The hidden items should not be displayed in OPAC regardless of this fix.
The way I tested we get the opac-detail.pl with no Items to display because they were all correctly hidden by the "OpacHiddenItems"-syspref.
If this fix is too simple, you can freely wait for a more complete solution. For the time being we are affected by this bug and it causes bad experiences for OPAC users. This patch fixes the biggest issue with the lowest effort.
Put status back to "Needs Signoff", because QA misunderstood the patch effects and no test results were available to discredit the intended behaviour.
Failed QA because of missing tests ;)
The point is you are deleting code that is there on purpose - the bibliographic details/record shouldn't show when all items are hidden.
(In reply to Katrin Fischer from comment #11)
> The point is you are deleting code that is there on purpose - the
> bibliographic details/record shouldn't show when all items are hidden.
Sorry, I read Item when you wrote Record.