[Koha-bugs] [Bug 31061] OPACSuppress does not work properly with Elasticsearch

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Jun 28 22:21:57 CEST 2022


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

--- Comment #3 from Fridolin Somers <fridolin.somers at biblibre.com> ---
Created attachment 136697
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=136697&action=edit
Bug 31061: OPACSuppress does not work properly with Elasticsearch

OPACSuppress is system preference to hide records in OPAC search by adding a
limit in search query.

With Zebra, this limit is : not Suppress=1
https://git.koha-community.org/Koha-community/Koha/src/commit/244b847a08bf61a747a1e4be4eed86cc776eabd6/Koha/SearchEngine/Zebra/QueryBuilder.pm#L83
With Elasticsearch this limit is currently quite different : suppress:false
https://git.koha-community.org/Koha-community/Koha/src/commit/244b847a08bf61a747a1e4be4eed86cc776eabd6/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm#L286

Main problem is that in default framework we define Suppress search field on
942$n with authorized values YES_NO.
This generates records with 1 for YES and 0 for NO.
But a boolean for Elasticsearch is not a perl boolean.
So only missing subfield means false :
https://www.elastic.co/guide/en/elasticsearch/reference/6.8/boolean.html
Records with 0 are hidden !

Another side-effect :
We whould like to have several MARC fields with 'suppress' search field.
To distinguish several causes of hidden at OPAC.
Any of those fields having 1 must hide at OPAC.
So syntax 'NOT(suppress:1)' is more correct.

I propose we change to have the same behavior as Zebra.
Change 'suppress' search field to not remove boolean type.
Change QueryBuilder to use 'NOT(suppress:1)'.

Test plan :
1) Use search engine Elasticsearch
2) Disable system preference OpacSuppression
3) Search in OPAC for all records : '*:*'
     => Note how many results
4) Enable system preference OpacSuppression
5) Edit a biblio record with 942$n set to YES
6) Search in OPAC for all records : '*:*'
     => Note how many results, you should have 1 less than 3)
7) Edit a biblio record with 942$n set to NO
8) Search in OPAC for all records : '*:*'
     => Note how many results, you should have same number as 3)
9) Edit a biblio record to remove 942$n
10) Search in OPAC for all records : '*:*'
     => Note how many results, you should have same number as 3)

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list