Skip to content

Commit

Permalink
Add configuration MAX_ITEMS_PER_PASS for control count of records ret…
Browse files Browse the repository at this point in the history
…urned by listrecords verb
  • Loading branch information
viniciusandrade committed Nov 6, 2013
1 parent c98d2ca commit a4b78f2
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 4 deletions.
8 changes: 7 additions & 1 deletion htdocs/isis-oai-provider/lib/ISISItemFactory.php
Expand Up @@ -33,10 +33,11 @@ function GetItem($ItemId)
}

function GetItems($StartingDate = NULL, $EndingDate = NULL, $ListStartPoint=0){
global $CONFIG;

$db = new ISISDb($this->DBName);
$ItemIds = '';
$ItemsPerPage = 20;
$ItemsPerPage = $CONFIG['INFORMATION']['MAX_ITEMS_PER_PASS'];

if ($StartingDate !== NULL){
if ($EndingDate == NULL){
Expand All @@ -56,6 +57,7 @@ function GetItems($StartingDate = NULL, $EndingDate = NULL, $ListStartPoint=0){
'id_field' => $database['identifier_field'],
'date_field' => $database['datestamp_field'],
'from' => $ListStartPoint,
'count' => $ItemsPerPage,
);
$ItemIds .= $db->getidentifiers($params, $database['isis_key_length']);

Expand All @@ -79,7 +81,10 @@ function GetItems($StartingDate = NULL, $EndingDate = NULL, $ListStartPoint=0){
# retrieve IDs of items that matches set spec (only needed if sets supported)
function GetItemsInSet($SetSpec, $StartingDate = NULL, $EndingDate = NULL, $ListStartPoint=0)
{
global $CONFIG;

$db = new ISISDb($this->DBName);
$ItemsPerPage = $CONFIG['INFORMATION']['MAX_ITEMS_PER_PASS'];

if ($StartingDate !== NULL){
if ($EndingDate == NULL){
Expand All @@ -99,6 +104,7 @@ function GetItemsInSet($SetSpec, $StartingDate = NULL, $EndingDate = NULL, $List
'id_field' => $database['identifier_field'],
'date_field' => $database['datestamp_field'],
'from' => $ListStartPoint,
'count' => $ItemsPerPage,
);
$ItemIds = $db->getidentifiers($params, $database['isis_key_length']);
}
Expand Down
4 changes: 3 additions & 1 deletion htdocs/isis-oai-provider/lib/OAIServer.php
Expand Up @@ -313,6 +313,8 @@ private function ProcessGetRecord()

private function ProcessListRecords($IncludeMetadata)
{
global $CONFIG;

# set request type
if ($IncludeMetadata)
{
Expand Down Expand Up @@ -480,7 +482,7 @@ private function ProcessListRecords($IncludeMetadata)
$ListIndex = 0;

# stop processing if we have processed max number of items in a pass
$MaxItemsPerPass = 20;
$MaxItemsPerPass = $CONFIG['INFORMATION']['MAX_ITEMS_PER_PASS'];

# for each item
foreach ($ItemIds as $ItemId)
Expand Down
2 changes: 1 addition & 1 deletion htdocs/isis-oai-provider/lib/app_version.php
@@ -1 +1 @@
<?php define(APPLICATION_VERSION,'0.3-4'); ?>
<?php define(APPLICATION_VERSION,'0.3-5'); ?>
4 changes: 4 additions & 0 deletions htdocs/isis-oai-provider/lib/parse_config.php
Expand Up @@ -10,6 +10,10 @@

$CONFIG = parse_ini_file($config_file, true);

if ( !isset($CONFIG['INFORMATION']['MAX_ITEMS_PER_PASS']) ){
$CONFIG['INFORMATION']['MAX_ITEMS_PER_PASS'] = 20;
}

define('LOG_DIR', $CONFIG['ENVIRONMENT']['DATABASE_PATH'] . $CONFIG['ENVIRONMENT']['DIRECTORY'] . '/log/');

// Log name example 201111.log
Expand Down
2 changes: 2 additions & 0 deletions htdocs/isis-oai-provider/oai-config-sample.php
Expand Up @@ -25,4 +25,6 @@
EARLIESTDATESTAMP=2011-01-01
MAX_ITEMS_PER_PASS=20
;*/ ?>
3 changes: 2 additions & 1 deletion htdocs/isis-oai-provider/wxis/getidentifiers.xis
Expand Up @@ -11,6 +11,7 @@
'5006 id_field'/
'5007 date_field'/
'5008 from'/
'5009 count'/
'6001 set'/
'6002 metadataPrefix'/
'6003 expression'/
Expand All @@ -29,7 +30,7 @@
<parm name="expression"><pft>if p(v6003) then v5005,replace(v6003,' OR ', s(' OR ',v5005)) else '$' fi</pft></parm>

<parm name="from"><pft>if v5008 = '0' then '1' else v5008 fi</pft></parm>
<parm name="count">20</parm>
<parm name="count"><pft>v5009</pft></parm>

<loop>
<field action="import" tag="list">5004/5007</field>
Expand Down

0 comments on commit a4b78f2

Please sign in to comment.