Making WordPress.org

Changeset 3571


Ignore:
Timestamp:
06/24/2016 11:26:17 AM (8 years ago)
Author:
tellyworth
Message:

Plugin directory search: boost the translated title, not just title_en; include excerpt in search fields.

See #1692

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/libs/site-search/jetpack-search.php

    r3568 r3571  
    281281        $locale = get_locale();
    282282        if ( $locale && $locale !== 'en' && $locale !== 'en_US' ) {
    283             $es_wp_query_args['query_fields'] = array( "title_{$locale}^2", 'title_en^0.5', "content_{$locale}^2", 'content_en^0.5', 'author', 'tag', 'category', 'slug_ngram', 'contributors' );
     283            $es_wp_query_args['query_fields'] = array( "title_{$locale}^2", 'title_en^0.5', "content_{$locale}^2", 'content_en^0.5', "excerpt_{$locale}", 'excerpt_en', 'author', 'tag', 'category', 'slug_ngram', 'contributors' );
     284            $es_wp_query_args['boost_fields'] = array( "title_{$locale}", 'title_en' );
    284285        } else {
    285             $es_wp_query_args['query_fields'] = array( 'title_en^2', 'content_en', 'author', 'tag', 'category', 'slug_ngram', 'contributors' );
     286            $es_wp_query_args['query_fields'] = array( 'title_en^2', 'content_en', 'excerpt_en', 'author', 'tag', 'category', 'slug_ngram', 'contributors' );
     287            $es_wp_query_args['boost_fields'] = array( 'title_en' );
    286288        }
    287289
     
    616618                            'multi_match' => array(
    617619                                'query'  => $args['query'],
    618                                 'fields' => 'title',
     620                                'fields' => $args['boost_fields'],
    619621                                'type'  => 'phrase',
    620622                                'analyzer' => $analyzer,
Note: See TracChangeset for help on using the changeset viewer.