LibreCat / Catmandu-SRU

Catmandu module for working with SRU data.
https://metacpan.org/release/Catmandu-SRU
5 stars 5 forks source link

First record position out of range #44

Closed herreio closed 4 years ago

herreio commented 4 years ago

With the following command, I just experienced the same issue as mentioned in #28:

$ catmandu convert SRU --base http://sru.gbv.de/gjz18 --query 'pica.plc=Halle' --recordSchema picaxml --parser picaxml

All of the 1670 records matching the query are retrieved correctly but in the end a “First record position out of range”-error is thrown:

info:srw/diagnostic/1/61 : First record position out of range at /home/herreio/perl5/lib/perl5/Catmandu/Importer/SRU.pm line 269.

I am working with Perl version 5.26.1 and Catmandu::Importer::SRU version 0.428.

herreio commented 4 years ago

As assumed by @cKlee in #28 it seems to be related to decadic number of records. Beside the example above I am also encountering the issue with the following commands returning numberOfRecords with modulo 10 = 0.

50 records:

catmandu convert SRU --base http://sru.gbv.de/gjz18 --query pica.zzd=9825228 --recordSchema picaxml --parser picaxml
info:srw/diagnostic/1/61 : First record position out of range at /home/herreio/perl5/lib/perl5/Catmandu/Importer/SRU.pm line 269

3400 records:

catmandu convert SRU --base http://sru.gbv.de/gjz18 --query pica.zzd=3124253 --recordSchema picaxml --parser picaxml
info:srw/diagnostic/1/61 : First record position out of range at /home/herreio/perl5/lib/perl5/Catmandu/Importer/SRU.pm line 269

260 records:

catmandu convert SRU --base http://sru.gbv.de/gjz18 --query pica.zzd=5308823 --recordSchema picaxml --parser picaxml
info:srw/diagnostic/1/61 : First record position out of range at /home/herreio/perl5/lib/perl5/Catmandu/Importer/SRU.pm line 269

The records however are completely retrieved.

nichtich commented 4 years ago

Looks like the current implementation does not stop following requests if startRecord >numberOfRecords but assumes that SRU implementations will silently return zero records on the last try.

nichtich commented 4 years ago

I was able to reproduce the error and to solve it on the dev branch, not released yet.

herreio commented 4 years ago

perfect, thanks for having a look and fixing it. dev branch is working fine on my side. looking forward for the release!