diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php index 4c3f838..58d395a 100644 --- a/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php +++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php @@ -116,6 +116,7 @@ public static function open(array &$connection_options = array()) { $pdo->sqliteCreateFunction('if', array(__CLASS__, 'sqlFunctionIf')); $pdo->sqliteCreateFunction('greatest', array(__CLASS__, 'sqlFunctionGreatest')); $pdo->sqliteCreateFunction('pow', 'pow', 2); + $pdo->sqliteCreateFunction('exp', 'exp', 1); $pdo->sqliteCreateFunction('length', 'strlen', 1); $pdo->sqliteCreateFunction('md5', 'md5', 1); $pdo->sqliteCreateFunction('concat', array(__CLASS__, 'sqlFunctionConcat')); diff --git a/core/modules/node/node.module b/core/modules/node/node.module index d0a7bcf..59a2596 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -665,14 +665,8 @@ function node_ranking() { if ($node_min_max = \Drupal::state()->get('node.min_max_update_time')) { $ranking['recent'] = array( 'title' => t('Recently created'), - 'join' => array( - 'type' => 'LEFT', - 'table' => 'node_field_data', - 'alias' => 'nfd', - 'on' => 'nfd.nid = sid', - ), // Exponential decay with half life of 14% of the age range of nodes. - 'score' => 'EXP(-5 * (1 - (nfd.created - :node_oldest) / :node_range))', + 'score' => 'EXP(-5 * (1 - (n.created - :node_oldest) / :node_range))', 'arguments' => array( ':node_oldest' => $node_min_max['min_created'], ':node_range' => max($node_min_max['max_created'] - $node_min_max['min_created'], 1), diff --git a/core/modules/search/src/SearchQuery.php b/core/modules/search/src/SearchQuery.php index 4bd0a35..95043a7 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 DECIMAL(10,4))) * COALESCE(($score), 0) / (CAST (:total_$i AS DECIMAL(10,4)))"; + $score = "(CAST (:multiply_$i AS DOUBLE PRECISION(10,4))) * COALESCE(($score), 0) / (CAST (:total_$i AS DOUBLE PRECISION(10,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 DECIMAL(10,4))) * i.score * t.count)', $pieces); + $score = implode('((CAST (:normalization_' . $this->relevance_count . ' AS DOUBLE PRECISION(10,4))) * i.score * t.count)', $pieces); $this->relevance_count++; } diff --git a/core/modules/statistics/statistics.module b/core/modules/statistics/statistics.module index 5d84cb9..3c2fab9 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 DECIMAL(10,4))))', + 'score' => '2.0 - 2.0 / (1.0 + node_counter.totalcount * (CAST (:statistics_scale AS DOUBLE PRECISION(10,4))))', 'arguments' => array(':statistics_scale' => \Drupal::state()->get('statistics.node_counter_scale') ?: 0), ), );