/**
  * 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->_documents = $this->_result->getDocuments();
     $this->_start += $this->getPrefetch();
 }
 /**
  * Accepts a Solarium select result and a search config.
  * If not the root search result set, you should provide the parent and metaposition.
  * @param Solarium_Result_Select $result
  * @param WikiaSearchConfig $searchConfig
  * @param WikiaSearchResultSet $parent
  * @param int $metaposition
  */
 public function __construct(Solarium_Result_Select $result, WikiaSearchConfig $searchConfig, $parent = null, $metaposition = null)
 {
     wfProfileIn(__METHOD__);
     parent::__construct();
     $this->searchResultObject = $result;
     $this->searchConfig = $searchConfig;
     $this->setQuery($searchConfig->getQuery(WikiaSearchConfig::QUERY_ENCODED));
     if ($result instanceof Solarium_Result_Select_Empty) {
         return;
     }
     if ($parent === null && $this->searchConfig->getGroupResults()) {
         $this->setResultGroupings($result, $searchConfig);
         $this->setResultsFound($this->getHostGrouping()->getMatches());
     } else {
         $this->parent = $parent;
         $this->metaposition = $metaposition;
         $this->highlightingObject = $result->getHighlighting();
         $this->setResultsStart($result->getStart())->setQueryTime($result->getQueryTime());
         if ($this->parent !== null && $this->metaposition !== null) {
             $this->prepareChildResultSet();
         } else {
             // default behavior for an ungrouped search result set
             $this->prependArticleMatchIfExists()->setResults($this->searchResultObject->getDocuments())->setResultsFound($this->resultsFound + $this->searchResultObject->getNumFound());
         }
     }
     wfProfileOut(__METHOD__);
 }
Ejemplo n.º 3
0
 public function testGetDocuments()
 {
     $this->assertEquals($this->_docs, $this->_result->getDocuments());
 }