| @@ -22,9 +22,9 @@ | ||
| 22 | 22 | * Search algorithm slug. |
| 23 | 23 | * |
| 24 | 24 | * @return string |
| 25 | 25 | */ |
| 26 | - public function get_slug() : string { | |
| 26 | + public function get_slug(): string { | |
| 27 | 27 | return '4.0'; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
| @@ -31,9 +31,9 @@ | ||
| 31 | 31 | * Search algorithm name. |
| 32 | 32 | * |
| 33 | 33 | * @return string |
| 34 | 34 | */ |
| 35 | - public function get_name() : string { | |
| 35 | + public function get_name(): string { | |
| 36 | 36 | return esc_html__( 'Version 4.0', 'elasticpress' ); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
| @@ -40,10 +40,10 @@ | ||
| 40 | 40 | * Search algorithm description. |
| 41 | 41 | * |
| 42 | 42 | * @return string |
| 43 | 43 | */ |
| 44 | - public function get_description() : string { | |
| 45 | - return esc_html__( 'Version 4.0', 'elasticpress' ); | |
| 44 | + public function get_description(): string { | |
| 45 | + return esc_html__( 'Search for all search terms in one field first, then prioritize them over search terms matched in different fields.', 'elasticpress' ); | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Return the Elasticsearch `query` clause. |
| @@ -53,9 +53,9 @@ | ||
| 53 | 53 | * @param array $search_fields Search fields |
| 54 | 54 | * @param array $query_vars Query vars |
| 55 | 55 | * @return array ES `query` |
| 56 | 56 | */ |
| 57 | - protected function get_raw_query( string $indexable_slug, string $search_term, array $search_fields, array $query_vars ) : array { | |
| 57 | + protected function get_raw_query( string $indexable_slug, string $search_term, array $search_fields, array $query_vars ): array { | |
| 58 | 58 | $query = [ |
| 59 | 59 | 'bool' => [ |
| 60 | 60 | 'should' => [ |
| 61 | 61 | [ |
| @@ -125,9 +125,9 @@ | ||
| 125 | 125 | * @param array $search_fields Search term(s) |
| 126 | 126 | * @param array $query_vars Query vars |
| 127 | 127 | * @return array ES `query` |
| 128 | 128 | */ |
| 129 | - protected function apply_legacy_filters( array $query, string $indexable_slug, array $search_fields, array $query_vars ) : array { | |
| 129 | + protected function apply_legacy_filters( array $query, string $indexable_slug, array $search_fields, array $query_vars ): array { | |
| 130 | 130 | if ( 'post' !== $indexable_slug ) { |
| 131 | 131 | return $query; |
| 132 | 132 | } |
| 133 | 133 | |
| @@ -133,9 +133,9 @@ | ||
| 133 | 133 | |
| 134 | 134 | /** This filter is documented in /includes/classes/SearchAlgorithm/Basic.php */ |
| 135 | 135 | $query['bool']['should'][0]['multi_match']['boost'] = apply_filters_deprecated( |
| 136 | 136 | 'ep_match_phrase_boost', |
| 137 | - [ 3, $search_fields, $query_vars ], | |
| 137 | + [ $query['bool']['should'][0]['multi_match']['boost'], $search_fields, $query_vars ], | |
| 138 | 138 | '4.3.0', |
| 139 | 139 | 'ep_post_match_phrase_boost' |
| 140 | 140 | ); |
| 141 | 141 | |
| @@ -141,9 +141,9 @@ | ||
| 141 | 141 | |
| 142 | 142 | /** This filter is documented in /includes/classes/SearchAlgorithm/Basic.php */ |
| 143 | 143 | $query['bool']['should'][1]['multi_match']['boost'] = apply_filters_deprecated( |
| 144 | 144 | 'ep_match_boost', |
| 145 | - [ 1, $search_fields, $query_vars ], | |
| 145 | + [ $query['bool']['should'][1]['multi_match']['boost'], $search_fields, $query_vars ], | |
| 146 | 146 | '4.3.0', |
| 147 | 147 | 'ep_post_match_boost' |
| 148 | 148 | ); |
| 149 | 149 | |
| @@ -160,9 +160,9 @@ | ||
| 160 | 160 | * @return {string} New fuzziness |
| 161 | 161 | */ |
| 162 | 162 | $query['bool']['should'][1]['multi_match']['fuzziness'] = apply_filters_deprecated( |
| 163 | 163 | 'ep_match_fuzziness', |
| 164 | - [ 'auto', $search_fields, $query_vars ], | |
| 164 | + [ $query['bool']['should'][1]['multi_match']['fuzziness'], $search_fields, $query_vars ], | |
| 165 | 165 | '4.3.0', |
| 166 | 166 | 'ep_post_match_fuzziness' |
| 167 | 167 | ); |
| 168 | 168 | |
| @@ -179,9 +179,9 @@ | ||
| 179 | 179 | * @return {int} New boost |
| 180 | 180 | */ |
| 181 | 181 | $query['bool']['should'][2]['multi_match']['boost'] = apply_filters_deprecated( |
| 182 | 182 | 'ep_match_cross_fields_boost', |
| 183 | - [ 1, $search_fields, $query_vars ], | |
| 183 | + [ $query['bool']['should'][2]['multi_match']['boost'], $search_fields, $query_vars ], | |
| 184 | 184 | '4.3.0', |
| 185 | 185 | 'ep_post_match_cross_fields_boost' |
| 186 | 186 | ); |
| 187 | 187 | |