Relevanssi – A Better Search - Version 4.14.7

Version Description

  • User interface: The synonym settings page now alerts if the synonyms aren't active because of the AND search.
Download this release

Release Info

Developer msaari
Plugin Icon 128x128 Relevanssi – A Better Search
Version 4.14.7
Comparing to
See all releases

Code changes from version 4.14.6 to 4.14.7

changelog.txt CHANGED
@@ -1,3 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  = 4.10.2 =
2
  * New feature: You can force Relevanssi to be active by setting the query variable `relevanssi` to `true`. Thanks to Jan Willem Oostendorp.
3
  * Changed behaviour: Relevanssi has been moved from `the_posts` filter to `posts_pre_query`. This change doesn't do much, but increases performance slightly as WordPress needs to do less useless work, as now the default query is no longer run. Thanks to Jan Willem Oostendorp.
1
+ = 4.13.3.1 =
2
+ * Minor fix: The Bricks compatibility was broken. This version fixes it.
3
+
4
+ = 4.13.3 =
5
+ * New feature: You can now add a post type dropdown to search forms with the [searchform] shortcode with the parameter 'dropdown' set to 'post_type'.
6
+ * New feature: Adds compatibility for Product GTIN (EAN, UPC, ISBN) for WooCommerce plugin.
7
+ * New feature: New filter hook `relevanssi_post_to_excerpt` lets you filter the post object before an excerpt is created from it.
8
+ * New feature: Relevanssi is now compatible with the Bricks page builder theme (requires Bricks 1.3.2).
9
+ * Minor fix: The ″ character is now counted as a quote.
10
+ * Minor fix: Running indexing through WP CLI doesn't cause PHP notices anymore.
11
+ * Minor fix: Sometimes the Did you mean would return really weird long suggestions from the search logs. That won't happen anymore.
12
+ * Minor fix: Improves tax_query handling in fringe cases with multiple AND clauses joined together with OR.
13
+ * Minor fix: Oxygen compatibility has been improved. Rich text fields and updating posts when they are saved in Oxygen now work better, and revisions are no longer indexed.
14
+ * Minor fix: Searching without a search term works much better now, you get more posts in the results (default value is up to 500).
15
+
16
+ = 4.13.2 =
17
+ * New feature: Adds support for Avada Live Search.
18
+ * New feature: Adds support for Fibo Search.
19
+ * Minor fix: Elementor library searches are not broken anymore when Relevanssi is enabled in admin.
20
+ * Minor fix: Relevanssi now understands array-style post_type[] parameters.
21
+ * Minor fix: Relevanssi now automatically considers the Turkish 'ı' the same as 'i'.
22
+
23
+ = 4.13.1 =
24
+ * New feature: Adds compatibility for WP-Members plugin, preventing blocked posts from showing up in the search results.
25
+ * New feature: New function `relevanssi_get_attachment_suffix()` can be used to return the attachment file suffix based on a post object or a post ID.
26
+ * Minor fix: Improves the Oxygen compatibility. Now also the [oxygen] shortcode tags are removed.
27
+
28
+ = 4.13.0 =
29
+ * New feature: New filter hook `relevanssi_phrase` filters each phrase before it's used in the MySQL query.
30
+ * New feature: Relevanssi can now add Google-style missing term lists to the search results. You can either use the `%missing%` tag in the search results breakdown settings, or you can create your own code: the missing terms are also in `$post->missing_terms`. Relevanssi Premium will also add "Must have" links when there's just one missing term.
31
+ * New feature: New filter hook `relevanssi_missing_terms_tag` controls which tag is used to wrap the missing terms.
32
+ * New feature: New filter hook `relevanssi_missing_terms_template` can be used to filter the template used to display the missing terms.
33
+ * New feature: New function `relevanssi_get_post_meta_for_all_posts()` can be used to fetch particular meta field for a number of posts with just one query.
34
+ * New feature: New filter hook `relevanssi_post_author` lets you filter the post author display_name before it is indexed.
35
+ * Changed behaviour: `relevanssi_strip_tags()` used to add spaces between HTML tags before stripping them. It no longer does that, but instead adds a space after specific list of tags (p, br, h1-h6, div, blockquote, hr, li, img) to avoid words being stuck to each other in excerpts.
36
+ * Changed behaviour: Relevanssi now indexes the contents of Oxygen Builder PHP & HTML code blocks.
37
+ * Changed behaviour: Relevanssi now handles synonyms inside phrases differently. If the new filter hook `relevanssi_phrase_synonyms` returns `true` (default value), synonyms create a new phrase (with synonym 'dog=hound', phrase `"dog biscuits"` becomes `"dog biscuits" "hound biscuits"`). If the value is `false`, synonyms inside phrases are ignored.
38
+ * Minor fix: Warnings when creating excerpts with search terms that contain a slash were removed.
39
+ * Minor fix: Better Ninja Tables compatibility to avoid problems with lightbox images.
40
+ * Minor fix: Relevanssi did not work well in the Media Library grid view. Relevanssi is now blocked there. If you need Relevanssi in Media Library searches, use the list view.
41
+ * Minor fix: Relevanssi excerpt creation didn't work correctly when numerical search terms were used.
42
+
43
+ = 4.12.5 =
44
+ * Changed behaviour: `relevanssi_excerpt_custom_field_content` now gets the post ID and list of custom field names as a parameter.
45
+ * Minor fix: Makes sure Relevanssi options are not wiped when the free version is deleted while Premium is active.
46
+ * Minor fix: Adds a trailing slash to the blog URL in Did you mean links.
47
+
48
+ = 4.12.4 =
49
+ * New feature: New action hooks `relevanssi_pre_the_content` and `relevanssi_post_the_content` fire before and after Relevanssi applies `the_content` filter to the post excerpts. Some Relevanssi default behaviour has been moved to these hooks so it can be modified.
50
+ * Changed behaviour: The `relevanssi_do_not_index` gets the post object as a third parameter.
51
+ * Minor fix: Remove errors from `relevanssi_strip_all_tags()` getting a `null` parameter.
52
+
53
+ = 4.12.3 =
54
+ * Major fix: Post type weights did not work; improving the caching had broken them.
55
+ * Minor fix: Relevanssi works better with soft hyphens now, removing them in indexing and excerpt-building.
56
+ * Minor fix: Stops indexing error messages in WPML.
57
+
58
+ = 4.12.2 =
59
+ * Major fix: Stops more problems with ACF custom field indexing.
60
+ * Major fix: Fixes a bug in search result caching that caused Relevanssi to make lots of unnecessary database queries.
61
+
62
+ = 4.12.1 =
63
+ * Major fix: Stops TypeError crashes from null custom field indexing.
64
+
65
+ = 4.12.0 =
66
+ * New feature: New filter hook `relevanssi_phrase_queries` can be used to add phrase matching queries to support more content types.
67
+ * New feature: New filter hook `relevanssi_excerpt_gap` lets you adjust the first line of excerpt optimization.
68
+ * Changed behaviour: The `relevanssi_admin_search_element` filter hook now gets the post object as the second parameter, rendering the filter hook more useful.
69
+ * Changed behaviour: Relevanssi now automatically optimizes excerpt creation in long posts. You can still use `relevanssi_optimize_excerpts` for further optimization, but it's probably not necessary.
70
+ * Changed behaviour: The `relevanssi_tag_before_tokenize` filter hook parameters were changed in order to be actually useful and to match what the filter hook is supposed to do.
71
+ * Minor fix: In some cases Relevanssi wouldn't highlight the last word of the title. This is more reliable now.
72
+ * Minor fix: Relevanssi will now add the `highlight` parameter only to search results, and not to other links on the search results page.
73
+ * Minor fix: Improved fringe cases in nested taxonomy queries.
74
+ * Minor fix: Taxonomy terms in WPML were not indexed correctly. Instead of the post language, the current language was used, so if your admin dashboard is in English, German posts would get English translations of the terms, not German. This is now fixed.
75
+ * Minor fix: Excerpt creation is now faster when multiple excerpts are not used.
76
+ * Minor fix: The SEO plugin noindex setting did not actually work. That has been fixed now.
77
+
78
+ = 4.11.1 =
79
+ * Major fix: The type hinting introduced for some functions turned out to be too strict, causing fatal errors. The type hinting has been relaxed (using nullable types would help, but that's a PHP 7.4 feature, and we don't want that).
80
+
81
+ = 4.11.0 =
82
+ * New feature: New filter hook `relevanssi_rendered_block` filters Gutenberg block content after the block has been rendered with `render_block()`.
83
+ * New feature: New filter hook `relevanssi_log_query` can be used to filter the search query before it's logged. This can be used to log instead the query that includes synonyms (available as a parameter to the filter hook).
84
+ * New feature: New filter hook `relevanssi_add_all_results` can be used to make Relevanssi add a list of all result IDs found to `$query->relevanssi_all_results`. Just make this hook return `true`.
85
+ * New feature: New filter hook `relevanssi_acceptable_hooks` can be used to adjust where in WP admin the Relevanssi admin javascripts are enqueued.
86
+ * New feature: Support for All-in-One SEO. Posts marked as 'Robots No Index' are not indexed by Relevanssi.
87
+ * New feature: New setting in advanced indexing settings to control whether Relevanssi respects the SEO plugin 'noindex' setting or not.
88
+ * Changed behaviour: Type hinting has been added to Relevanssi functions, which may cause errors if the filter functions are sloppy with data types.
89
+ * Changed behaviour: `relevanssi_the_title()` now supports the same parameters as `the_title()`, so you can just replace `the_title()` with it and keep everything else the same. The old behaviour is still supported.
90
+ * Changed behaviour: Relevanssi no longer logs queries with the added synonyms. You can use the `relevanssi_log_query` filter hook to return to the previous behaviour of logging the synonyms too. Thanks to Jan Willem Oostendorp.
91
+ * Changed behaviour: When using ACF and custom fields indexing set to 'all', Relevanssi will no longer index the meta fields (where the content begins with `field_`).
92
+ * Minor fix: The Oxygen compatibility made it impossible to index other custom fields than the Oxygen `ct_builder_shortcodes`. This has been improved now.
93
+ * Minor fix: Old legacy scripts that caused Javascript warnings on admin pages have been removed.
94
+ * Minor fix: In some cases, having less than or greater than symbols in PDF content would block that PDF content from being indexed.
95
+
96
  = 4.10.2 =
