Making WordPress.org


Ignore:
Timestamp:
06/07/2016 10:34:18 AM (10 years ago)
Author:
tellyworth
Message:

Some simple improvements to search results - better handling of queries for titles, more of a boost to recent and popular plugins.

More tweaks to come.

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

    r3074 r3310  
    439439       
    440440                        'query'          => null,    // Search phrase
    441                         'query_fields'   => array( 'title', 'content', 'author', 'tag', 'category' ),
     441                        'query_fields'   => array( 'title^2', 'content', 'author', 'tag', 'category', 'slug_ngram', 'contributors' ),
    442442       
    443443                        'post_type'      => null,  // string or an array
     
    612612                }
    613613       
    614        
    615614                return $es_query_args;
    616615        }
     
    656655
    657656                return array(
    658                          'function_score' => array(
    659                                  'query' => $query,
    660                                  'functions' => array(
    661                                          array(
    662                                                  'gauss'=> array(
    663                                                          'date_gmt' => array(
    664                                                                  'origin' => $date_origin,
    665                                                                  'scale' => $date_scale,
    666                                                                  'decay' => $date_decay,
    667                                                          ) ),
    668                                          ),
    669                                         array(
    670                                                 'field_value_factor' => array(
    671                                                         'field' => 'comment_count',
    672                                                         'factor' => 1.0,
    673                                                         'modifier' => 'log1p',
    674                                                 ),
    675                                         ),
    676 
     657                        'filtered' => array(
     658                                'query' => array(
     659                                         'function_score' => array(
     660                                                 'query' => $query,
     661                                                 'functions' => array(
     662                                                         array(
     663                                                                 'gauss'=> array(
     664                                                                         'date_gmt' => array(
     665                                                                                 'origin' => $date_origin,
     666                                                                                 'scale' => $date_scale,
     667                                                                                 'decay' => $date_decay,
     668                                                                         ) ),
     669                                                         ),
     670                                                        array(
     671                                                                'field_value_factor' => array(
     672                                                                        'field' => 'meta.active_installs.long',
     673                                                                        'factor' => 1.0,
     674                                                                        'modifier' => 'log1p',
     675                                                                ),
     676                                                        ),
     677
     678                                                 ),
     679                                                 'boost_mode' => 'multiply'
     680                                         )
    677681                                 ),
    678                                  'boost_mode' => 'multiply'
    679                 ) );
     682                                 'filter' => array(
     683                                                'exists' => array(
     684                                                        'field' => 'meta.active_installs.long'
     685                                                )
     686                                 )
     687                        )
     688                );
    680689        }
    681690
Note: See TracChangeset for help on using the changeset viewer.