Bug 21517 - OAI returns records outside of specified time range.
Summary: OAI returns records outside of specified time range.
Alias: None
Product: Koha
Classification: Unclassified
Component: Web services (show other bugs)
Version: 18.05
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
Depends on: 15108
  Show dependency treegraph
Reported: 2018-10-08 15:27 UTC by Rudolf Byker
Modified: 2022-05-26 13:55 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:

The XML output of the OAI-PMH request. (90.47 KB, text/xml)
2018-10-08 15:27 UTC, Rudolf Byker

Note You need to log in before you can comment on or make changes to this bug.
Description Rudolf Byker 2018-10-08 15:27:47 UTC
Created attachment 80225 [details]
The XML output of the OAI-PMH request.



Output contains results from 2014. Attached.
Comment 1 Jonathan Druart 2018-10-22 22:45:10 UTC
Hi Rudolf,

What you describe makes me think of bug 19725, are you using 18.05.x as you selected?
Comment 2 Jonathan Druart 2018-10-22 22:49:42 UTC
I think I got it, the from/until parameters are used to retrieve the biblionumber of the records we will display. But the "datestamp" value is filled with the following query (from Koha/OAI/Server/ListBase.pm):

            $sql = " 
                SELECT MAX(timestamp)
                FROM (
                    SELECT timestamp FROM biblio_metadata WHERE biblionumber = ?
                    SELECT timestamp FROM deleteditems WHERE biblionumber = ?
                    SELECT timestamp FROM items WHERE biblionumber = ?
                ) bi

So my guess is that the bibliographic records have not been modified inside the date range, but items have been added/modified outside of it (in 2014).
Comment 3 Jonathan Druart 2018-10-22 22:53:19 UTC
commit 9356c050b2fa2453912581f15938e4bc16b2cc32

    Bug 15108: OAI-PMH provider improvements


    - If items are included in the records, their timestamps are taken into
      account everywhere so that whichever is the most recent (timestamp of
      biblioitem or any of its items) is considered the record's timestamp.
Comment 4 Rudolf Byker 2018-10-26 07:28:26 UTC
Thanks for the fix. I understand now that the OAI-PMH repo wasn't broken, but the dates were just displayed incorrectly.

Are you sure we should be using the item date and not the record date?
Comment 5 Katrin Fischer 2018-10-26 10:15:11 UTC
It's using both - for libraries exporting item information to discovery, item changes also need to be visible via OAI.
Comment 6 Nick Clemens 2022-05-26 13:55:27 UTC
Seesm like this one was fixed by 15108? Closing