From 503d0953162c0edee44d5d63a5f7ae6e1ef7fdc7 Mon Sep 17 00:00:00 2001 From: Allan Collins Date: Mon, 11 Feb 2019 11:54:21 -0700 Subject: [PATCH 1/2] readme.md update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 28b25b8347..5df8a3669e 100644 --- a/README.md +++ b/README.md @@ -524,7 +524,7 @@ The following commands are supported by ElasticPress: * `wp elasticpress put-mapping [--network-wide]` - Sends plugin put mapping to the current blog index. `--network-wide` will force mappings to be sent for every index in the network. + Sends plugin put mapping to the current blog index (this will delete the index). `--network-wide` will force mappings to be sent for every index in the network. * `wp elasticpress recreate-network-alias` From fc3967f95032b7034bbda379e87e7734b20d63bf Mon Sep 17 00:00:00 2001 From: Allan Collins Date: Wed, 13 Feb 2019 13:34:41 -0700 Subject: [PATCH 2/2] Version 2.8.1 (#1248) * readme.md update * Add ES max version supported (#1244) * Skip post meta for index if meta key empty/false. (#1241) * Changes to sticky posts (#1245) * Changes to sticky posts. * Removing redundant code. * Do not allow 0 to be set as bulk settings (#1247) * Do not allow 0 on bulk settings * Simplify sanitize logic. * Do not allow negative values * Version bump for 2.8.1 --- README.md | 2 ++ classes/class-ep-api.php | 23 ++++++++++++++++++++--- classes/class-ep-config.php | 11 +++++++++++ classes/class-ep-dashboard.php | 2 +- elasticpress.php | 4 ++-- readme.txt | 6 ++++++ 6 files changed, 42 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5df8a3669e..2ea1ba27f3 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ A fast and flexible search and query engine for WordPress. **Upgrade Notice:** Versions 1.6.1, 1.6.2, 1.7, 1.8, 2.1, 2.1.2, 2.2, 2.7 require re-syncing. +**ElasticSearch max version supported: 6.3** + ElasticPress, a fast and flexible search and query engine for WordPress, enables WordPress to find or “query” relevant content extremely fast through a variety of highly customizable features. WordPress out-of-the-box struggles to analyze content relevancy and can be very slow. ElasticPress supercharges your WordPress website making for happier users and administrators. The plugin even contains features for popular plugins.

diff --git a/classes/class-ep-api.php b/classes/class-ep-api.php index 1fae72f440..bc8725ba9a 100644 --- a/classes/class-ep-api.php +++ b/classes/class-ep-api.php @@ -863,6 +863,11 @@ public function prepare_meta_types( $post_meta ) { $meta = array(); foreach ( $post_meta as $meta_key => $meta_values ) { + // Skip if no meta key. + if ( ! $meta_key ) { + continue; + } + if ( ! is_array( $meta_values ) ) { $meta_values = array( $meta_values ); } @@ -1534,12 +1539,24 @@ public function format_args( $args ) { * Sticky posts support */ // Check first if there's sticky posts and show them only in the front page + $sticky_posts = get_option( 'sticky_posts' ); + $sticky_posts = ( is_array( $sticky_posts ) && empty( $sticky_posts ) ) ? false : $sticky_posts; + if( false !== $sticky_posts && is_home() && in_array( $args['ignore_sticky_posts'], array( 'false', 0 ) ) ) { - //let's eliminate sort so it does not mess with function_score results - $formatted_args['sort'] = array(); + + $new_sort = array( + array( + '_score' => array( + 'order' => 'desc', + ), + ) + ); + + $formatted_args['sort'] = array_merge( $new_sort, $formatted_args['sort'] ); + $formatted_args_query = $formatted_args['query']; $formatted_args['query'] = array(); $formatted_args['query']['function_score']['query'] = $formatted_args_query; @@ -1549,7 +1566,7 @@ public function format_args( $args ) { 'filter' => array( 'terms' => array( '_id' => $sticky_posts ) ), - 'weight' => 2 + 'weight' => 20 ) ); } diff --git a/classes/class-ep-config.php b/classes/class-ep-config.php index 8d5130fc47..117cce671a 100644 --- a/classes/class-ep-config.php +++ b/classes/class-ep-config.php @@ -366,6 +366,17 @@ function ep_sanitize_credentials( $credentials ) { ]; } +/** + * Sanitize bulk settings. + * + * @param $bulk_settings + * @return int + */ +function ep_sanitize_bulk_settings( $bulk_settings = 350 ) { + $bulk_settings = absint( $bulk_settings ); + return ( 0 === $bulk_settings ) ? 350 : $bulk_settings; +} + /** * Prepare credentials if they are set for future use. */ diff --git a/classes/class-ep-dashboard.php b/classes/class-ep-dashboard.php index ae65ec90c4..018c7e0a9d 100644 --- a/classes/class-ep-dashboard.php +++ b/classes/class-ep-dashboard.php @@ -919,7 +919,7 @@ public function action_admin_init() { register_setting( 'elasticpress', 'ep_host', 'esc_url_raw' ); register_setting( 'elasticpress', 'ep_prefix', 'sanitize_text_field' ); register_setting( 'elasticpress', 'ep_credentials', 'ep_sanitize_credentials' ); - register_setting( 'elasticpress', 'ep_bulk_setting', array( 'type' => 'integer', 'sanitize_callback' => 'absint' ) ); + register_setting( 'elasticpress', 'ep_bulk_setting', array( 'type' => 'integer', 'sanitize_callback' => 'ep_sanitize_bulk_settings' ) ); } } diff --git a/elasticpress.php b/elasticpress.php index 2ff4650d4d..ce2a3f35aa 100644 --- a/elasticpress.php +++ b/elasticpress.php @@ -3,7 +3,7 @@ /** * Plugin Name: ElasticPress * Description: A fast and flexible search and query engine for WordPress. - * Version: 2.8.0 + * Version: 2.8.1 * Author: Taylor Lovett, Matt Gross, Aaron Holbrook, 10up * Author URI: http://10up.com * License: GPLv2 or later @@ -22,7 +22,7 @@ define( 'EP_URL', plugin_dir_url( __FILE__ ) ); define( 'EP_PATH', plugin_dir_path( __FILE__ ) ); -define( 'EP_VERSION', '2.8.0' ); +define( 'EP_VERSION', '2.8.1' ); /** * We compare the current ES version to this compatibility version number. Compatibility is true when: diff --git a/readme.txt b/readme.txt index 6d91c42e42..c00c94979a 100644 --- a/readme.txt +++ b/readme.txt @@ -40,6 +40,12 @@ Please refer to [Github](https://github.com/10up/ElasticPress) for detailed usag == Changelog == += 2.8.1 = + +* Bugfix for homepage out of chronological order. +* Bugfix for missing meta key. (Props [turtlepod](https://github.com/turtlepod)) +* Bugfix for bulk indexing default value on settings page. + = 2.8.0 = ElasticPress 2.8 provides some new enhancements and bug fixes.