[Koha-bugs] [Bug 30173] The suppress limit breaks the OPAC adv search using OR

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Feb 23 22:39:40 CET 2022


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

--- Comment #1 from Blou <philippe.blouin at inlibro.com> ---
Created attachment 131050
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131050&action=edit
Bug 30173: The suppress limit breaks the OPAC adv search using OR

When using the advanced search, it is possible to specify an OR (instead of the
default AND) between the terms.

In the OPAC, the system preferences OpacSuppression will add a limit to every
search as "suppress:false".

The problem is that the limit is simply added as "AND suppress:false" to the
query, without validating if it makes sense.  In the case of OR searches, it
does not:

(title:PuttingHarry) OR (title:HarryPutter) AND suppress:false

will not produce the desired results.  This fix (suggested by Kevin Carnes)
makes sure to envelop the search terms before padding the AND suppress:false.

To test:
1) Create two records with very distinctive titles, and prove that search one
by title only return that one result.  Same for the other.
2) Modify the OpacSuppression syspref to select "Hide"
3) Turn ON the ES tracing by editing koha-conf.xml and adding
<trace_to>Stderr</trace_to> under elasticsearch.  That will allow you to see
the strings generated.
4) Go to the advsearch in OPAC, do an OR search for both titles.  In your logs,
you should see something like

"query" : "(title:TITLE1) OR (title:TITLE2) AND suppress:false"

and get only one result.
5) Apply the patch, run again, this time the log should show

"query" : "((title:TITLE1) OR (title:TITLE2)) AND suppress:false"

and return two results.

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


More information about the Koha-bugs mailing list