https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35052

--- Comment #19 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 205611
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205611&action=edit
Bug 35052: Add _apply_opac_hidden_items_filter

Core mechanism of this bug fix. Given the rules attached by the previous
commit, finds every biblio where ALL items match the OpacHiddenItems
rules and excludes them from the search via a must_not/ids filter clause,
evaluated live at query time rather than baked into the index.

Implementation is two scoped items-index queries, not a full-catalog scan:
1. Items matching the hide-rule, grouped by biblionumber with counts
   (scoped to the usually-small population of actually-hidden items)
2. For just those candidate biblionumbers, their total item count
   (scoped to that small candidate set, not the whole catalogue)
A biblio is "fully hidden" iff its hidden count equals its total count -
this is what distinguishes it from a biblio with only some items hidden,
which must never be excluded.

Falls back to no-op (existing post-processing behaviour) if the items
index isn't ready, matching the pattern already established by
_apply_item_level_filters (Bug 43151).

Not yet wired into search_compat (next commit) - this commit only adds
the method and its unit tests.

Test plan:
1) ktd --name "${KTD_INSTANCE:-kohadev}" --shell --run 'prove
t/db_dependent/Koha/SearchEngine/Elasticsearch/Search.t'
2) All tests pass, including the new '_apply_opac_hidden_items_filter() tests'
   subtest - pay particular attention to the assertion that a biblio with
   some (but not all) items hidden is NOT excluded, only the fully-hidden one

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to