Exemple #1
0
 /**
  * Fetch the next set of results
  *
  * @return void
  */
 protected function fetchNext()
 {
     $this->query->setStart($this->start)->setRows($this->getPrefetch());
     $this->result = $this->client->execute($this->query, $this->getOption('endpoint'));
     $this->documents = $this->result->getDocuments();
     $this->start += $this->getPrefetch();
 }
 /**
  * @param Query $query
  * @param callable $transform
  * @param null $readEndpoint
  * @param null $writeEndpoint
  * @param bool $commit
  * @internal param null $endpoint
  */
 public function updateBufferedNoPlugin(Query $query, callable $transform, $readEndpoint = null, $writeEndpoint = null, $commit = true)
 {
     $nbRows = count($this->solarium->execute($query->setRows(0), $readEndpoint));
     $update = $this->solarium->createUpdate();
     for ($offset = 0; $offset <= $nbRows; $offset += $this->buffer) {
         $query->setStart($offset)->setRows($this->buffer);
         $documents = $this->solarium->execute($query, $readEndpoint);
         foreach ($documents as $document) {
             $update->addDocument($transform($document));
         }
         $this->solarium->execute($update, $writeEndpoint);
         $update = $this->solarium->createUpdate();
     }
     if ($nbRows > 0 && $commit === true) {
         $this->solarium->execute($update->addCommit(), $writeEndpoint);
     }
 }
 /**
  * @return array
  * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
  */
 public function getDetail()
 {
     $arguments = $this->getRequestArguments();
     $id = $arguments['id'];
     $assignments = [];
     if ($this->settings['paging']['detailPagePaging'] && array_key_exists('underlyingQuery', $arguments)) {
         // If underlying query has been sent, fetch more data to enable paging arrows.
         $underlyingQueryInfo = $arguments['underlyingQuery'];
         $index = FrontendUtility::getIndexes($underlyingQueryInfo);
         foreach ($arguments['underlyingQuery'] as $key => $value) {
             $arguments[$key] = $value;
         }
         $this->createQueryForArguments($arguments);
         $this->query->setStart($index['previousIndex']);
         $this->query->setRows($index['nextIndex'] - $index['previousIndex'] + 1);
         $assignments = $this->getRecordsWithUnderlyingQuery($assignments, $index, $id, $arguments);
     } else {
         // Without underlying query information, just get the record specified.
         $assignments = $this->getTheRecordSpecified($id, $assignments);
     }
     return $assignments;
 }
 public function testSetAndGetStart()
 {
     $this->query->setStart(234);
     $this->assertEquals(234, $this->query->getStart());
 }
Exemple #5
0
 public function applyPaging($offset, $limit)
 {
     $this->ensureNotExecuted();
     $this->selectQuery->setStart($offset)->setRows($limit);
 }