Demon has submitted this change and it was merged.

Change subject: bug 45266; needs parallel changes to lucene_search_2
......................................................................


bug 45266; needs parallel changes to lucene_search_2

See Change id: I31bde27a7a64e0d9fff340843f56fe6c6d8a322a
Restore original oaiChunkSize value; use TABs for indentation.

Change-Id: I07d5c2cedcd7550505b53d380d13111bd83e3216
---
M OAIRepo_body.php
1 file changed, 17 insertions(+), 9 deletions(-)

Approvals:
  Demon: Verified; Looks good to me, approved



diff --git a/OAIRepo_body.php b/OAIRepo_body.php
index c92b086..d9f86fe 100644
--- a/OAIRepo_body.php
+++ b/OAIRepo_body.php
@@ -276,7 +276,7 @@
                                        'oa_agent' => 
@$_SERVER['HTTP_USER_AGENT'],
                                        'oa_dbname' => $wgDBname,
                                        'oa_response_size' => $responseSize,
-                                       'oa_request' => wfArrayToCGI( 
$this->_request ),
+                                       'oa_request' => wfArrayToCgi( 
$this->_request ),
                                ),
                                __METHOD__ );
                }
@@ -478,7 +478,7 @@
                        }
                }
 
-               # Fetch one extra row to check if we need a resumptionToken
+               # Fetch one extra row to check if we need multiple transfers
                $resultSet = $this->fetchRows( $from, $until, 
$this->chunkSize() + 1, $resume );
                $count = min( $resultSet->numRows(), $this->chunkSize() );
                if( $count ) {
@@ -486,18 +486,28 @@
                        // buffer everything up
                        $rows = array();
                        $this->_lastSequence = null;
+                       $max = -1;
                        for( $i = 0; $i < $count; $i++ ) {
                                $row = $resultSet->fetchObject();
                                $rows[] = $row;
-                               $this->_lastSequence = $row->up_sequence;
+                               $seq = $row->up_sequence;
+                               $this->_lastSequence = $seq;
+                               if ( $seq > $max ) {
+                                   $max = $seq;
+                               }
                        }
                        $row = $resultSet->fetchObject();
                        if( $row ) {
                                $limit = wfTimestamp( TS_MW, $until );
-                               if( $until )
+                               if( $until ) {
                                        $nextToken = 
"$metadataPrefix:$row->up_sequence:$limit";
-                               else
-                                       $nextToken = 
"$metadataPrefix:$row->up_sequence";
+                               } else {
+                                       /* last colon indicates need for 
multiple transfers*/
+                                       $nextToken = 
"$metadataPrefix:$row->up_sequence:";
+                               }
+                       } else {
+                               $max += 1;
+                               $nextToken = "$metadataPrefix:$max";
                        }
                        $resultSet->free();
                        // init writer
@@ -511,9 +521,7 @@
                                        echo $item->renderHeader( 
$this->timeGranularity() );
                                }
                        }
-                       if( isset( $nextToken ) ) {
-                               echo oaiTag( 'resumptionToken', array(), 
$nextToken ) . "\n";
-                       }
+                       echo oaiTag( 'resumptionToken', array(), $nextToken ) . 
"\n";
                        echo "</$verb>\n";
                } else {
                        $this->addError( 'noRecordsMatch', 'No records 
available match the request.' );

-- 
To view, visit https://gerrit.wikimedia.org/r/51078
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I07d5c2cedcd7550505b53d380d13111bd83e3216
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/OAI
Gerrit-Branch: master
Gerrit-Owner: Ram <[email protected]>
Gerrit-Reviewer: Demon <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to