Changeset 36354
- Timestamp:
- 01/20/2016 04:37:13 AM (9 years ago)
- Location:
- branches/4.4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.4
-
branches/4.4/src/wp-includes/query.php
r36281 r36354 2301 2301 } 2302 2302 2303 $search_orderby = ' (CASE';2303 $search_orderby = ''; 2304 2304 2305 2305 // sentence match in 'post_title' … … 2322 2322 $search_orderby .= $wpdb->prepare( "WHEN $wpdb->posts.post_content LIKE %s THEN 4 ", $like ); 2323 2323 } 2324 $search_orderby .= 'ELSE 5 END)'; 2324 2325 if ( $search_orderby ) { 2326 $search_orderby = '(CASE ' . $search_orderby . 'ELSE 5 END)'; 2327 } 2325 2328 } else { 2326 2329 // single word or sentence search -
branches/4.4/tests/phpunit/tests/query/search.php
r35242 r36354 126 126 $this->assertEqualSets( array( $p3 ), $q->posts ); 127 127 } 128 129 /** 130 * @ticket 35361 131 */ 132 public function test_search_orderby_should_be_empty_when_search_string_is_longer_than_6_words_and_exclusion_operator_is_used() { 133 $q = new WP_Query( array( 134 's' => 'foo1 foo2 foo3 foo4 foo5 foo6 foo7 -bar', 135 'fields' => 'ids', 136 ) ); 137 138 $this->assertNotRegExp( '|ORDER BY \(CASE[^\)]+\)|', $q->request ); 139 } 128 140 }
Note: See TracChangeset
for help on using the changeset viewer.