Bugzilla – Attachment 136697 Details for
Bug 31061
OPACSuppress behavior with Elasticsearch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31061: OPACSuppress does not work properly with Elasticsearch
Bug-31061-OPACSuppress-does-not-work-properly-with.patch (text/plain), 3.09 KB, created by
Fridolin Somers
on 2022-06-28 20:21:57 UTC
(
hide
)
Description:
Bug 31061: OPACSuppress does not work properly with Elasticsearch
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2022-06-28 20:21:57 UTC
Size:
3.09 KB
patch
obsolete
>From af20763b18bd25773ad7a56dca66bda8f2d7c2c3 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Tue, 28 Jun 2022 10:08:25 -1000 >Subject: [PATCH] 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) >--- > Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >index 7250ea6048..d54e99c2b3 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -283,7 +283,7 @@ sub build_query_compat { > my @sort_params = $self->_convert_sort_fields(@$sort_by); > my @index_params = $self->_convert_index_fields(@$indexes); > $limits = $self->_fix_limit_special_cases($orig_limits); >- if ( $params->{suppress} ) { push @$limits, "suppress:false"; } >+ if ( $params->{suppress} ) { push @$limits, "NOT(suppress:1)"; } > # Merge the indexes in with the search terms and the operands so that > # each search thing is a handy unit. > unshift @$operators, undef; # The first one can't have an op >-- >2.35.3
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31061
:
136695
|
136696
|
136697
|
136799