From 63e096535a4c271a96e62264d35893f65eaefb5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20L=C3=B6ytynoja?= <101459373+vloy@users.noreply.github.com> Date: Fri, 6 Sep 2024 08:04:02 +0300 Subject: [PATCH] RediPress now properly forwards queries with NOT EXISTS to MySQL if it cannot handle them. (#142) * RediPress now properly forwards queries with NOT EXISTS to MySQL if it cannot handle them. * CR fixes. --- CHANGELOG.md | 5 +++++ plugin.php | 2 +- src/Search/QueryBuilder.php | 8 ++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 092ebf3..0e49b50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [2.0.11] - 2024-09-06 + +### Fixed +- RediPress now properly forwards queries with NOT EXISTS to MySQL if it cannot handle them. + ## [2.0.10] - 2024-08-16 ### Fixed diff --git a/plugin.php b/plugin.php index 636796b..b090310 100644 --- a/plugin.php +++ b/plugin.php @@ -3,7 +3,7 @@ * Plugin Name: RediPress * Plugin URI: https://github.com/devgeniem/redipress * Description: A WordPress plugin that provides a blazing fast search engine and WP Query performance enhancements. - * Version: 2.0.10 + * Version: 2.0.11 * Author: Geniem * Author URI: http://www.geniem.fi/ * License: GPL3 diff --git a/src/Search/QueryBuilder.php b/src/Search/QueryBuilder.php index d1d2bf7..2f955d3 100644 --- a/src/Search/QueryBuilder.php +++ b/src/Search/QueryBuilder.php @@ -539,9 +539,9 @@ public function get_groupby() : array { /** * WP_Query meta_query parameter. * - * @return string|null + * @return string */ - protected function meta_query() : ?string { + protected function meta_query() : string { if ( ! empty( $this->meta_query ) ) { return $this->meta_query; } @@ -559,7 +559,7 @@ protected function meta_query() : ?string { return $query; } else { - return null; + return ''; } } @@ -1046,7 +1046,7 @@ protected function create_meta_clause( array $clause ) : ?string { 'NOT IN' => 'not_in', ]; - // Escape dashes from the values. To prevent numeric values from being escaped, + // Escape dashes from the values. To prevent numeric values from being escaped, // meta_query's type attribute must be set to numeric data type. $clause['value'] = Utility::escape_value_by_meta_type( $clause['value'], $type );