Bug 35052 - OpacHiddenItemsHidesRecord system preference should be considered on index time instead
Summary: OpacHiddenItemsHidesRecord system preference should be considered on index ti...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-13 14:33 UTC by Pedro Amorim
Modified: 2023-10-25 00:00 UTC (History)
8 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Amorim 2023-10-13 14:33:53 UTC
Currently, results are being skipped after the search has been processed in C4/Search.pm. This may cause several unintended scenarios:

1) The first page has all the results skipped, even thought there are more results in 2nd page and so on, this will will result in a "No search results" page
2) The total search results number still shows 80 (for example), even if it has skipped 70 and is only showing 10.

To reproduce we need to use both OpacHiddenItems and OpacHiddenItemsHidesRecord

Use OpacHiddenItems and put some rules that hide some items
Use OpacHiddenItemsHidesRecord = 'hide'
Comment 1 Martin Renvoize 2023-10-24 07:57:31 UTC
I actually see two ways to achieve this.. 

a) we add a field to the index to denote hidden by these options and fill it during index runs.

or

b) we adapt the queries at runtime with each search to take into consideration the preferences
Comment 2 Nick Clemens 2023-10-24 12:46:33 UTC
for b) I think we need to begin indexing the items individually, right now we take the values from each, but the connections are broken.

i.e.

homebranch index gets the list of homebranches on the item
holdingbranch the same

We cannot search for records with items with matching homebranch and holdingbranch, only records that have some items in a homebranch and some items in a holdingbranch
Comment 3 David Cook 2023-10-25 00:00:53 UTC
I recall Frido and I talking about this on a separate bug but now I can't remember which one it was...

One problem with indexing whether or not to hide based on OpacHiddenItems and OpacHiddenItemsHidesRecord  is that you'd need to do a full reindex for any change to OpacHiddenItems or OpacHiddenItemsHidesRecord. (Of course, if we note that caveat in the syspref descriptions, then it's not necessarily a huge problem.)

Unless we re-use the index used by OpacSuppression, then we'll need to adapt the search queries to take into account a new OpacHiddenItems index as well.

--

As Nick says, I don't think just updating the search query is enough, since I don't think there's any way to know if all the items in a record should be hidden in Zebra. 

In bug 19704, I'm able to generate a SQL query using OpacHiddenItems, but it's able to deal with individual item records. 

That said, I don't think we can index items separately in Zebra and there wouldn't be any way to join the bibs and items together anyway. 

So I think that really just leaves the indexing option?