plugins.trac.wordpress.org

Changeset 2147847 – WordPress Plugin Repository

  • ️Thu Aug 29 2019

Legend:

Unmodified
Added
Removed
  • elasticpress/trunk/elasticpress.php

    r2144033 r2147847  
    33 * Plugin Name: ElasticPress
    44 * Description: A fast and flexible search and query engine for WordPress.
    5  * Version:     3.1.3
     5 * Version:     3.1.4
    66 * Author:      10up
    77 * Author URI:  http://10up.com
     
    2828define( 'EP_URL', plugin_dir_url( __FILE__ ) );
    2929define( 'EP_PATH', plugin_dir_path( __FILE__ ) );
    30 define( 'EP_VERSION', '3.1.3' );
     30define( 'EP_VERSION', '3.1.4' );
    3131
    3232/**
  • elasticpress/trunk/includes/classes/Elasticsearch.php

    r2140802 r2147847  
    212212        );
    213213
    214         // If search, send the search term as a header to ES
    215         if ( isset( $query_args['s'] ) && (bool) $query_args['s'] && ! is_admin() ) {
     214        // If search, send the search term as a header to ES so the backend understands what a normal query looks like
     215        if ( isset( $query_args['s'] ) && (bool) $query_args['s'] && ! is_admin() && ! isset( $_GET['post_type'] ) ) {
    216216            $request_args['headers']['EP-Search-Term'] = $query_args['s'];
    217217        }
  • elasticpress/trunk/includes/classes/Feature/Facets/Facets.php

    r2144033 r2147847  
    263263        $tax_query = $query->get( 'tax_query', [] );
    264264
     265        // Account for taxonomies that should be woocommerce attributes, if WC is enabled
     266        $attribute_taxonomies = [];
     267        if ( function_exists( 'wc_attribute_taxonomy_name' ) ) {
     268            $all_attr_taxonomies = wc_get_attribute_taxonomies();
     269
     270            foreach ( $all_attr_taxonomies as $attr_taxonomy ) {
     271                $attribute_taxonomies[ $attr_taxonomy->attribute_name ] = wc_attribute_taxonomy_name( $attr_taxonomy->attribute_name );
     272            }
     273        }
     274
    265275        foreach ( $selected_filters['taxonomies'] as $taxonomy => $filter ) {
    266276            $tax_query[] = [
    267                 'taxonomy' => wc_attribute_taxonomy_name( $taxonomy ),
     277                'taxonomy' => isset( $attribute_taxonomies[ $taxonomy ] ) ? $attribute_taxonomies[ $taxonomy ] : $taxonomy,
    268278                'field'    => 'slug',
    269279                'terms'    => array_keys( $filter['terms'] ),
     
    292302            $GLOBALS['ep_facet_aggs'] = [];
    293303
    294             foreach ( $response['aggregations']['terms'] as $key => $agg ) {
    295                 if ( 'doc_count' === $key ) {
    296                     continue;
    297                 }
    298 
    299                 $GLOBALS['ep_facet_aggs'][ $key ] = [];
    300 
    301                 foreach ( $agg['buckets'] as $bucket ) {
    302                     $GLOBALS['ep_facet_aggs'][ $key ][ $bucket['key'] ] = $bucket['doc_count'];
     304            if ( isset( $response['aggregations']['terms'] ) && is_array( $response['aggregations']['terms'] ) ) {
     305                foreach ( $response['aggregations']['terms'] as $key => $agg ) {
     306                    if ( 'doc_count' === $key ) {
     307                        continue;
     308                    }
     309
     310                    $GLOBALS['ep_facet_aggs'][ $key ] = [];
     311
     312                    foreach ( $agg['buckets'] as $bucket ) {
     313                        $GLOBALS['ep_facet_aggs'][ $key ][ $bucket['key'] ] = $bucket['doc_count'];
     314                    }
    303315                }
    304316            }
  • elasticpress/trunk/includes/classes/Indexable/Post/Post.php

    r2144033 r2147847  
    689689            $use_filters = true;
    690690        } elseif ( ! empty( $args['author_name'] ) ) {
     691            // Since this was set to use the display name initially, there might be some code that used this feature.
     692            // Let's ensure that any query vars coming in using author_name are in fact slugs.
     693            $author_login = sanitize_user( $args['author_name'] );
    691694            $filter['bool']['must'][] = array(
    692695                'term' => array(
    693                     'post_author.raw' => $args['author'],
     696                    'post_author.login.raw' => $author_login,
    694697                ),
    695698            );
     
    13341337                    if ( ! empty( $args['meta_key'] ) ) {
    13351338                        $sort[] = array(
    1336                             'meta.' . $args['meta_key'] . '.value' => array(
     1339                            'meta.' . $args['meta_key'] . '.raw' => array(
    13371340                                'order' => $order,
    13381341                            ),
  • elasticpress/trunk/includes/classes/Indexable/User/User.php

    r2144033 r2147847  
    572572                    if ( ! empty( $query_vars['meta_key'] ) ) {
    573573                        $sort[] = array(
    574                             'meta.' . $query_vars['meta_key'] . '.value' => array(
     574                            'meta.' . $query_vars['meta_key'] . '.raw' => array(
    575575                                'order' => $order,
    576576                            ),
  • elasticpress/trunk/includes/dashboard.php

    r2127416 r2147847  
    3838    add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\action_admin_enqueue_admin_scripts' );
    3939    add_action( 'admin_init', __NAMESPACE__ . '\action_admin_init' );
    40     add_action( 'plugins_loaded', __NAMESPACE__ . '\maybe_clear_es_info_cache' );
     40    add_action( 'admin_init', __NAMESPACE__ . '\maybe_clear_es_info_cache' );
    4141    add_action( 'wp_ajax_ep_index', __NAMESPACE__ . '\action_wp_ajax_ep_index' );
    4242    add_action( 'wp_ajax_ep_notice_dismiss', __NAMESPACE__ . '\action_wp_ajax_ep_notice_dismiss' );
     
    166166    }
    167167
    168     if ( empty( $_GET['ep-retry'] ) && ! in_array( Screen::factory()->get_current_screen(), [ 'dashboard', 'settings' ], true ) ) { // phpcs:ignore WordPress.Security.NonceVerification
     168    if ( empty( $_GET['ep-retry'] ) && ! in_array( Screen::factory()->get_current_screen(), [ 'dashboard', 'settings', 'install' ], true ) ) { // phpcs:ignore WordPress.Security.NonceVerification
    169169        return;
    170170    }
     
    286286    foreach ( $notices as $notice_key => $notice ) {
    287287        ?>
    288         <div data-ep-notice="<?php echo esc_attr( $notice_key ); ?>" class="notice notice-<?php echo esc_attr( $notice['type'] ); ?> <?php if ( $notice['dismiss'] ) : ?>is-dismissible<?php endif; ?>">
     288        <div data-ep-notice="<?php echo esc_attr( $notice_key ); ?>" class="notice notice-<?php echo esc_attr( $notice['type'] ); ?> <?php
     289        if ( $notice['dismiss'] ) :
     290            ?>
     291            is-dismissible<?php endif; ?>">
    289292            <p>
    290293                <?php echo wp_kses( $notice['html'], 'ep-html' ); ?>

Note: See TracChangeset for help on using the changeset viewer.