Bug 28741

Summary: OAI ListSets does not correctly build resumption token
Product: Koha Reporter: Nick Clemens <nick>
Component: OPACAssignee: Nick Clemens <nick>
Status: CLOSED FIXED QA Contact: Tomás Cohen Arazi <tomascohen>
Severity: normal    
Priority: P5 - low CC: dcook, ere.maijala, fridolin.somers, kyle, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.11.00,21.05.03
Bug Depends on: 27584    
Bug Blocks:    
Attachments: Bug 28741: Fix use of resumption token params
Bug 28741: Fix use of resumption token params
Bug 28741: Regression tests
Bug 28741: Regression tests
Bug 28741: Fix use of resumption token params
Bug 28741: (follow-up) Silence warning
Bug 28741: [20.11.x] Fix warning and position check

Description Nick Clemens 2021-07-22 17:56:17 UTC
If you perform a list sets, you always get a resumption token, and it points to the same url always:
http://localhost:8080/cgi-bin/koha/oai.pl?verb=ListSets

Turns out we are sending the wrong params to build the token
Comment 1 Nick Clemens 2021-07-22 18:02:50 UTC
Created attachment 123063 [details] [review]
Bug 28741: Fix use of resumption token params

TO test:
 1 - Enable OAI-PMH server in Koha
 2 - Set OAI-PMH:MaxCount to 5
 3 - Define 6 sets in Admin->OAI sets configuration
    Can setSpec and setName to 1,2,3....
 4 - Browse to:
    http://localhost:8080/cgi-bin/koha/oai.pl?verb=ListSets
 5 - Click 'Show more'
 6 - Keep seeing the same 5 - note the page says 'Results fetched -4-0'
 7 - Apply patch
 8 - Restart all the things
 9 - Reload the ListSets URL above
10 - Click 'Show more'
11 - See the 6th set and note no 'Show more'
12 - Set OAI-PMH:MaxCount to 1
13 - Go to the base ListSets url again
14 - Confirm you can 'Show more' until you reach the end
Comment 2 Nick Clemens 2021-07-22 18:04:33 UTC
Caused by bug 27584
Comment 3 David Nind 2021-07-22 19:54:25 UTC
Created attachment 123066 [details] [review]
Bug 28741: Fix use of resumption token params

TO test:
 1 - Enable OAI-PMH server in Koha
 2 - Set OAI-PMH:MaxCount to 5
 3 - Define 6 sets in Admin->OAI sets configuration
    Can setSpec and setName to 1,2,3....
 4 - Browse to:
    http://localhost:8080/cgi-bin/koha/oai.pl?verb=ListSets
 5 - Click 'Show more'
 6 - Keep seeing the same 5 - note the page says 'Results fetched -4-0'
 7 - Apply patch
 8 - Restart all the things
 9 - Reload the ListSets URL above
10 - Click 'Show more'
11 - See the 6th set and note no 'Show more'
12 - Set OAI-PMH:MaxCount to 1
13 - Go to the base ListSets url again
14 - Confirm you can 'Show more' until you reach the end

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 Tomás Cohen Arazi 2021-08-02 12:37:12 UTC
Created attachment 123369 [details] [review]
Bug 28741: Regression tests

This patch adds regression tests for the behavior.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Tomás Cohen Arazi 2021-08-02 13:19:35 UTC
Created attachment 123382 [details] [review]
Bug 28741: Regression tests

This patch adds regression tests for the behavior.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 6 Tomás Cohen Arazi 2021-08-02 13:19:39 UTC
Created attachment 123383 [details] [review]
Bug 28741: Fix use of resumption token params

TO test:
 1 - Enable OAI-PMH server in Koha
 2 - Set OAI-PMH:MaxCount to 5
 3 - Define 6 sets in Admin->OAI sets configuration
    Can setSpec and setName to 1,2,3....
 4 - Browse to:
    http://localhost:8080/cgi-bin/koha/oai.pl?verb=ListSets
 5 - Click 'Show more'
 6 - Keep seeing the same 5 - note the page says 'Results fetched -4-0'
 7 - Apply patch
 8 - Restart all the things
 9 - Reload the ListSets URL above
10 - Click 'Show more'
11 - See the 6th set and note no 'Show more'
12 - Set OAI-PMH:MaxCount to 1
13 - Go to the base ListSets url again
14 - Confirm you can 'Show more' until you reach the end

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 7 Tomás Cohen Arazi 2021-08-02 13:19:44 UTC
Created attachment 123384 [details] [review]
Bug 28741: (follow-up) Silence warning

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 8 Jonathan Druart 2021-08-06 10:14:58 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 9 Kyle M Hall 2021-08-06 18:07:10 UTC
Pushed to 21.05.x for 21.05.03
Comment 10 Fridolin Somers 2021-08-11 20:01:09 UTC
Depends on Bug 27584 not in 20.11.x
Comment 11 Katrin Fischer 2021-08-11 20:26:21 UTC
I am not sure the depedency applied - I backported this to our 20.11 early after some testing and it applied nicely (and works)
Comment 12 Ere Maijala 2021-08-16 13:33:12 UTC
Sorry about breaking this and thanks for the fix.
Comment 13 Nick Clemens 2021-08-23 18:56:57 UTC
Created attachment 124054 [details] [review]
Bug 28741: [20.11.x] Fix warning and position check
Comment 14 Nick Clemens 2021-08-23 18:57:58 UTC
(In reply to Fridolin Somers from comment #10)
> Depends on Bug 27584 not in 20.11.x

The dependency affects the variable name change, the other parts of the patch set are still valid - we still show 'Show more' when at end of list and have a warning about the undef metadata prefix