← All changes
|
includes/classes/SearchAlgorithm/DefaultAlgorithm.php
+9
-9
4.3.1
→
5.3.5
View file →
| @@ -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 'default'; |
| 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__( 'Default', '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__( 'Default', 'elasticpress' ); | |
| 44 | + public function get_description(): string { | |
| 45 | + return esc_html__( 'Use a fuzzy match approach which includes results that have misspellings, and also includes matches on only some of the words in the search.', '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 | [ |
| @@ -129,9 +129,9 @@ | ||
| 129 | 129 | * @param array $search_fields Search term(s) |
| 130 | 130 | * @param array $query_vars Query vars |
| 131 | 131 | * @return array ES `query` |
| 132 | 132 | */ |
| 133 | - protected function apply_legacy_filters( array $query, string $indexable_slug, array $search_fields, array $query_vars ) : array { | |
| 133 | + protected function apply_legacy_filters( array $query, string $indexable_slug, array $search_fields, array $query_vars ): array { | |
| 134 | 134 | if ( 'post' !== $indexable_slug ) { |
| 135 | 135 | return $query; |
| 136 | 136 | } |
| 137 | 137 | |
| @@ -147,9 +147,9 @@ | ||
| 147 | 147 | * @return {int} New boost amount |
| 148 | 148 | */ |
| 149 | 149 | $query['bool']['should'][0]['multi_match']['boost'] = apply_filters_deprecated( |
| 150 | 150 | 'ep_match_phrase_boost', |
| 151 | - [ 4, $search_fields, $query_vars ], | |
| 151 | + [ $query['bool']['should'][0]['multi_match']['boost'], $search_fields, $query_vars ], | |
| 152 | 152 | '4.3.0', |
| 153 | 153 | 'ep_post_match_phrase_boost' |
| 154 | 154 | ); |
| 155 | 155 | |
| @@ -165,9 +165,9 @@ | ||
| 165 | 165 | * @return {int} New boost |
| 166 | 166 | */ |
| 167 | 167 | $query['bool']['should'][1]['multi_match']['boost'] = apply_filters_deprecated( |
| 168 | 168 | 'ep_match_boost', |
| 169 | - [ 2, $search_fields, $query_vars ], | |
| 169 | + [ $query['bool']['should'][1]['multi_match']['boost'], $search_fields, $query_vars ], | |
| 170 | 170 | '4.3.0', |
| 171 | 171 | 'ep_post_match_boost' |
| 172 | 172 | ); |
| 173 | 173 | |
| @@ -183,9 +183,9 @@ | ||
| 183 | 183 | * @return {int} New fuzziness |
| 184 | 184 | */ |
| 185 | 185 | $query['bool']['should'][2]['multi_match']['fuzziness'] = apply_filters_deprecated( |
| 186 | 186 | 'ep_fuzziness_arg', |
| 187 | - [ 1, $search_fields, $query_vars ], | |
| 187 | + [ $query['bool']['should'][2]['multi_match']['fuzziness'], $search_fields, $query_vars ], | |
| 188 | 188 | '4.3.0', |
| 189 | 189 | 'ep_post_fuzziness_arg' |
| 190 | 190 | ); |
| 191 | 191 | |