97
  * New feature: You can force Relevanssi to be active by setting the query variable `relevanssi` to `true`. Thanks to Jan Willem Oostendorp.
98
  * Changed behaviour: Relevanssi has been moved from `the_posts` filter to `posts_pre_query`. This change doesn't do much, but increases performance slightly as WordPress needs to do less useless work, as now the default query is no longer run. Thanks to Jan Willem Oostendorp.
lib/excerpts-highlights.php CHANGED
@@ -940,7 +940,7 @@ function relevanssi_remove_nested_highlights( $string, $begin, $end ) {
940
  }
941
 
942
  /**
943
- * Finds the locations of each word.
944
  *
945
  * Originally lifted from http://www.boyter.org/2013/04/building-a-search-result-extract-generator-in-php/
946
  * Finds the location of each word in the fulltext.
940
  }
941
 
942
  /**
943
+ * Finds the locations of each word.
944
  *
945
  * Originally lifted from http://www.boyter.org/2013/04/building-a-search-result-extract-generator-in-php/
946
  * Finds the location of each word in the fulltext.
lib/indexing.php CHANGED
@@ -149,8 +149,9 @@ function relevanssi_generate_indexing_query( $valid_status, $extend = false, $re
149
  * 2.8.0 in March 2020. Remove this eventually.
150
  */
151
  if ( is_string( $restriction ) ) {
152
- $restriction['mysql'] = $restriction;
153
- $restriction['reason'] = 'relevanssi_indexing_restriction filter';
 
154
  }
155
 
