Пример #1
0
 /**
  * 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
 /**
  * @return void
  */
 public function testDataAmountMoreThanZero()
 {
     $result = $this->connector->query(new Query('a'));
     $this->assertTrue(count($result['documents']) > 0, "More than zero documents found.");
 }