SRU incorrect nesting of site param

Bug #1833300 reported by Jeff Davis
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

When you do an SRU search at a specific org unit, a "site" parameter is appended to your search terms in a way that can mess up your query.

Suppose you submit this search to /opac/extras/sru/SYS1/holdings:

eg.keyword = 9780387095141 or eg.keyword = 0387095144

Evergreen extracts the SYS1 shortname from the endpoint URL and simply appends it to your query:

SRU search string [eg.keyword = 9780387095141 or eg.keyword = 0387095144] converted to [eg.keyword:9780387095141 || eg.keyword:0387095144 site:SYS1]

There's an order-of-operations problem here. We intended this:

( eg.keyword:9780387095141 || eg.keyword:0387095144 ) site:SYS1

But we effectively got this instead:

eg.keyword:9780387095141 || ( eg.keyword:0387095144 site:SYS1 )

The easiest solution is to wrap our entire query in parentheses before appending the site param. I'll share a branch for this momentarily.

Revision history for this message
Jeff Davis (jdavis-sitka) wrote :

Note that Boolean searches of site-scoped Z39.50 endpoints will be affected by this bug, since Z39.50 uses SRU.


Working branch user/jeffdavis/lp1833300-sru-site-param-nesting has the aforementioned fix.

To test:

1. Submit an SRU search to /opac/extras/sru/SYS1/holdings?version=1.1&operation=searchRetrieve&query=(eg.keyword%20=%209780387095141%20or%20eg.keyword%20=%200387095144)&maximumRecords=0

2. Logs should show the search with the incorrectly nested site param:
SRU search string [(eg.keyword = 9780387095141 or eg.keyword = 0387095144)] converted to [eg.keyword:9780387095141 || eg.keyword:0387095144 site:SYS1]

3. Apply the patch and restart Evergreen.

4. Redo the search from step 1.

5. Logs should show that the site param is now correctly nested:
SRU search string [eg.keyword = 9780387095141 or eg.keyword = 0387095144] converted to [(eg.keyword:9780387095141 || eg.keyword:0387095144) site:SYS1]

tags: added: pullrequest
Changed in evergreen:
milestone: none → 3.4-beta1
tags: added: z3950
tags: added: supercat
Galen Charlton (gmc)
Changed in evergreen:
milestone: 3.4-beta1 → 3.4-beta2
status: New → Confirmed
importance: Undecided → Medium
Galen Charlton (gmc)
Changed in evergreen:
milestone: 3.4-beta2 → 3.4.1
Changed in evergreen:
milestone: 3.4.1 → 3.4.2
Changed in evergreen:
milestone: 3.4.2 → 3.4.3
Changed in evergreen:
milestone: 3.4.3 → 3.5.0
Revision history for this message
Mike Risher (mrisher) wrote :

I ran through the testing steps and can confirm that parentheses group the search parameters in the way described. I consent to signing off on it with my name, Mike Risher and my email address, <email address hidden>

tags: added: signedoff
Changed in evergreen:
milestone: 3.5.0 → 3.5.1
Revision history for this message
Galen Charlton (gmc) wrote :

Pushed all the way to rel_3_4. Thanks, Jeff and Mike!

Changed in evergreen:
assignee: nobody → Galen Charlton (gmc)
assignee: Galen Charlton (gmc) → nobody
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers