Changeset 3470
- Timestamp:
- 06/19/2016 12:31:50 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/libs/site-search/jetpack-search.php
r3310 r3470 251 251 $posts_per_page = 15; 252 252 253 $date_cutoff = strftime( '%Y-%m-%d', strtotime( '-2 years' ) ); 254 $date_today = strftime( '%Y-%m-%d' ); 255 253 256 // Start building the WP-style search query args 254 257 // They'll be translated to ES format args later … … 259 262 'orderby' => $query->get( 'orderby' ), 260 263 'order' => $query->get( 'order' ), 264 // plugin directory specific: 265 'date_range' => array( 'field' => 'modified', 'gte' => $date_cutoff, 'lte' => $date_today ), 261 266 ); 262 267 … … 553 558 if ( $args['query'] ) { 554 559 $analyzer = Jetpack_Search::get_analyzer_name( $this->blog_lang ); 555 $query = array( 'multi_match' => array( 556 'query' => $args['query'], 557 'fields' => $args['query_fields'], 558 'operator' => 'and', 559 'type' => 'cross_fields', 560 'analyzer' => $analyzer 561 ) ); 560 $query = array( 561 'bool' => array( 562 'must' => array( 563 'multi_match' => array( 564 'query' => $args['query'], 565 'fields' => $args['query_fields'], 566 'type' => 'cross_fields', 567 'analyzer' => $analyzer 568 ), 569 ), 570 'should' => array( 571 'multi_match' => array( 572 'query' => $args['query'], 573 'fields' => $args['query_fields'], 574 'type' => 'phrase', 575 'analyzer' => $analyzer 576 ), 577 ), 578 ), 579 ); 580 562 581 $es_query_args['query'] = Jetpack_Search::score_query_by_recency( $query ); 563 582 … … 611 630 $es_query_args['filter'] = array( 'match_all' => new stdClass() ); 612 631 } 613 632 614 633 return $es_query_args; 615 634 }
Note: See TracChangeset
for help on using the changeset viewer.