diff --git a/core/modules/search/src/SearchQuery.php b/core/modules/search/src/SearchQuery.php index 95043a7..5e44832 100644 --- a/core/modules/search/src/SearchQuery.php +++ b/core/modules/search/src/SearchQuery.php @@ -509,7 +509,7 @@ public function addScore($score, $arguments = array(), $multiply = FALSE) { $i = count($this->multiply); // Modify the score expression so it is multiplied by the multiplier, // with a divisor to renormalize. - $score = "(CAST (:multiply_$i AS DOUBLE PRECISION(10,4))) * COALESCE(($score), 0) / (CAST (:total_$i AS DOUBLE PRECISION(10,4)))"; + $score = "(ROUND(:multiply_$i, 4)) * COALESCE(($score), 0) / (ROUND(:total_$i, 4))"; // Add an argument for the multiplier. The :total_$i argument is taken // care of in the execute() method, which is when the total divisor is // calculated. @@ -524,7 +524,7 @@ public function addScore($score, $arguments = array(), $multiply = FALSE) { // in the execute() method we can add arguments. while (($pos = strpos($score, 'i.relevance')) !== FALSE) { $pieces = explode('i.relevance', $score, 2); - $score = implode('((CAST (:normalization_' . $this->relevance_count . ' AS DOUBLE PRECISION(10,4))) * i.score * t.count)', $pieces); + $score = implode('((ROUND(:normalization_' . $this->relevance_count . ', 4)) * i.score * t.count)', $pieces); $this->relevance_count++; } diff --git a/core/modules/statistics/statistics.module b/core/modules/statistics/statistics.module index 3c2fab9..e235aca 100644 --- a/core/modules/statistics/statistics.module +++ b/core/modules/statistics/statistics.module @@ -172,7 +172,7 @@ function statistics_ranking() { // to 0. Note that the CAST here is necessary for PostgreSQL, because // the PostgreSQL PDO driver sometimes puts values in as strings // instead of numbers in complex expressions like this. - 'score' => '2.0 - 2.0 / (1.0 + node_counter.totalcount * (CAST (:statistics_scale AS DOUBLE PRECISION(10,4))))', + 'score' => '2.0 - 2.0 / (1.0 + node_counter.totalcount * (ROUND(:statistics_scale, 4)))', 'arguments' => array(':statistics_scale' => \Drupal::state()->get('statistics.node_counter_scale') ?: 0), ), );