Пример #1
0
 /**
  * Decide if the suggested query should be run, and it's results returned
  * instead of the provided $textMatches
  *
  * @param SearchResultSet $textMatches The results of a users query
  * @return bool
  */
 protected function shouldRunSuggestedQuery(SearchResultSet $textMatches)
 {
     if (!$this->runSuggestion || !$textMatches->hasSuggestion() || $textMatches->numRows() > 0 || $textMatches->searchContainedSyntax()) {
         return false;
     }
     return $this->getConfig()->get('SearchRunSuggestedQuery');
 }
Пример #2
0
 /**
  * Decide if the suggested query should be run, and it's results returned
  * instead of the provided $textMatches
  *
  * @param SearchResultSet $textMatches The results of a users query
  * @return bool
  */
 protected function shouldRunSuggestedQuery(SearchResultSet $textMatches)
 {
     if (!$this->runSuggestion || !$textMatches->hasSuggestion() || $textMatches->numRows() > 0 || $textMatches->searchContainedSyntax()) {
         return false;
     }
     // Generate a random number between 0 and 1. If the
     // number is less than the desired percentages run it.
     $rand = rand(0, getrandmax()) / getrandmax();
     return $this->getConfig()->get('SearchRunSuggestedQueryPercent') > $rand;
 }