prepareAndNormalize example

// If the normalization value was zero, that indicates there were no     // matches to the supplied positive keywords.     $this->status |= SearchQuery::NO_KEYWORD_MATCHES;
    return FALSE;
  }

  /** * {@inheritdoc} */
  public function preExecute(SelectInterface $query = NULL) {
    if (!$this->executedPrepare) {
      $this->prepareAndNormalize();
    }

    if (!$this->normalize) {
      return FALSE;
    }

    return parent::preExecute($query);
  }

  /** * Adds a custom score expression to the search query. * * Score expressions are used to order search results. If no calls to * addScore() have taken place, a default keyword relevance score will be * used. However, if at least one call to addScore() has taken place, the * keyword relevance score is not automatically added. * * Note that you must use this method to add ordering to your searches, and * not call orderBy() directly, when using the SearchQuery extender. This is * because of the two-pass system the SearchQuery class uses to normalize * scores. * * @param string $score * The score expression, which should evaluate to a number between 0 and 1. * The string 'i.relevance' in a score expression will be replaced by a * measure of keyword relevance between 0 and 1. * @param array $arguments * Query arguments needed to provide values to the score expression. * @param float $multiply * If set, the score is multiplied with this value. However, all scores * with multipliers are then divided by the total of all multipliers, so * that overall, the normalization is maintained. * * @return $this */
Home | Imprint | This part of the site doesn't use cookies.