コード例 #1
0
ファイル: Backend.php プロジェクト: grharry/vufind
 /**
  * Retrieve a batch of documents.
  *
  * @param array    $ids    Array of document identifiers
  * @param ParamBag $params Search backend parameters
  *
  * @return RecordCollectionInterface
  */
 public function retrieveBatch($ids, ParamBag $params = null)
 {
     // Load 50 records at a time; this is the limit for Summon.
     $pageSize = 50;
     // Retrieve records a page at a time:
     $results = false;
     while (count($ids) > 0) {
         $currentPage = array_splice($ids, 0, $pageSize, []);
         $query = new SummonQuery(null, ['idsToFetch' => $currentPage, 'pageNumber' => 1, 'pageSize' => $pageSize]);
         $next = $this->createRecordCollection($this->connector->query($query));
         if (!$results) {
             $results = $next;
         } else {
             foreach ($next->getRecords() as $record) {
                 $results->add($record);
             }
         }
     }
     $this->injectSourceIdentifier($results);
     return $results;
 }
コード例 #2
0
ファイル: BackendTest.php プロジェクト: htw-pk15/vufind
 /**
  * @return void
  */
 public function testDataAmountMoreThanZero()
 {
     $result = $this->connector->query(new Query('a'));
     $this->assertTrue(count($result['documents']) > 0, "More than zero documents found.");
 }