Esempio n. 1
0
 /**
  * Generates HTML shown to the user when we have a suggestion about a query
  * that might give more results than their current query.
  */
 protected function getDidYouMeanHtml(SearchResultSet $textMatches)
 {
     # mirror Go/Search behavior of original request ..
     $params = array('search' => $textMatches->getSuggestionQuery());
     if ($this->fulltext != null) {
         $params['fulltext'] = $this->fulltext;
     }
     $stParams = array_merge($params, $this->powerSearchOptions());
     $suggest = Linker::linkKnown($this->getPageTitle(), $textMatches->getSuggestionSnippet() ?: null, array(), $stParams);
     # html of did you mean... search suggestion link
     return Html::rawElement('div', array('class' => 'searchdidyoumean'), $this->msg('search-suggest')->rawParams($suggest)->parse());
 }
Esempio n. 2
0
 /**
  * Generates HTML shown to user when their query has been internally rewritten,
  * and the results of the rewritten query are being returned.
  *
  * @param string $term The users search input
  * @param SearchResultSet $textMatches The response to the users initial search request
  * @return string HTML linking the user to their original $term query, and the one
  *  suggested by $textMatches.
  */
 protected function getDidYouMeanRewrittenHtml($term, SearchResultSet $textMatches)
 {
     // Showing results for '$rewritten'
     // Search instead for '$orig'
     $params = array('search' => $textMatches->getSuggestionQuery());
     if ($this->fulltext != null) {
         $params['fulltext'] = $this->fulltext;
     }
     $stParams = array_merge($params, $this->powerSearchOptions());
     $rewritten = Linker::linkKnown($this->getPageTitle(), $textMatches->getSuggestionSnippet() ?: null, array(), $stParams);
     $stParams['search'] = $term;
     $stParams['runsuggestion'] = 0;
     $original = Linker::linkKnown($this->getPageTitle(), htmlspecialchars($term), array(), $stParams);
     return Html::rawElement('div', array('class' => 'searchdidyoumean'), $this->msg('search-rewritten')->rawParams($rewritten, $original)->escaped());
 }