var $searchTerms = array();
var $namespaces = array( NS_MAIN );
var $showRedirects = false;
+ protected $showSuggestion = true;
/// Feature values
protected $features = array();
$this->namespaces = $namespaces;
}
+ /**
+ * Set whether the searcher should try to build a suggestion. Note: some searchers
+ * don't support building a suggestion in the first place and others don't respect
+ * this flag.
+ *
+ * @param boolean $showSuggestion should the searcher try to build suggestions
+ */
+ function setShowSuggestion( $showSuggestion ) {
+ $this->showSuggestion = $showSuggestion;
+ }
+
/**
* Parse some common prefixes: all (search everything)
* or namespace names
}
$t = Title::newFromText( $term );
+ $showSuggestion = $t === null || !$t->isKnown();
+ $search->setShowSuggestion( $showSuggestion );
// fetch search results
$rewritten = $search->replacePrefixes( $term );
}
// did you mean... suggestions
- if ( $textMatches && !$textStatus && $textMatches->hasSuggestion() ) {
+ if ( $showSuggestion && $textMatches && !$textStatus && $textMatches->hasSuggestion() ) {
$st = SpecialPage::getTitleFor( 'Search' );
# mirror Go/Search behavior of original request ..