Ejemplo n.º 1
0
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct('');
     // todo, is this really needed? Because it is not used from outside, can we remove it?
     $this->configuration = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['moreLikeThis.'];
     $this->setQueryType('mlt');
 }
Ejemplo n.º 2
0
 /**
  * SuggestQuery constructor.
  *
  * @param string $keywords
  * @param TypoScriptConfiguration $solrConfiguration
  */
 public function __construct($keywords, $solrConfiguration = null)
 {
     $keywords = (string) $keywords;
     if ($solrConfiguration == null) {
         $solrConfiguration = Util::getSolrConfiguration();
     }
     parent::__construct('', $solrConfiguration);
     $this->configuration = $solrConfiguration->getObjectByPathOrDefault('plugin.tx_solr.suggest.', []);
     if (!empty($this->configuration['treatMultipleTermsAsSingleTerm'])) {
         $this->prefix = $this->escape($keywords);
     } else {
         $matches = array();
         preg_match('/^(:?(.* |))([^ ]+)$/', $keywords, $matches);
         $fullKeywords = trim($matches[2]);
         $partialKeyword = trim($matches[3]);
         $this->setKeywords($fullKeywords);
         $this->prefix = $this->escape($partialKeyword);
     }
     $this->setAlternativeQuery('*:*');
 }