/**
  * @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;
 }
Example #3
0
 public function testSetAndGetRows()
 {
     $this->query->setRows(100);
     $this->assertEquals(100, $this->query->getRows());
 }