https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8589
Luis Bataller <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #9 from Luis Bataller <[email protected]> --- Hi all, This bug captures a limitation of searches in Koha under Elasticsearch: filtering by item-level attributes such as itemtype and location returns records where each criterion is satisfied by a different item, rather than by the same physical item. The same cross-item mismatch affects branch/availability filters. We have implemented a solution against current Koha (26.05) and would like to offer it to the community. This is essentially the approach David Cook anticipated in comment #7: Elasticsearch's nested data structures let you require an "AND" across values within the same nested object. We index each record's items as a nested object on the biblios index (alongside the existing flat 952 fields, which are kept untouched), so that item-level conditions are evaluated on the same item. What the work covers so far: Nested item mapping on the biblios index, populated with per-item fields (home/holding branch, itype, location, ccode, callnumber, barcode, acquisition date, lost/withdrawn/damaged, plus derived flags: availability, in-transit, on-hold, on-request, and home/holding geolocation as geo_point). Same-item filtering for facets, branch/multibranchlimit limits and availability — the fix for this bug. Selecting itemtype + location now returns only records with an item matching both. Advanced-search item operands (barcode, location, call number, acquisition-date range) and the item-type limit routed through the same nested channel when the query is a pure-AND (documented fallback to flat for OR/NOT). Reactive reindexing on transfers, holds and library-geolocation changes, so the derived fields stay in sync. OPAC item hiding and record suppression honoured through the nested channel (OpacHiddenItems, hidelostitems, OpacHiddenItemsHidesRecord), including a plugin hook for custom hiding rules. Optionally, showing only the matching items in staff search results (with recalculated counts), behind a new syspref. Together these cover the case Ray Delahunty raised in comment #8: the keyword area, the tab operands and the bottom limits of Advanced Search working together without "not useful" results, including complex multi-site setups where facet (homebranch) filtering currently still leaks cross-item hits. We would be happy to attach the patch series here. Given the size of the change, before uploading everything, we'd appreciate the maintainers' guidance on how you'd prefer to receive it: as a single dependency chain, split into different staged bugs (mapping, filtering, facets …), or whether an RFC is warranted first. Happy to adapt to whatever makes review easiest. Thanks! -- 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/
