/**
  * Modifies the search form by providing an additional marker linking to a
  * new query with the suggestions provided by Solr as the search terms.
  *
  * @param	array	An array of existing form markers
  * @param	tx_solr_Template	An isntance of the tempalte engine
  * @return	array	Array with additional markers for suggestions
  */
 public function modifyForm(array $markers, tx_solr_Template $template)
 {
     $spellCheckingEnabled = $this->configuration['search.']['spellchecking'];
     if ($spellCheckingEnabled && $this->search->hasSearched()) {
         $suggestions = $this->search->getSpellcheckingSuggestions();
         if ($suggestions) {
             $query = clone $this->search->getQuery();
             $query->setKeywords($suggestions['collation']);
             $markers['suggestion'] = tslib_cObj::noTrimWrap($query->getQueryLink($query->getKeywords()), $this->configuration['search.']['spellchecking.']['wrap']);
         }
     }
     return $markers;
 }
コード例 #2
0
 /**
  * Generates a link with spell checking suggestions if it is activated and
  * spell checking suggestions are returned by Solr.
  *
  * @return	string	A link to start over with a new search using the suggested keywords.
  */
 public function getSpellCheckingSuggestions()
 {
     $suggestionsLink = '';
     if ($this->configuration['search.']['spellchecking'] && $this->search->hasSearched()) {
         $suggestions = $this->getSuggestions();
         if ($suggestions && !$suggestions['correctlySpelled'] && !empty($suggestions['collation'])) {
             $suggestionsLink = tslib_cObj::noTrimWrap($this->getSuggestionQueryLink(), $this->configuration['search.']['spellchecking.']['wrap']);
         }
     }
     return $suggestionsLink;
 }