Exemple #1
0
 protected function getDataFromSolr($wikiId, $articleId)
 {
     $service = new \SolrDocumentService();
     $service->setCrossWiki(false);
     $service->setWikiId($wikiId);
     $service->setArticleId($articleId);
     $result = $service->getResult();
     return $result;
 }
 /**
  * Gets the article type using Solr.
  * Since SolrDocumentService uses memoization, we will NOT do an additional Solr request
  * because of this method - both snippet and article type can use the same memoized
  * result
  *
  * @return string The plain text as stored in solr. Will be empty if we don't have a result.
  */
 public function getArticleType()
 {
     if (!$this->article instanceof Article) {
         return '';
     }
     $service = new SolrDocumentService();
     $service->setArticleId($this->article->getId());
     $document = $service->getResult();
     $text = '';
     if ($document !== null) {
         if (!empty($document[static::SOLR_ARTICLE_TYPE_FIELD])) {
             $text = $document[static::SOLR_ARTICLE_TYPE_FIELD];
         }
     }
     return $text;
 }