156
  if ( ! $extend ) {
149
  * 2.8.0 in March 2020. Remove this eventually.
150
  */
151
  if ( is_string( $restriction ) ) {
152
+ $restriction_array['mysql'] = $restriction;
153
+ $restriction_array['reason'] = 'relevanssi_indexing_restriction filter';
154
+ $restriction = $restriction_array;
155
  }
156
 
157
  if ( ! $extend ) {
lib/interface.php CHANGED
@@ -24,7 +24,7 @@ function relevanssi_options() {
24
  if ( ! empty( $_REQUEST ) ) {
25
  if ( isset( $_REQUEST['submit'] ) ) {
26
  check_admin_referer( plugin_basename( $relevanssi_variables['file'] ), 'relevanssi_options' );
27
- update_relevanssi_options();
28
  }
29
 
30
  if ( isset( $_REQUEST['import_options'] ) ) {
24
  if ( ! empty( $_REQUEST ) ) {
25
  if ( isset( $_REQUEST['submit'] ) ) {
26
  check_admin_referer( plugin_basename( $relevanssi_variables['file'] ), 'relevanssi_options' );
27
+ update_relevanssi_options( $_REQUEST );
28
  }
29
 
30
  if ( isset( $_REQUEST['import_options'] ) ) {
lib/options.php CHANGED
@@ -11,21 +11,16 @@
11
  /**
12
  * Updates Relevanssi options.
13
  *
14
- * Checks the option values and updates the options. It's safe to use $_REQUEST
15
  * here, check_admin_referer() is done immediately before this function is
16
  * called.
 
 
17
  */
18
- function update_relevanssi_options() {
19
- // phpcs:disable WordPress.Security.NonceVerification
20
- $data = relevanssi_process_weights_and_indexing( $_REQUEST );
21
- $post_type_weights = $data['post_type_weights'];
22
- $index_post_types = $data['index_post_types'];
23
- $index_taxonomies_list = $data['index_taxonomies_list'];
24
- $index_terms_list = $data['index_terms_list'];
25
-
26
- if ( 'indexing' === $_REQUEST['tab'] ) {
27
  relevanssi_turn_off_options(
28
- $_REQUEST,
29
  array(
30
  'relevanssi_expand_shortcodes',
31
  'relevanssi_index_author',
@@ -34,17 +29,13 @@ function update_relevanssi_options() {
34
  'relevanssi_seo_noindex',
35
  )
36
  );
37
- relevanssi_update_intval( $_REQUEST, 'relevanssi_min_word_length', true, 3 );
38
- update_option( 'relevanssi_index_taxonomies_list', array_keys( $index_taxonomies_list ), false );
39
- if ( RELEVANSSI_PREMIUM ) {
40
- update_option( 'relevanssi_index_terms', array_keys( $index_terms_list ), false );
41
- }
42
- do_action( 'relevanssi_indexing_options', $_REQUEST );
43
  }
44
 
45
- if ( 'searching' === $_REQUEST['tab'] ) {
46
  relevanssi_turn_off_options(
47
- $_REQUEST,
48
  array(
49
  'relevanssi_admin_search',
50
  'relevanssi_disable_or_fallback',
@@ -55,14 +46,14 @@ function update_relevanssi_options() {
55
  'relevanssi_wpml_only_current',
56
  )
57
  );
58
- relevanssi_update_floatval( $_REQUEST, 'relevanssi_content_boost', true, 1, true );
59
- relevanssi_update_floatval( $_REQUEST, 'relevanssi_title_boost', true, 1, true );
60
- relevanssi_update_floatval( $_REQUEST, 'relevanssi_comment_boost', true, 1, true );
61
  }
62
 
63
- if ( 'logging' === $_REQUEST['tab'] ) {
64
  relevanssi_turn_off_options(
65
- $_REQUEST,
66
  array(
67
  'relevanssi_log_queries',
68
  'relevanssi_log_queries_with_ip',
@@ -70,9 +61,9 @@ function update_relevanssi_options() {
70
  );
71
  }
72
 
73
- if ( 'excerpts' === $_REQUEST['tab'] ) {
74
  relevanssi_turn_off_options(
75
- $_REQUEST,
76
  array(
77
  'relevanssi_excerpt_custom_fields',
78
  'relevanssi_excerpts',
@@ -83,111 +74,23 @@ function update_relevanssi_options() {
83
  'relevanssi_show_matches',
84
  )
85
  );
86
- if ( isset( $_REQUEST['relevanssi_show_matches_text'] ) ) {
87
- $value = $_REQUEST['relevanssi_show_matches_text'];
88
  $value = str_replace( '"', "'", $value );
89
  update_option( 'relevanssi_show_matches_text', $value );
90
  }
 
91
  }
92
 
93
- if ( isset( $_REQUEST['relevanssi_synonyms'] ) ) {
94
- $linefeeds = array( "\r\n", "\n", "\r" );
95
- $value = str_replace( $linefeeds, ';', $_REQUEST['relevanssi_synonyms'] );
96
- $value = stripslashes( $value );
97
-
98
- $synonym_option = get_option( 'relevanssi_synonyms', array() );
99
- $current_language = relevanssi_get_current_language();
100
-
101
- $synonym_option[ $current_language ] = $value;
102
-
103
- update_option( 'relevanssi_synonyms', $synonym_option );
104
- }
105
-
106
- $relevanssi_punct = array();
107
- if ( isset( $_REQUEST['relevanssi_punct_quotes'] ) ) {
108
- $relevanssi_punct['quotes'] = $_REQUEST['relevanssi_punct_quotes'];
109
- }
110
- if ( isset( $_REQUEST['relevanssi_punct_hyphens'] ) ) {
111
- $relevanssi_punct['hyphens'] = $_REQUEST['relevanssi_punct_hyphens'];
112
- }
113
- if ( isset( $_REQUEST['relevanssi_punct_ampersands'] ) ) {
114
- $relevanssi_punct['ampersands'] = $_REQUEST['relevanssi_punct_ampersands'];
115
- }
116
- if ( isset( $_REQUEST['relevanssi_punct_decimals'] ) ) {
117
- $relevanssi_punct['decimals'] = $_REQUEST['relevanssi_punct_decimals'];
118
- }
119
- if ( ! empty( $relevanssi_punct ) ) {
120
- update_option( 'relevanssi_punctuation', $relevanssi_punct );
121
- }
122
-
123
- if ( count( $post_type_weights ) > 0 ) {
124
- update_option( 'relevanssi_post_type_weights', $post_type_weights );
125
- }
126
-
127
- if ( count( $index_post_types ) > 0 ) {
128
- update_option( 'relevanssi_index_post_types', array_keys( $index_post_types ) );
129
- }
130
-
131
- if ( isset( $_REQUEST['relevanssi_index_fields_select'] ) ) {
132
- $fields_option = '';
133
- if ( 'all' === $_REQUEST['relevanssi_index_fields_select'] ) {
134
- $fields_option = 'all';
135
- }
136
- if ( 'visible' === $_REQUEST['relevanssi_index_fields_select'] ) {
137
- $fields_option = 'visible';
138
- }
139
- if ( 'some' === $_REQUEST['relevanssi_index_fields_select'] ) {
140
- if ( isset( $_REQUEST['relevanssi_index_fields'] ) ) {
141
- $fields_option = rtrim( $_REQUEST['relevanssi_index_fields'], " \t\n\r\0\x0B," );
142
- }
143
- }
144
- update_option( 'relevanssi_index_fields', $fields_option, false );
145
- }
146
-
147
- if ( isset( $_REQUEST['relevanssi_trim_logs'] ) ) {
148
- $trim_logs = $_REQUEST['relevanssi_trim_logs'];
149
- if ( ! is_numeric( $trim_logs ) || $trim_logs < 0 ) {
150
- $trim_logs = 0;
151
- }
152
- update_option( 'relevanssi_trim_logs', $trim_logs );
153
- }
154
-
155
- if ( isset( $_REQUEST['relevanssi_cat'] ) ) {
156
- if ( is_array( $_REQUEST['relevanssi_cat'] ) ) {
157
- $csv_cats = implode( ',', $_REQUEST['relevanssi_cat'] );
158
- update_option( 'relevanssi_cat', $csv_cats );
159
- }
160
- } else {
161
- if ( isset( $_REQUEST['relevanssi_cat_active'] ) ) {
162
- update_option( 'relevanssi_cat', '' );
163
- }
164
- }
165
-
166
- if ( isset( $_REQUEST['relevanssi_excat'] ) ) {
167
- if ( is_array( $_REQUEST['relevanssi_excat'] ) ) {
168
- $array_excats = $_REQUEST['relevanssi_excat'];
169
- $cat = get_option( 'relevanssi_cat' );
170
- if ( $cat ) {
171
- $array_cats = explode( ',', $cat );
172
- $valid_excats = array();
173
- foreach ( $array_excats as $excat ) {
174
- if ( ! in_array( $excat, $array_cats, true ) ) {
175
- $valid_excats[] = $excat;
176
- }
177
- }
178
- } else {
179
- // No category restrictions, so everything's good.
180
- $valid_excats = $array_excats;
181
- }
182
- $csv_excats = implode( ',', $valid_excats );
183
- update_option( 'relevanssi_excat', $csv_excats );
184
- }
185
- } else {
186
- if ( isset( $_REQUEST['relevanssi_excat_active'] ) ) {
187
- update_option( 'relevanssi_excat', '' );
188
- }
189
- }
190
 
 
191
  $options = array(
192
  'relevanssi_admin_search' => false,
193
  'relevanssi_bg_col' => true,
@@ -224,25 +127,22 @@ function update_relevanssi_options() {
224
  'relevanssi_wpml_only_current' => true,
225
  );
226
 
227
- if ( isset( $_REQUEST['relevanssi_exclude_posts'] ) ) {
228
- $_REQUEST['relevanssi_exclude_posts'] = trim( $_REQUEST['relevanssi_exclude_posts'], ' ,' );
229
  }
230
 
231
  array_walk(
232
  $options,
233
- function( $autoload, $option ) {
234
- if ( isset( $_REQUEST[ $option ] ) ) {
235
- update_option( $option, $_REQUEST[ $option ], $autoload );
236
  }
237
  }
238
  );
239
 
240
- relevanssi_update_intval( $_REQUEST, 'relevanssi_excerpt_length', true, 10 );
241
-
242
  if ( function_exists( 'relevanssi_update_premium_options' ) ) {
243
  relevanssi_update_premium_options();
244
  }
245
- // phpcs:enable
246
  }
247
 
248
  /**
@@ -251,9 +151,7 @@ function update_relevanssi_options() {
251
  * Goes through all options and picks up all options that have names that
252
  * contain post types, taxonomies and so on.
253
  *
254
- * @param array $request The $_REQUEST array.
255
- *
256
- * @return array Four arrays containing the required data.
257
  */
258
  function relevanssi_process_weights_and_indexing( $request ) {
259
  $post_type_weights = array();
@@ -297,14 +195,21 @@ function relevanssi_process_weights_and_indexing( $request ) {
297
  }
298
  }
299
 
300
- $post_type_weights = array_map( 'relevanssi_sanitize_weights', $post_type_weights );
 
 
 
301
 
302
- return array(
303
- 'post_type_weights' => $post_type_weights,
304
- 'index_post_types' => $index_post_types,
305
- 'index_taxonomies_list' => $index_taxonomies_list,
306
- 'index_terms_list' => $index_terms_list,
307
- );
 
 
 
 
308
  }
309
 
310
  /**
@@ -322,3 +227,156 @@ function relevanssi_sanitize_weights( $weight ) {
322
  }
323
  return $weight;
324
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  /**
12
  * Updates Relevanssi options.
13
  *
14
+ * Checks the option values and updates the options. It's safe to use $request
15
  * here, check_admin_referer() is done immediately before this function is
16
  * called.
17
+ *
18
+ * @param array $request The request array from $_REQUEST.
19
  */
20
+ function update_relevanssi_options( array $request ) {
21
+ if ( 'indexing' === $request['tab'] ) {
 
 
 
 
 
 
 
22
  relevanssi_turn_off_options(
23
+ $request,
24
  array(
25
  'relevanssi_expand_shortcodes',
26
  'relevanssi_index_author',
29
  'relevanssi_seo_noindex',
30
  )
31
  );
32
+ relevanssi_update_intval( $request, 'relevanssi_min_word_length', true, 3 );
33
+ do_action( 'relevanssi_indexing_options', $request );
 
 
 
 
34
  }
35
 
36
+ if ( 'searching' === $request['tab'] ) {
37
  relevanssi_turn_off_options(
38
+ $request,
39
  array(
40
  'relevanssi_admin_search',
41
  'relevanssi_disable_or_fallback',
46
  'relevanssi_wpml_only_current',
47
  )
48
  );
49
+ relevanssi_update_floatval( $request, 'relevanssi_content_boost', true, 1, true );
50
+ relevanssi_update_floatval( $request, 'relevanssi_title_boost', true, 1, true );
51
+ relevanssi_update_floatval( $request, 'relevanssi_comment_boost', true, 1, true );
52
  }
53
 
54
+ if ( 'logging' === $request['tab'] ) {
55
  relevanssi_turn_off_options(
56
+ $request,
57
  array(
58
  'relevanssi_log_queries',
59
  'relevanssi_log_queries_with_ip',
61
  );
62
  }
63
 
64
+ if ( 'excerpts' === $request['tab'] ) {
65
  relevanssi_turn_off_options(
66
+ $request,
67
  array(
68
  'relevanssi_excerpt_custom_fields',
69
  'relevanssi_excerpts',
74
  'relevanssi_show_matches',
75
  )
76
  );
77
+ if ( isset( $request['relevanssi_show_matches_text'] ) ) {
78
+ $value = $request['relevanssi_show_matches_text'];
79
  $value = str_replace( '"', "'", $value );
80
  update_option( 'relevanssi_show_matches_text', $value );
81
  }
82
+ relevanssi_update_intval( $request, 'relevanssi_excerpt_length', true, 10 );
83
  }
84
 
85
+ relevanssi_process_weights_and_indexing( $request );
86
+ relevanssi_process_synonym_options( $request );
87
+ relevanssi_process_punctuation_options( $request );
88
+ relevanssi_process_index_fields_option( $request );
89
+ relevanssi_process_trim_logs_option( $request );
90
+ relevanssi_process_cat_option( $request );
91
+ relevanssi_process_excat_option( $request );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
+ // The values control the autoloading.
94
  $options = array(
95
  'relevanssi_admin_search' => false,
96
  'relevanssi_bg_col' => true,
127
  'relevanssi_wpml_only_current' => true,
128
  );
129
 
130
+ if ( isset( $request['relevanssi_exclude_posts'] ) ) {
131
+ $request['relevanssi_exclude_posts'] = trim( $request['relevanssi_exclude_posts'], ' ,' );
132
  }
133
 
134
  array_walk(
135
  $options,
136
+ function( $autoload, $option ) use ( $request ) {
137
+ if ( isset( $request[ $option ] ) ) {
138
+ update_option( $option, $request[ $option ], $autoload );
139
  }
140
  }
141
  );
142
 
 
 
143
  if ( function_exists( 'relevanssi_update_premium_options' ) ) {
144
  relevanssi_update_premium_options();
145
  }
 
146
  }
147
 
148
  /**
151
  * Goes through all options and picks up all options that have names that
152
  * contain post types, taxonomies and so on.
153
  *
154
+ * @param array $request The $request array.
 
 
155
  */
156
  function relevanssi_process_weights_and_indexing( $request ) {
157
  $post_type_weights = array();
195
  }
196
  }
197
 
198
+ if ( count( $post_type_weights ) > 0 ) {
199
+ $post_type_weights = array_map( 'relevanssi_sanitize_weights', $post_type_weights );
200
+ update_option( 'relevanssi_post_type_weights', $post_type_weights );
201
+ }
202
 
203
+ if ( count( $index_post_types ) > 0 ) {
204
+ update_option( 'relevanssi_index_post_types', array_keys( $index_post_types ) );
205
+ }
206
+
207
+ if ( 'indexing' === $request['tab'] ) {
208
+ update_option( 'relevanssi_index_taxonomies_list', array_keys( $index_taxonomies_list ), false );
209
+ if ( RELEVANSSI_PREMIUM ) {
210
+ update_option( 'relevanssi_index_terms', array_keys( $index_terms_list ), false );
211
+ }
212
+ }
213
  }
214
 
215
  /**
227
  }
228
  return $weight;
229
  }
230
+
231
+ /**
232
+ * Compiles the punctuation settings from the request and updates the option.
233
+ *
234
+ * @param array $request The request array.
235
+ *
236
+ * @return boolean True, if update_option() succeeds, false otherwise.
237
+ */
238
+ function relevanssi_process_punctuation_options( array $request ) : bool {
239
+ $relevanssi_punct = array();
240
+ if ( isset( $request['relevanssi_punct_quotes'] ) ) {
241
+ $relevanssi_punct['quotes'] = $request['relevanssi_punct_quotes'];
242
+ }
243
+ if ( isset( $request['relevanssi_punct_hyphens'] ) ) {
244
+ $relevanssi_punct['hyphens'] = $request['relevanssi_punct_hyphens'];
245
+ }
246
+ if ( isset( $request['relevanssi_punct_ampersands'] ) ) {
247
+ $relevanssi_punct['ampersands'] = $request['relevanssi_punct_ampersands'];
248
+ }
249
+ if ( isset( $request['relevanssi_punct_decimals'] ) ) {
250
+ $relevanssi_punct['decimals'] = $request['relevanssi_punct_decimals'];
251
+ }
252
+ if ( ! empty( $relevanssi_punct ) ) {
253
+ return update_option( 'relevanssi_punctuation', $relevanssi_punct );
254
+ }
255
+ return false;
256
+ }
257
+
258
+ /**
259
+ * Updates the synonym option in the current language.
260
+ *
261
+ * @param array $request The request array.
262
+ *
263
+ * @return boolean True, if update_option() succeeds, false otherwise.
264
+ */
265
+ function relevanssi_process_synonym_options( array $request ) : bool {
266
+ if ( isset( $request['relevanssi_synonyms'] ) ) {
267
+ $linefeeds = array( "\r\n", "\n", "\r" );
268
+ $value = str_replace( $linefeeds, ';', $request['relevanssi_synonyms'] );
269
+ $value = stripslashes( $value );
270
+
271
+ $synonym_option = get_option( 'relevanssi_synonyms', array() );
272
+ $current_language = relevanssi_get_current_language();
273
+
274
+ $synonym_option[ $current_language ] = $value;
275
+
276
+ return update_option( 'relevanssi_synonyms', $synonym_option );
277
+ }
278
+ return false;
279
+ }
280
+
281
+ /**
282
+ * Updates the index_fields option in the current language.
283
+ *
284
+ * @param array $request The request array.
285
+ *
286
+ * @return boolean True, if update_option() succeeds, false otherwise.
287
+ */
288
+ function relevanssi_process_index_fields_option( array $request ) : bool {
289
+ if ( isset( $request['relevanssi_index_fields_select'] ) ) {
290
+ $fields_option = '';
291
+ if ( 'all' === $request['relevanssi_index_fields_select'] ) {
292
+ $fields_option = 'all';
293
+ }
294
+ if ( 'visible' === $request['relevanssi_index_fields_select'] ) {
295
+ $fields_option = 'visible';
296
+ }
297
+ if ( 'some' === $request['relevanssi_index_fields_select'] ) {
298
+ if ( isset( $request['relevanssi_index_fields'] ) ) {
299
+ $fields_option = rtrim( $request['relevanssi_index_fields'], " \t\n\r\0\x0B," );
300
+ }
301
+ }
302
+ return update_option( 'relevanssi_index_fields', $fields_option, false );
303
+ }
304
+ return false;
305
+ }
306
+
307
+ /**
308
+ * Updates the trim_logs option.
309
+ *
310
+ * @param array $request The request array.
311
+ *
312
+ * @return boolean True, if update_option() succeeds, false otherwise.
313
+ */
314
+ function relevanssi_process_trim_logs_option( array $request ) : bool {
315
+ if ( isset( $request['relevanssi_trim_logs'] ) ) {
316
+ $trim_logs = $request['relevanssi_trim_logs'];
317
+ if ( ! is_numeric( $trim_logs ) || $trim_logs < 0 ) {
318
+ $trim_logs = 0;
319
+ }
320
+ return update_option( 'relevanssi_trim_logs', $trim_logs );
321
+ }
322
+ return false;
323
+ }
324
+
325
+ /**
326
+ * Updates the cat option.
327
+ *
328
+ * @param array $request The request array.
329
+ *
330
+ * @return boolean True, if update_option() succeeds, false otherwise.
331
+ */
332
+ function relevanssi_process_cat_option( array $request ) : bool {
333
+ if ( isset( $request['relevanssi_cat'] ) ) {
334
+ if ( is_array( $request['relevanssi_cat'] ) ) {
335
+ return update_option(
336
+ 'relevanssi_cat',
337
+ implode( ',', $request['relevanssi_cat'] )
338
+ );
339
+ }
340
+ } else {
341
+ if ( isset( $request['relevanssi_cat_active'] ) ) {
342
+ return update_option( 'relevanssi_cat', '' );
343
+ }
344
+ }
345
+ return false;
346
+ }
347
+
348
+ /**
349
+ * Updates the excat option.
350
+ *
351
+ * @param array $request The request array.
352
+ *
353
+ * @return boolean True, if update_option() succeeds, false otherwise.
354
+ */
355
+ function relevanssi_process_excat_option( array $request ) : bool {
356
+ if ( isset( $request['relevanssi_excat'] ) ) {
357
+ if ( is_array( $request['relevanssi_excat'] ) ) {
358
+ $array_excats = $request['relevanssi_excat'];
359
+ $cat = get_option( 'relevanssi_cat' );
360
+ if ( $cat ) {
361
+ $array_cats = explode( ',', $cat );
362
+ $valid_excats = array();
363
+ foreach ( $array_excats as $excat ) {
364
+ if ( ! in_array( $excat, $array_cats, true ) ) {
365
+ $valid_excats[] = $excat;
366
+ }
367
+ }
368
+ } else {
369
+ // No category restrictions, so everything's good.
370
+ $valid_excats = $array_excats;
371
+ }
372
+ $csv_excats = implode( ',', $valid_excats );
373
+ return update_option( 'relevanssi_excat', $csv_excats );
374
+ }
375
+ } else {
376
+ if ( isset( $request['relevanssi_excat_active'] ) ) {
377
+ return update_option( 'relevanssi_excat', '' );
378
+ }
379
+ }
380
+
381
+ return false;
382
+ }
lib/search.php CHANGED
@@ -878,14 +878,7 @@ function relevanssi_taxonomy_score( &$match, $post_type_weights ) {
878
  if ( is_object( $match->taxonomy_detail ) ) {
879
  foreach ( $match->taxonomy_detail as $tax => $count ) {
880
  if ( empty( $post_type_weights[ 'post_tagged_with_' . $tax ] ) ) {
881
- if ( ! empty( $post_type_weights[ $tax ] ) ) { // Legacy code, needed for 2.1.8, remove later.
882
- // phpcs:ignore Squiz.Commenting.InlineComment
883
- // @codeCoverageIgnoreStart
884
- $match->taxonomy_score += $count * $post_type_weights[ $tax ];
885
- // @codeCoverageIgnoreEnd
886
- } else {
887
- $match->taxonomy_score += $count * 1;
888
- }
889
  } else {
890
  $match->taxonomy_score += $count * $post_type_weights[ 'post_tagged_with_' . $tax ];
891
  }
878
  if ( is_object( $match->taxonomy_detail ) ) {
879
  foreach ( $match->taxonomy_detail as $tax => $count ) {
880
  if ( empty( $post_type_weights[ 'post_tagged_with_' . $tax ] ) ) {
881
+ $match->taxonomy_score += $count * 1;
 
 
 
 
 
 
 
882
  } else {
883
  $match->taxonomy_score += $count * $post_type_weights[ 'post_tagged_with_' . $tax ];
884
  }
lib/tabs/overview-tab.php CHANGED
@@ -67,10 +67,17 @@ function relevanssi_overview_tab() {
67
  <p><?php esc_html_e( "Relevanssi doesn't have a separate search widget. Instead, Relevanssi uses the default search widget. Any standard search form will do!", 'relevanssi' ); ?></p>
68
  </td>
69
  </tr>
 
 
 
 
 
 
 
70
  <tr>
71
  <th scope="row"><?php esc_html_e( 'Privacy and GDPR compliance', 'relevanssi' ); ?></th>
72
  <td>
73
- <?php // Translators: %1$s opens the link, %2$s closes the link. ?>
74
  <p><?php printf( esc_html__( '%1$sGDPR Compliance at Relevanssi knowledge base%2$s explains how using Relevanssi affects the GDPR compliance and the privacy policies of your site. Relevanssi also supports the %3$sprivacy policy tool%2$s and the WordPress user data export and erase tools.', 'relevanssi' ), "<a href='https://www.relevanssi.com/knowledge-base/gdpr-compliance/'>", '</a>', "<a href='privacy.php'>" ); ?></p>
75
  </td>
76
  </tr>
@@ -98,7 +105,7 @@ function relevanssi_overview_tab() {
98
  <td>
99
  <p><a href="https://www.relevanssi.com/buy-premium"><?php esc_html_e( 'Buy Relevanssi Premium now', 'relevanssi' ); ?></a> –
100
  <?php // Translators: %1$s is the coupon code, %2$s is the year it expires. ?>
101
- <?php printf( esc_html__( 'use coupon code %1$s for 20%% discount (valid at least until the end of %2$s)', 'relevanssi' ), '<strong>FREE2021</strong>', '2021' ); ?></p>
102
  <p><?php esc_html_e( 'Here are some improvements Relevanssi Premium offers:', 'relevanssi' ); ?></p>
103
  <ul class="relevanssi_ul">
104
  <li><?php esc_html_e( 'PDF content indexing', 'relevanssi' ); ?></li>
67
  <p><?php esc_html_e( "Relevanssi doesn't have a separate search widget. Instead, Relevanssi uses the default search widget. Any standard search form will do!", 'relevanssi' ); ?></p>
68
  </td>
69
  </tr>
70
+ <tr>
71
+ <th scope="row"><?php esc_html_e( 'Relevanssi Live Ajax Search', 'relevanssi' ); ?></th>
72
+ <td>
73
+ <?php // Translators: %1$s opens the link, %2$s closes it. ?>
74
+ <p><?php printf( esc_html__( 'If you want a live search results, you can use the Relevanssi Live Ajax Search plugin. %1$sYou can find it in the plugin repository%2$s. It will make your search forms show instant results, powered by Relevanssi.', 'relevanssi' ), "<a href='https://wordpress.org/plugins/relevanssi-live-ajax-search/'>", '</a>' ); ?></p>
75
+ </td>
76
+ </tr>
77
  <tr>
78
  <th scope="row"><?php esc_html_e( 'Privacy and GDPR compliance', 'relevanssi' ); ?></th>
79
  <td>
80
+ <?php // Translators: %1$s and %3$s open the links, %2$s closes them. ?>
81
  <p><?php printf( esc_html__( '%1$sGDPR Compliance at Relevanssi knowledge base%2$s explains how using Relevanssi affects the GDPR compliance and the privacy policies of your site. Relevanssi also supports the %3$sprivacy policy tool%2$s and the WordPress user data export and erase tools.', 'relevanssi' ), "<a href='https://www.relevanssi.com/knowledge-base/gdpr-compliance/'>", '</a>', "<a href='privacy.php'>" ); ?></p>
82
  </td>
83
  </tr>
105
  <td>
106
  <p><a href="https://www.relevanssi.com/buy-premium"><?php esc_html_e( 'Buy Relevanssi Premium now', 'relevanssi' ); ?></a> –
107
  <?php // Translators: %1$s is the coupon code, %2$s is the year it expires. ?>
108
+ <?php printf( esc_html__( 'use coupon code %1$s for 20%% discount (valid at least until the end of %2$s)', 'relevanssi' ), '<strong>FREE2022</strong>', '2022' ); ?></p>
109
  <p><?php esc_html_e( 'Here are some improvements Relevanssi Premium offers:', 'relevanssi' ); ?></p>
110
  <ul class="relevanssi_ul">
111
  <li><?php esc_html_e( 'PDF content indexing', 'relevanssi' ); ?></li>
lib/tabs/synonyms-tab.php CHANGED
@@ -27,11 +27,42 @@ function relevanssi_synonyms_tab() {
27
  } else {
28
  $synonyms = '';
29
  }
 
 
 
 
 
 
 
 
 
 
30
  ?>
31
  <h3 id="synonyms"><?php esc_html_e( 'Synonyms', 'relevanssi' ); ?></h3>
32
 
33
  <table class="form-table" role="presentation">
34
- <tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  <th scope="row">
36
  <label for="relevanssi_synonyms"><?php esc_html_e( 'Synonyms', 'relevanssi' ); ?></label>
37
  </th>
@@ -40,24 +71,19 @@ function relevanssi_synonyms_tab() {
40
 
41
  <p class="description"><?php esc_html_e( "Do not go overboard, though, as too many synonyms can make the search confusing: users understand if a search query doesn't match everything, but they get confused if the searches match to unexpected things.", 'relevanssi' ); ?></p>
42
  <br />
43
- <textarea name='relevanssi_synonyms' id='relevanssi_synonyms' rows='9' cols='60'><?php echo esc_textarea( $synonyms ); ?></textarea>
 
 
 
 
 
 
44
 
45
  <p class="description"><?php _e( 'The format here is <code>key = value</code>. If you add <code>dog = hound</code> to the list of synonyms, searches for <code>dog</code> automatically become a search for <code>dog hound</code> and will thus match to posts that include either <code>dog</code> or <code>hound</code>. This only works in OR searches: in AND searches the synonyms only restrict the search, as now the search only finds posts that contain <strong>both</strong> <code>dog</code> and <code>hound</code>.', 'relevanssi' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction ?></p>
46
 
47
  <p class="description"><?php _e( 'The synonyms are one direction only. If you want both directions, add the synonym again, reversed: <code>hound = dog</code>.', 'relevanssi' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction ?></p>
48
 
49
  <p class="description"><?php _e( "It's possible to use phrases for the value, but not for the key. <code>dog = \"great dane\"</code> works, but <code>\"great dane\" = dog</code> doesn't.", 'relevanssi' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction ?></p>
50
-
51
- <?php if ( RELEVANSSI_PREMIUM ) : ?>
52
- </td>
53
- </tr>
54
- <tr>
55
- <th scope="row">
56
- <?php echo esc_html_e( 'Synonyms in AND searches', 'relevanssi' ); ?>
57
- </th>
58
- <td>
59
- <p class="description"><?php esc_html_e( "If you want to use synonyms in AND searches, enable synonym indexing on the Indexing tab. Also, any changes to the synonyms won't take effect until you rebuild the index.", 'relevanssi' ); ?></p>
60
- <?php endif; ?>
61
  </td>
62
  </tr>
63
  </table>
27
  } else {
28
  $synonyms = '';
29
  }
30
+
31
+ $synonyms_disabled = false;
32
+ $operator = get_option( 'relevanssi_implicit_operator' );
33
+ if ( 'AND' === $operator ) {
34
+ $index_synonyms = get_option( 'relevanssi_index_synonyms', false );
35
+ if ( 'on' !== $index_synonyms ) {
36
+ $synonyms_disabled = true;
37
+ }
38
+ }
39
+
40
  ?>
41
  <h3 id="synonyms"><?php esc_html_e( 'Synonyms', 'relevanssi' ); ?></h3>
42
 
43
  <table class="form-table" role="presentation">
44
+ <tr
45
+ <?php
46
+ if ( $synonyms_disabled ) {
47
+ echo "class='relevanssi_disabled'";
48
+ }
49
+ ?>
50
+ >
51
+ <?php if ( $synonyms_disabled ) : ?>
52
+ <tr>
53
+ <th scope="row">
54
+ <p class="important"><?php esc_html_e( 'No synonyms!', 'relevanssi' ); ?></p>
55
+ </th>
56
+ <td>
57
+ <p class="important"><?php esc_html_e( 'Synonyms are disabled because the searching operator is set to AND. Enable OR searching to use the synonyms.', 'relevanssi' ); ?></p>
58
+ <?php if ( RELEVANSSI_PREMIUM ) : ?>
59
+ <p class="description"><?php esc_html_e( "If you want to use synonyms in AND searches, enable synonym indexing on the Indexing tab. Also, any changes to the synonyms won't take effect until you rebuild the index.", 'relevanssi' ); ?></p>
60
+ <?php else : ?>
61
+ <p class="description"><?php esc_html_e( 'Relevanssi Premium has a feature that allows you to include the synonyms in the indexing. This makes it possible to use synonyms in AND searches.', 'relevanssi' ); ?></p>
62
+ <?php endif; ?>
63
+ </td>
64
+ </tr>
65
+ <?php endif; ?>
66
  <th scope="row">
67
  <label for="relevanssi_synonyms"><?php esc_html_e( 'Synonyms', 'relevanssi' ); ?></label>
68
  </th>
71
 
72
  <p class="description"><?php esc_html_e( "Do not go overboard, though, as too many synonyms can make the search confusing: users understand if a search query doesn't match everything, but they get confused if the searches match to unexpected things.", 'relevanssi' ); ?></p>
73
  <br />
74
+ <textarea name='relevanssi_synonyms' id='relevanssi_synonyms' rows='9' cols='60'
75
+ <?php
76
+ if ( $synonyms_disabled ) {
77
+ echo 'disabled';
78
+ }
79
+ ?>
80
+ ><?php echo esc_textarea( $synonyms ); ?></textarea>
81
 
82
  <p class="description"><?php _e( 'The format here is <code>key = value</code>. If you add <code>dog = hound</code> to the list of synonyms, searches for <code>dog</code> automatically become a search for <code>dog hound</code> and will thus match to posts that include either <code>dog</code> or <code>hound</code>. This only works in OR searches: in AND searches the synonyms only restrict the search, as now the search only finds posts that contain <strong>both</strong> <code>dog</code> and <code>hound</code>.', 'relevanssi' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction ?></p>
83
 
84
  <p class="description"><?php _e( 'The synonyms are one direction only. If you want both directions, add the synonym again, reversed: <code>hound = dog</code>.', 'relevanssi' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction ?></p>
85
 
86
  <p class="description"><?php _e( "It's possible to use phrases for the value, but not for the key. <code>dog = \"great dane\"</code> works, but <code>\"great dane\" = dog</code> doesn't.", 'relevanssi' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction ?></p>
 
 
 
 
 
 
 
 
 
 
 
87
  </td>
88
  </tr>
89
  </table>
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: msaari
3
  Donate link: https://www.relevanssi.com/buy-premium/
4
  Tags: search, relevance, better search, product search, woocommerce search
5
  Requires at least: 4.9
6
- Tested up to: 5.8.2
7
  Requires PHP: 7.0
8
- Stable tag: 4.14.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -128,6 +128,9 @@ Each document database is full of useless words. All the little words that appea
128
  * John Calahan for extensive 4.0 beta testing.
129
 
130
  == Changelog ==
 
 
 
131
  = 4.14.6 =
132
  * Security fix: Extra hardening for AJAX requests. Some AJAX actions in Relevanssi could leak information to site subscribers who knew what to look for.
133
 
@@ -169,102 +172,10 @@ Each document database is full of useless words. All the little words that appea
169
  * Minor fix: Relevanssi won't let you adjust synonyms and stopwords anymore if you use Polylang and are in 'Show all languages' mode.
170
  * Minor fix: Highlighting is improved by a more precise HTML entity filter, thanks to Jacob Bearce.
171
 
172
- = 4.13.3.1 =
173
- * Minor fix: The Bricks compatibility was broken. This version fixes it.
174
-
175
- = 4.13.3 =
176
- * New feature: You can now add a post type dropdown to search forms with the [searchform] shortcode with the parameter 'dropdown' set to 'post_type'.
177
- * New feature: Adds compatibility for Product GTIN (EAN, UPC, ISBN) for WooCommerce plugin.
178
- * New feature: New filter hook `relevanssi_post_to_excerpt` lets you filter the post object before an excerpt is created from it.
179
- * New feature: Relevanssi is now compatible with the Bricks page builder theme (requires Bricks 1.3.2).
180
- * Minor fix: The ″ character is now counted as a quote.
181
- * Minor fix: Running indexing through WP CLI doesn't cause PHP notices anymore.
182
- * Minor fix: Sometimes the Did you mean would return really weird long suggestions from the search logs. That won't happen anymore.
183
- * Minor fix: Improves tax_query handling in fringe cases with multiple AND clauses joined together with OR.
184
- * Minor fix: Oxygen compatibility has been improved. Rich text fields and updating posts when they are saved in Oxygen now work better, and revisions are no longer indexed.
185
- * Minor fix: Searching without a search term works much better now, you get more posts in the results (default value is up to 500).
186
-
187
- = 4.13.2 =
188
- * New feature: Adds support for Avada Live Search.
189
- * New feature: Adds support for Fibo Search.
190
- * Minor fix: Elementor library searches are not broken anymore when Relevanssi is enabled in admin.
191
- * Minor fix: Relevanssi now understands array-style post_type[] parameters.
192
- * Minor fix: Relevanssi now automatically considers the Turkish 'ı' the same as 'i'.
193
-
194
- = 4.13.1 =
195
- * New feature: Adds compatibility for WP-Members plugin, preventing blocked posts from showing up in the search results.
196
- * New feature: New function `relevanssi_get_attachment_suffix()` can be used to return the attachment file suffix based on a post object or a post ID.
197
- * Minor fix: Improves the Oxygen compatibility. Now also the [oxygen] shortcode tags are removed.
198
-
199
- = 4.13.0 =
200
- * New feature: New filter hook `relevanssi_phrase` filters each phrase before it's used in the MySQL query.
201
- * New feature: Relevanssi can now add Google-style missing term lists to the search results. You can either use the `%missing%` tag in the search results breakdown settings, or you can create your own code: the missing terms are also in `$post->missing_terms`. Relevanssi Premium will also add "Must have" links when there's just one missing term.
202
- * New feature: New filter hook `relevanssi_missing_terms_tag` controls which tag is used to wrap the missing terms.
203
- * New feature: New filter hook `relevanssi_missing_terms_template` can be used to filter the template used to display the missing terms.
204
- * New feature: New function `relevanssi_get_post_meta_for_all_posts()` can be used to fetch particular meta field for a number of posts with just one query.
205
- * New feature: New filter hook `relevanssi_post_author` lets you filter the post author display_name before it is indexed.
206
- * Changed behaviour: `relevanssi_strip_tags()` used to add spaces between HTML tags before stripping them. It no longer does that, but instead adds a space after specific list of tags (p, br, h1-h6, div, blockquote, hr, li, img) to avoid words being stuck to each other in excerpts.
207
- * Changed behaviour: Relevanssi now indexes the contents of Oxygen Builder PHP & HTML code blocks.
208
- * Changed behaviour: Relevanssi now handles synonyms inside phrases differently. If the new filter hook `relevanssi_phrase_synonyms` returns `true` (default value), synonyms create a new phrase (with synonym 'dog=hound', phrase `"dog biscuits"` becomes `"dog biscuits" "hound biscuits"`). If the value is `false`, synonyms inside phrases are ignored.
209
- * Minor fix: Warnings when creating excerpts with search terms that contain a slash were removed.
210
- * Minor fix: Better Ninja Tables compatibility to avoid problems with lightbox images.
211
- * Minor fix: Relevanssi did not work well in the Media Library grid view. Relevanssi is now blocked there. If you need Relevanssi in Media Library searches, use the list view.
212
- * Minor fix: Relevanssi excerpt creation didn't work correctly when numerical search terms were used.
213
-
214
- = 4.12.5 =
215
- * Changed behaviour: `relevanssi_excerpt_custom_field_content` now gets the post ID and list of custom field names as a parameter.
216
- * Minor fix: Makes sure Relevanssi options are not wiped when the free version is deleted while Premium is active.
217
- * Minor fix: Adds a trailing slash to the blog URL in Did you mean links.
218
-
219
- = 4.12.4 =
220
- * New feature: New action hooks `relevanssi_pre_the_content` and `relevanssi_post_the_content` fire before and after Relevanssi applies `the_content` filter to the post excerpts. Some Relevanssi default behaviour has been moved to these hooks so it can be modified.
221
- * Changed behaviour: The `relevanssi_do_not_index` gets the post object as a third parameter.
222
- * Minor fix: Remove errors from `relevanssi_strip_all_tags()` getting a `null` parameter.
223
-
224
- = 4.12.3 =
225
- * Major fix: Post type weights did not work; improving the caching had broken them.
226
- * Minor fix: Relevanssi works better with soft hyphens now, removing them in indexing and excerpt-building.
227
- * Minor fix: Stops indexing error messages in WPML.
228
-
229
- = 4.12.2 =
230
- * Major fix: Stops more problems with ACF custom field indexing.
231
- * Major fix: Fixes a bug in search result caching that caused Relevanssi to make lots of unnecessary database queries.
232
-
233
- = 4.12.1 =
234
- * Major fix: Stops TypeError crashes from null custom field indexing.
235
-
236
- = 4.12.0 =
237
- * New feature: New filter hook `relevanssi_phrase_queries` can be used to add phrase matching queries to support more content types.
238
- * New feature: New filter hook `relevanssi_excerpt_gap` lets you adjust the first line of excerpt optimization.
239
- * Changed behaviour: The `relevanssi_admin_search_element` filter hook now gets the post object as the second parameter, rendering the filter hook more useful.
240
- * Changed behaviour: Relevanssi now automatically optimizes excerpt creation in long posts. You can still use `relevanssi_optimize_excerpts` for further optimization, but it's probably not necessary.
241
- * Changed behaviour: The `relevanssi_tag_before_tokenize` filter hook parameters were changed in order to be actually useful and to match what the filter hook is supposed to do.
242
- * Minor fix: In some cases Relevanssi wouldn't highlight the last word of the title. This is more reliable now.
243
- * Minor fix: Relevanssi will now add the `highlight` parameter only to search results, and not to other links on the search results page.
244
- * Minor fix: Improved fringe cases in nested taxonomy queries.
245
- * Minor fix: Taxonomy terms in WPML were not indexed correctly. Instead of the post language, the current language was used, so if your admin dashboard is in English, German posts would get English translations of the terms, not German. This is now fixed.
246
- * Minor fix: Excerpt creation is now faster when multiple excerpts are not used.
247
- * Minor fix: The SEO plugin noindex setting did not actually work. That has been fixed now.
248
-
249
- = 4.11.1 =
250
- * Major fix: The type hinting introduced for some functions turned out to be too strict, causing fatal errors. The type hinting has been relaxed (using nullable types would help, but that's a PHP 7.4 feature, and we don't want that).
251
-
252
- = 4.11.0 =
253
- * New feature: New filter hook `relevanssi_rendered_block` filters Gutenberg block content after the block has been rendered with `render_block()`.
254
- * New feature: New filter hook `relevanssi_log_query` can be used to filter the search query before it's logged. This can be used to log instead the query that includes synonyms (available as a parameter to the filter hook).
255
- * New feature: New filter hook `relevanssi_add_all_results` can be used to make Relevanssi add a list of all result IDs found to `$query->relevanssi_all_results`. Just make this hook return `true`.
256
- * New feature: New filter hook `relevanssi_acceptable_hooks` can be used to adjust where in WP admin the Relevanssi admin javascripts are enqueued.
257
- * New feature: Support for All-in-One SEO. Posts marked as 'Robots No Index' are not indexed by Relevanssi.
258
- * New feature: New setting in advanced indexing settings to control whether Relevanssi respects the SEO plugin 'noindex' setting or not.
259
- * Changed behaviour: Type hinting has been added to Relevanssi functions, which may cause errors if the filter functions are sloppy with data types.
260
- * Changed behaviour: `relevanssi_the_title()` now supports the same parameters as `the_title()`, so you can just replace `the_title()` with it and keep everything else the same. The old behaviour is still supported.
261
- * Changed behaviour: Relevanssi no longer logs queries with the added synonyms. You can use the `relevanssi_log_query` filter hook to return to the previous behaviour of logging the synonyms too. Thanks to Jan Willem Oostendorp.
262
- * Changed behaviour: When using ACF and custom fields indexing set to 'all', Relevanssi will no longer index the meta fields (where the content begins with `field_`).
263
- * Minor fix: The Oxygen compatibility made it impossible to index other custom fields than the Oxygen `ct_builder_shortcodes`. This has been improved now.
264
- * Minor fix: Old legacy scripts that caused Javascript warnings on admin pages have been removed.
265
- * Minor fix: In some cases, having less than or greater than symbols in PDF content would block that PDF content from being indexed.
266
-
267
  == Upgrade notice ==
 
 
 
268
  = 4.14.6 =
269
  * Security fix: Extra security checks for AJAX actions.
270
 
@@ -284,52 +195,4 @@ Each document database is full of useless words. All the little words that appea
284
  * Adds a missing file.
285
 
286
  = 4.14.0 =
287
- * User searches page update, bug fixes and improvements.
288
-
289
- = 4.13.3.1 =
290
- * Fixes the Bricks compatibility.
291
-
292
- = 4.13.3 =
293
- * Bug fixes and small improvements.
294
-
295
- = 4.13.2 =
296
- * Small bug and compatibility fixes.
297
-
298
- = 4.13.1 =
299
- * Compatibility for WP-Members added.
300
-
301
- = 4.13.0 =
302
- * Lots of new features and bug fixes.
303
-
304
- = 4.12.5 =
305
- * Fixes minor bugs.
306
-
307
- = 4.12.4 =
308
- * Fixes minor bugs.
309
-
310
- = 4.12.3 =
311
- * Fixes post type weights and WPML indexing problems.
312
-
313
- = 4.12.2 =
314
- * Stops Relevanssi from crashing when saving posts with ACF fields, major performance boost.
315
-
316
- = 4.12.1 =
317
- * Stops TypeError crashes from null custom field indexing.
318
-
319
- = 4.12.0 =
320
- * New features and bug fixes.
321
-
322
- = 4.11.1 =
323
- * Prevents surprising fatal errors.
324
-
325
- = 4.11.0 =
326
- * New filter hooks, bug fixes.
327
-
328
- = 4.10.2 =
329
- * Switch from `the_posts` to `posts_pre_query`, bug fixes.
330
-
331
- = 4.10.1 =
332
- * Corrects the multilingual stopwords and synonyms.
333
-
334
- = 4.10.0 =
335
- * Adds support for multilingual stopwords and synonyms.
3
  Donate link: https://www.relevanssi.com/buy-premium/
4
  Tags: search, relevance, better search, product search, woocommerce search
5
  Requires at least: 4.9
6
+ Tested up to: 5.9
7
  Requires PHP: 7.0
8
+ Stable tag: 4.14.7
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
128
  * John Calahan for extensive 4.0 beta testing.
129
 
130
  == Changelog ==
131
+ = 4.14.7 =
132
+ * User interface: The synonym settings page now alerts if the synonyms aren't active because of the AND search.
133
+
134
  = 4.14.6 =
135
  * Security fix: Extra hardening for AJAX requests. Some AJAX actions in Relevanssi could leak information to site subscribers who knew what to look for.
136
 
172
  * Minor fix: Relevanssi won't let you adjust synonyms and stopwords anymore if you use Polylang and are in 'Show all languages' mode.
173
  * Minor fix: Highlighting is improved by a more precise HTML entity filter, thanks to Jacob Bearce.
174
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  == Upgrade notice ==
176
+ = 4.14.7 =
177
+ * Small user interface fixes.
178
+
179
  = 4.14.6 =
180
  * Security fix: Extra security checks for AJAX actions.
181
 
195
  * Adds a missing file.
196
 
197
  = 4.14.0 =
198
+ * User searches page update, bug fixes and improvements.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
relevanssi.php CHANGED
@@ -13,7 +13,7 @@
13
  * Plugin Name: Relevanssi
14
  * Plugin URI: https://www.relevanssi.com/
15
  * Description: This plugin replaces WordPress search with a relevance-sorting search.
16
- * Version: 4.14.6
17
  * Author: Mikko Saari
18
  * Author URI: http://www.mikkosaari.fi/
19
  * Text Domain: relevanssi
@@ -22,7 +22,7 @@
22
  */
23
 
24
  /**
25
- * Copyright 2021 Mikko Saari (email: mikko@mikkosaari.fi)
26
  * This file is part of Relevanssi, a search plugin for WordPress.
27
  *
28
  * Relevanssi is free software: you can redistribute it and/or modify
@@ -67,7 +67,7 @@ $relevanssi_variables['database_version'] = 6;
67
  $relevanssi_variables['file'] = __FILE__;
68
  $relevanssi_variables['plugin_dir'] = plugin_dir_path( __FILE__ );
69
  $relevanssi_variables['plugin_basename'] = plugin_basename( __FILE__ );
70
- $relevanssi_variables['plugin_version'] = '4.14.6';
71
 
72
  require_once 'lib/admin-ajax.php';
73
  require_once 'lib/common.php';
13
  * Plugin Name: Relevanssi
14
  * Plugin URI: https://www.relevanssi.com/
15
  * Description: This plugin replaces WordPress search with a relevance-sorting search.
16
+ * Version: 4.14.7
17
  * Author: Mikko Saari
18
  * Author URI: http://www.mikkosaari.fi/
19
  * Text Domain: relevanssi
22
  */
23
 
24
  /**
25
+ * Copyright 2022 Mikko Saari (email: mikko@mikkosaari.fi)
26
  * This file is part of Relevanssi, a search plugin for WordPress.
27
  *
28
  * Relevanssi is free software: you can redistribute it and/or modify
67
  $relevanssi_variables['file'] = __FILE__;
68
  $relevanssi_variables['plugin_dir'] = plugin_dir_path( __FILE__ );
69
  $relevanssi_variables['plugin_basename'] = plugin_basename( __FILE__ );
70
+ $relevanssi_variables['plugin_version'] = '4.14.7';
71
 
72
  require_once 'lib/admin-ajax.php';
73
  require_once 'lib/common.php';