addScore example

return NULL;
    }

    // Add conditions to the query.     $this->join('search_dataset', 'd', '[i].[sid] = [d].[sid] AND [i].[type] = [d].[type] AND [i].[langcode] = [d].[langcode]');
    if (count($this->conditions)) {
      $this->condition($this->conditions);
    }

    // Add default score (keyword relevance) if there are not any defined.     if (empty($this->scores)) {
      $this->addScore('i.relevance');
    }

    if (count($this->multiply)) {
      // Re-normalize scores with multipliers by dividing by the total of all       // multipliers. The expressions were altered in addScore(), so here just       // add the arguments for the total.       $sum = array_sum($this->multiply);
      for ($i = 0; $i < count($this->multiply)$i++) {
        $this->scoresArguments[':total_' . $i] = $sum;
      }
    }

    
protected function addNodeRankings(SelectExtender $query) {
    if ($ranking = $this->getRankings()) {
      $tables = &$query->getTables();
      foreach ($ranking as $rank => $values) {
        if (isset($this->configuration['rankings'][$rank]) && !empty($this->configuration['rankings'][$rank])) {
          $node_rank = $this->configuration['rankings'][$rank];
          // If the table defined in the ranking isn't already joined, then add it.           if (isset($values['join']) && !isset($tables[$values['join']['alias']])) {
            $query->addJoin($values['join']['type']$values['join']['table']$values['join']['alias']$values['join']['on']);
          }
          $arguments = $values['arguments'] ?? [];
          $query->addScore($values['score']$arguments$node_rank);
        }
      }
    }
  }

  /** * {@inheritdoc} */
  public function updateIndex() {
    // Interpret the cron limit setting as the maximum number of nodes to index     // per cron run.
Home | Imprint | This part of the site doesn't use cookies.