Relevanssi – A Better Search - Version 4.0.4

Version Description

  • Codebase review, lots of small improvements everywhere.
Download this release

Release Info

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

Code changes from version 4.0.3 to 4.0.4

lib/common.php CHANGED
@@ -388,6 +388,8 @@ function relevanssi_default_post_ok($post_ok, $doc) {
388
  }
389
 
390
  /**
 
 
391
  * Return values:
392
  * 2: full access to post
393
  * 1: show title only
@@ -472,9 +474,11 @@ function relevanssi_extract_phrases($q) {
472
  $phrase = call_user_func($substr_function, $q, $start + 1, $end - $start - 1);
473
  $phrase = trim($phrase);
474
 
475
- if (!empty($phrase)) $phrases[] = $phrase;
 
476
  $pos = $end;
477
  }
 
478
  return $phrases;
479
  }
480
 
@@ -742,7 +746,7 @@ function relevanssi_tokenize($str, $remove_stops = true, $min_word_length = -1)
742
  }
743
 
744
  $str = apply_filters('relevanssi_remove_punctuation', $str);
745
-
746
  if ( function_exists('mb_strtolower') )
747
  $str = mb_strtolower($str);
748
  else
@@ -1045,11 +1049,17 @@ function relevanssi_switch_blog($new_blog, $prev_blog) {
1045
  function relevanssi_get_permalink() {
1046
  $permalink = apply_filters('relevanssi_permalink', get_permalink());
1047
  $highlight_docs = get_option('relevanssi_highlight_docs');
1048
- if (isset($highlight_docs) && $highlight_docs != "off") {
1049
- $permalink = esc_attr(add_query_arg(array(
1050
- 'highlight' => urlencode(get_search_query())
1051
- ), $permalink )
1052
- );
 
 
 
 
 
 
1053
  }
1054
  return $permalink;
1055
  }
@@ -1092,32 +1102,56 @@ function relevanssi_simple_didyoumean($query, $pre, $post, $n = 5) {
1092
 
1093
  $data = $wpdb->get_results($q);
1094
 
1095
- $distance = -1;
1096
- $closest = "";
1097
-
1098
- foreach ($data as $row) {
1099
- if ($row->c < 2) break;
1100
- $lev = levenshtein($query, $row->query);
 
 
 
 
 
 
 
 
 
 
1101
 
1102
- if ($lev < $distance || $distance < 0) {
1103
- if ($row->a > 0) {
1104
- $distance = $lev;
1105
- $closest = $row->query;
1106
- if ($lev == 1) break; // get the first with distance of 1 and go
 
 
1107
  }
1108
  }
 
 
 
 
 
 
 
 
 
1109
  }
1110
 
1111
  $result = null;
1112
- if ($distance > 0) {
1113
  $url = get_bloginfo('url');
1114
  $url = esc_attr(add_query_arg(array(
1115
- 's' => urlencode($closest)
1116
 
1117
  ), $url ));
1118
- $url = apply_filters('relevanssi_didyoumean_url', $url, $query, $closest);
1119
- $closest = htmlspecialchars($closest);
1120
- $result = apply_filters('relevanssi_didyoumean_suggestion', "$pre<a href='$url'>$closest</a>$post");
 
 
 
1121
  }
1122
 
1123
  return $result;
388
  }
389
 
390
  /**
391
+ * This is only for legacy use, current versions of s2member do not need this anymore, they filter through pre_get_posts and 'not_in'.
392
+ *
393
  * Return values:
394
  * 2: full access to post
395
  * 1: show title only
474
  $phrase = call_user_func($substr_function, $q, $start + 1, $end - $start - 1);
475
  $phrase = trim($phrase);
476
 
477
+ // Do not count single-word phrases as phrases
478
+ if (!empty($phrase) && str_word_count($phrase) > 1) $phrases[] = $phrase;
479
  $pos = $end;
480
  }
481
+
482
  return $phrases;
483
  }
484
 
746
  }
747
 
748
  $str = apply_filters('relevanssi_remove_punctuation', $str);
749
+
750
  if ( function_exists('mb_strtolower') )
751
  $str = mb_strtolower($str);
752
  else
1049
  function relevanssi_get_permalink() {
1050
  $permalink = apply_filters('relevanssi_permalink', get_permalink());
1051
  $highlight_docs = get_option('relevanssi_highlight_docs');
1052
+ $query = get_search_query();
1053
+ if (isset($highlight_docs) && $highlight_docs != "off" && !empty($query)) {
1054
+ global $post;
1055
+ $frontpage_id = get_option('page_on_front');
1056
+ if ($post->ID != $frontpage_id) {
1057
+ // We won't add the highlight parameter for the front page, as that will break the link
1058
+ $permalink = esc_attr(add_query_arg(array(
1059
+ 'highlight' => urlencode(get_search_query())
1060
+ ), $permalink )
1061
+ );
1062
+ }
1063
  }
1064
  return $permalink;
1065
  }
1102
 
1103
  $data = $wpdb->get_results($q);
1104
 
1105
+ $query = htmlspecialchars_decode($query);
1106
+ $tokens = relevanssi_tokenize($query);
1107
+ $suggestion = "";
1108
+ $suggestions_made = false;
1109
+ foreach ($tokens as $token => $count) {
1110
+ $closest = "";
1111
+ $distance = -1;
1112
+ foreach ($data as $row) {
1113
+ if ($row->c < 2) break;
1114
+
1115
+ if ($token === $row->query) {
1116
+ $closest = "";
1117
+ break;
1118
+ }
1119
+ else {
1120
+ $lev = levenshtein($token, $row->query);
1121
 
1122
+ if ($lev < $distance || $distance < 0) {
1123
+ if ($row->a > 0) {
1124
+ $distance = $lev;
1125
+ $closest = $row->query;
1126
+ if ($lev < 2) break; // get the first with distance of 1 and go
1127
+ }
1128
+ }
1129
  }
1130
  }
1131
+ if (!empty($closest)) {
1132
+ $query = str_ireplace($token, $closest, $query);
1133
+ $suggestions_made = true;
1134
+ }
1135
+ }
1136
+
1137
+ if ($suggestions_made) {
1138
+ $suggestion = $query;
1139
+ $suggestion_enc = urlencode($suggestion);
1140
  }
1141
 
1142
  $result = null;
1143
+ if ($suggestion) {
1144
  $url = get_bloginfo('url');
1145
  $url = esc_attr(add_query_arg(array(
1146
+ 's' => urlencode($suggestion)
1147
 
1148
  ), $url ));
1149
+ $url = apply_filters('relevanssi_didyoumean_url', $url, $query, $suggestion);
1150
+
1151
+ // Escape the suggestion to avoid XSS attacks
1152
+ $suggestion = htmlspecialchars($suggestion);
1153
+
1154
+ $result = apply_filters('relevanssi_didyoumean_suggestion', "$pre<a href='$url'>$suggestion</a>$post");
1155
  }
1156
 
1157
  return $result;
lib/excerpts-highlights.php CHANGED
@@ -19,11 +19,14 @@ function relevanssi_do_excerpt($t_post, $query) {
19
  $post = $t_post;
20
 
21
  $remove_stopwords = true;
 
 
 
22
  $terms = relevanssi_tokenize($query, $remove_stopwords, -1);
23
 
24
  // These shortcodes cause problems with Relevanssi excerpts
25
  $problem_shortcodes = apply_filters('relevanssi_disable_shortcodes_excerpt',
26
- array('layerslider', 'responsive-flipbook', 'breadcrumb', 'maxmegamenu', 'robogallery', 'gravityview')
27
  );
28
  foreach ($problem_shortcodes as $shortcode) {
29
  remove_shortcode($shortcode);
@@ -66,6 +69,8 @@ function relevanssi_do_excerpt($t_post, $query) {
66
 
67
  if (get_option("relevanssi_index_excerpt") != 'off') {
68
  $excerpt_content = $post->post_excerpt;
 
 
69
  if (!empty($excerpt_content)) {
70
  $excerpt_excerpts = relevanssi_create_excerpt($excerpt_content, $terms, $query);
71
  if ($excerpt_excerpts[1] > $excerpt_data[1]) {
@@ -80,8 +85,11 @@ function relevanssi_do_excerpt($t_post, $query) {
80
  $excerpt = trim($excerpt);
81
  $excerpt = apply_filters('relevanssi_excerpt', $excerpt);
82
 
83
- if (empty($excerpt) && !empty($post->post_excerpt)) $excerpt = $post->post_excerpt;
84
  $excerpt === $post->post_content ? $whole_post_excerpted = true : $whole_post_excerpted = false;
 
 
 
 
85
 
86
  $ellipsis = apply_filters('relevanssi_ellipsis', '...');
87
 
@@ -654,7 +662,7 @@ function relevanssi_get_custom_field_content($post_id) {
654
  if ($remove_underscore_fields) {
655
  if (substr($field, 0, 1) === '_') continue;
656
  }
657
- $values = apply_filters('relevanssi_custom_field_value', get_post_meta($post_id, $field, false), $field, $post->ID);
658
  if ("" === $values) continue;
659
  foreach ($values as $value) {
660
  // Quick hack : allow indexing of PODS relationship custom fields // TMV
@@ -679,6 +687,7 @@ function relevanssi_remove_page_builder_shortcodes($content) {
679
  '/\[\/?mk.*?\]/',
680
  '/\[\/?cs_.*?\]/',
681
  '/\[\/?av_.*?\]/',
 
682
  ));
683
  $content = preg_replace($search_array, '', $content);
684
  return $content;
19
  $post = $t_post;
20
 
21
  $remove_stopwords = true;
22
+
23
+ $query = apply_filters('relevanssi_excerpt_query', $query);
24
+
25
  $terms = relevanssi_tokenize($query, $remove_stopwords, -1);
26
 
27
  // These shortcodes cause problems with Relevanssi excerpts
28
  $problem_shortcodes = apply_filters('relevanssi_disable_shortcodes_excerpt',
29
+ array('layerslider', 'responsive-flipbook', 'breadcrumb', 'robogallery', 'gravityview')
30
  );
31
  foreach ($problem_shortcodes as $shortcode) {
32
  remove_shortcode($shortcode);
69
 
70
  if (get_option("relevanssi_index_excerpt") != 'off') {
71
  $excerpt_content = $post->post_excerpt;
72
+ $excerpt_content = strip_tags($excerpt_content, get_option('relevanssi_excerpt_allowable_tags', '')); // this removes the tags, but leaves the content
73
+
74
  if (!empty($excerpt_content)) {
75
  $excerpt_excerpts = relevanssi_create_excerpt($excerpt_content, $terms, $query);
76
  if ($excerpt_excerpts[1] > $excerpt_data[1]) {
85
  $excerpt = trim($excerpt);
86
  $excerpt = apply_filters('relevanssi_excerpt', $excerpt);
87
 
 
88
  $excerpt === $post->post_content ? $whole_post_excerpted = true : $whole_post_excerpted = false;
89
+ if (empty($excerpt) && !empty($post->post_excerpt)) {
90
+ $excerpt = $post->post_excerpt;
91
+ $excerpt = strip_tags($excerpt, get_option('relevanssi_excerpt_allowable_tags', '')); // this removes the tags, but leaves the content
92
+ }
93
 
94
  $ellipsis = apply_filters('relevanssi_ellipsis', '...');
95
 
662
  if ($remove_underscore_fields) {
663
  if (substr($field, 0, 1) === '_') continue;
664
  }
665
+ $values = apply_filters('relevanssi_custom_field_value', get_post_meta($post_id, $field, false), $field, $post_id);
666
  if ("" === $values) continue;
667
  foreach ($values as $value) {
668
  // Quick hack : allow indexing of PODS relationship custom fields // TMV
687
  '/\[\/?mk.*?\]/',
688
  '/\[\/?cs_.*?\]/',
689
  '/\[\/?av_.*?\]/',
690
+ '/\[maxmegamenu.*?\]/', // Max Mega Menu doesn't work in excerpts
691
  ));
692
  $content = preg_replace($search_array, '', $content);
693
  return $content;
lib/indexing.php CHANGED
@@ -561,6 +561,7 @@ function relevanssi_index_doc($indexpost, $remove_first = false, $custom_fields
561
  remove_shortcode('edd_login');
562
  remove_shortcode('edd_register');
563
  remove_shortcode('swpm_protected'); // Simple Membership Partially Protected content
 
564
 
565
  $post_before_shortcode = $post;
566
  $contents = do_shortcode($contents);
561
  remove_shortcode('edd_login');
562
  remove_shortcode('edd_register');
563
  remove_shortcode('swpm_protected'); // Simple Membership Partially Protected content
564
+ remove_shortcode('gravityform'); // Gravity Forms
565
 
566
  $post_before_shortcode = $post;
567
  $contents = do_shortcode($contents);
lib/init.php CHANGED
@@ -197,7 +197,7 @@ function relevanssi_create_database_tables($relevanssi_db_version) {
197
  }
198
 
199
  if (!$typeitem_exists) {
200
- $sql = "CREATE INDEX typeitem ON $relevanssi_table (type, item)";
201
  $wpdb->query($sql);
202
  }
203
 
@@ -225,7 +225,7 @@ function relevanssi_create_database_tables($relevanssi_db_version) {
225
  }
226
 
227
  if (!$query_exists) {
228
- $sql = "CREATE INDEX query ON $relevanssi_log_table (query)";
229
  $wpdb->query($sql);
230
  }
231
 
197
  }
198
 
199
  if (!$typeitem_exists) {
200
+ $sql = "CREATE INDEX typeitem ON $relevanssi_table (type(190), item)";
201
  $wpdb->query($sql);
202
  }
203
 
225
  }
226
 
227
  if (!$query_exists) {
228
+ $sql = "CREATE INDEX query ON $relevanssi_log_table (query(190))";
229
  $wpdb->query($sql);
230
  }
231
 
lib/install.php CHANGED
@@ -39,6 +39,7 @@ function _relevanssi_install() {
39
  add_option('relevanssi_content_boost', $relevanssi_variables['content_boost_default']);
40
  add_option('relevanssi_title_boost', $relevanssi_variables['title_boost_default']);
41
  add_option('relevanssi_comment_boost', $relevanssi_variables['comment_boost_default']);
 
42
  add_option('relevanssi_admin_search', 'off');
43
  add_option('relevanssi_highlight', 'strong');
44
  add_option('relevanssi_txt_col', '#ff0000');
39
  add_option('relevanssi_content_boost', $relevanssi_variables['content_boost_default']);
40
  add_option('relevanssi_title_boost', $relevanssi_variables['title_boost_default']);
41
  add_option('relevanssi_comment_boost', $relevanssi_variables['comment_boost_default']);
42
+ add_option('relevanssi_index_post_types', array('post', 'page'));
43
  add_option('relevanssi_admin_search', 'off');
44
  add_option('relevanssi_highlight', 'strong');
45
  add_option('relevanssi_txt_col', '#ff0000');
lib/interface.php CHANGED
@@ -781,12 +781,12 @@ function relevanssi_options_form() {
781
 
782
  $txt_col = get_option('relevanssi_txt_col');
783
  if (substr($txt_col, 0, 1) != "#") $txt_col = "#" . $txt_col;
784
- $txt_col = sanitize_hex_color($txt_col);
785
  $serialize_options['relevanssi_txt_col'] = $txt_col;
786
 
787
  $bg_col = get_option('relevanssi_bg_col');
788
  if (substr($bg_col, 0, 1) != "#") $bg_col = "#" . $bg_col;
789
- $bg_col = sanitize_hex_color($bg_col);
790
  $serialize_options['relevanssi_bg_col'] = $bg_col;
791
 
792
  $css = get_option('relevanssi_css');
@@ -1015,6 +1015,8 @@ function relevanssi_options_form() {
1015
 
1016
  $hide_post_controls = ('on' === get_option('relevanssi_hide_post_controls') ? 'checked="checked"' : '');
1017
  $serialize_options['relevanssi_hide_post_controls'] = get_option('relevanssi_hide_post_controls');
 
 
1018
 
1019
  $recency_bonus_array = get_option('relevanssi_recency_bonus');
1020
  $serialize_options['recency_bonus'] = $recency_bonus_array;
@@ -1101,7 +1103,7 @@ function relevanssi_options_form() {
1101
  if (!is_multisite() && function_exists('relevanssi_form_api_key')) relevanssi_form_api_key($api_key);
1102
  ?>
1103
  <?php
1104
- if (function_exists('relevanssi_form_hide_post_controls')) relevanssi_form_hide_post_controls($hide_post_controls);
1105
  ?>
1106
  <tr>
1107
  <th scope="row"><?php _e("Getting started", "relevanssi"); ?></th>
@@ -1109,7 +1111,7 @@ function relevanssi_options_form() {
1109
  <p><?php _e("You've already installed Relevanssi. That's a great first step towards good search experience!", "relevanssi"); ?></p>
1110
  <ol>
1111
  <?php if (get_option('relevanssi_indexed') !== 'done') : ?>
1112
- <li><p><?php printf(__("Now, you need an index. Head over to the %s%s%s tab to set up the basic indexing options and to build the index.", "relevanssi"), "<a href='{$this_page}&amp;tab=indexing'>", "Indexing", "</a>"); ?></p>
1113
  <p><?php _e("You need to check at least the following options:", "relevanssi"); ?><br />
1114
  – <?php _e("Make sure the post types you want to include in the index are indexed.", "relevanssi"); ?><br />
1115
  – <?php printf(__("Do you use custom fields to store content you want included? If so, add those too. WooCommerce user? You probably want to include %s.", "relevanssi"), "<code>_sku</code>"); ?></p>
@@ -1119,10 +1121,10 @@ function relevanssi_options_form() {
1119
  <li><p><?php _e("Great, you already have an index!", "relevanssi"); ?></p></li>
1120
  <?php endif; ?>
1121
  <li>
1122
- <p><?php printf(__("On the %s%s%s tab, choose whether you want the default operator to be AND (less results, but more precise) or OR (more results, less precise).", "relevanssi"), "<a href='{$this_page}&amp;tab=searching'>", "Searching", "</a>"); ?></p>
1123
  </li>
1124
  <li>
1125
- <p><?php printf(__("The next step is the %s%s%s tab, where you can enable the custom excerpts that show the relevant part of post in the search results pages.", "relevanssi"), "<a href='{$this_page}&amp;tab=excerpts'>", "Excerpts", "</a>"); ?></p>
1126
  <p><?php _e("There are couple of options related to that, so if you want highlighting in the results, you can adjust the styles for that to suit the look of your site.", "relevanssi"); ?></p>
1127
  </li>
1128
  <li>
@@ -1308,7 +1310,7 @@ function relevanssi_options_form() {
1308
  </thead>
1309
  <tr>
1310
  <td>
1311
- <?php _e('Post content', 'relevanssi'); ?>
1312
  </td>
1313
  <td class="col-2">
1314
  <input type='text' name='relevanssi_content_boost' id='relevanssi_content_boost' size='4' value='<?php echo $content_boost ?>' />
@@ -1316,7 +1318,7 @@ function relevanssi_options_form() {
1316
  </tr>
1317
  <tr>
1318
  <td>
1319
- <?php _e('Post titles', 'relevanssi'); ?>
1320
  </td>
1321
  <td class="col-2">
1322
  <input type='text' name='relevanssi_title_boost' id='relevanssi_title_boost' size='4' value='<?php echo $title_boost ?>' />
@@ -2358,9 +2360,12 @@ function relevanssi_add_admin_scripts($hook) {
2358
  'indexing_taxonomies' => __('Indexing the following taxonomies:', 'relevanssi'),
2359
  'counting_posts' => __('Counting posts...', 'relevanssi'),
2360
  'counting_terms' => __('Counting taxonomy terms...', 'relevanssi'),
 
2361
  'posts_found' => __('posts found.', 'relevanssi'),
2362
  'terms_found' => __('taxonomy terms found.', 'relevanssi'),
 
2363
  'taxonomy_disabled' => __('Taxonomy term indexing is disabled.', "relevanssi"),
 
2364
  'indexing_complete' => __('Indexing complete.', 'relevanssi'),
2365
  'excluded_posts' => __('posts excluded.', 'relevanssi'),
2366
  'options_changed' => __("Settings have changed, please save the options before indexing.", 'relevanssi'),
@@ -2381,3 +2386,16 @@ function relevanssi_add_admin_scripts($hook) {
2381
 
2382
  wp_localize_script( 'relevanssi_admin_js', 'relevanssi', $translation );
2383
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
781
 
782
  $txt_col = get_option('relevanssi_txt_col');
783
  if (substr($txt_col, 0, 1) != "#") $txt_col = "#" . $txt_col;
784
+ $txt_col = relevanssi_sanitize_hex_color($txt_col);
785
  $serialize_options['relevanssi_txt_col'] = $txt_col;
786
 
787
  $bg_col = get_option('relevanssi_bg_col');
788
  if (substr($bg_col, 0, 1) != "#") $bg_col = "#" . $bg_col;
789
+ $bg_col = relevanssi_sanitize_hex_color($bg_col);
790
  $serialize_options['relevanssi_bg_col'] = $bg_col;
791
 
792
  $css = get_option('relevanssi_css');
1015
 
1016
  $hide_post_controls = ('on' === get_option('relevanssi_hide_post_controls') ? 'checked="checked"' : '');
1017
  $serialize_options['relevanssi_hide_post_controls'] = get_option('relevanssi_hide_post_controls');
1018
+ $show_post_controls = ('on' === get_option('relevanssi_show_post_controls') ? 'checked="checked"' : '');
1019
+ $serialize_options['relevanssi_show_post_controls'] = get_option('relevanssi_show_post_controls');
1020
 
1021
  $recency_bonus_array = get_option('relevanssi_recency_bonus');
1022
  $serialize_options['recency_bonus'] = $recency_bonus_array;
1103
  if (!is_multisite() && function_exists('relevanssi_form_api_key')) relevanssi_form_api_key($api_key);
1104
  ?>
1105
  <?php
1106
+ if (function_exists('relevanssi_form_hide_post_controls')) relevanssi_form_hide_post_controls($hide_post_controls, $show_post_controls);
1107
  ?>
1108
  <tr>
1109
  <th scope="row"><?php _e("Getting started", "relevanssi"); ?></th>
1111
  <p><?php _e("You've already installed Relevanssi. That's a great first step towards good search experience!", "relevanssi"); ?></p>
1112
  <ol>
1113
  <?php if (get_option('relevanssi_indexed') !== 'done') : ?>
1114
+ <li><p><?php printf(__("Now, you need an index. Head over to the %s%s%s tab to set up the basic indexing options and to build the index.", "relevanssi"), "<a href='{$this_page}&amp;tab=indexing'>", __("Indexing", "relevanssi"), "</a>"); ?></p>
1115
  <p><?php _e("You need to check at least the following options:", "relevanssi"); ?><br />
1116
  – <?php _e("Make sure the post types you want to include in the index are indexed.", "relevanssi"); ?><br />
1117
  – <?php printf(__("Do you use custom fields to store content you want included? If so, add those too. WooCommerce user? You probably want to include %s.", "relevanssi"), "<code>_sku</code>"); ?></p>
1121
  <li><p><?php _e("Great, you already have an index!", "relevanssi"); ?></p></li>
1122
  <?php endif; ?>
1123
  <li>
1124
+ <p><?php printf(__("On the %s%s%s tab, choose whether you want the default operator to be AND (less results, but more precise) or OR (more results, less precise).", "relevanssi"), "<a href='{$this_page}&amp;tab=searching'>", __("Searching", "relevanssi"), "</a>"); ?></p>
1125
  </li>
1126
  <li>
1127
+ <p><?php printf(__("The next step is the %s%s%s tab, where you can enable the custom excerpts that show the relevant part of post in the search results pages.", "relevanssi"), "<a href='{$this_page}&amp;tab=excerpts'>", __("Excerpts and highlights", "relevanssi"), "</a>"); ?></p>
1128
  <p><?php _e("There are couple of options related to that, so if you want highlighting in the results, you can adjust the styles for that to suit the look of your site.", "relevanssi"); ?></p>
1129
  </li>
1130
  <li>
1310
  </thead>
1311
  <tr>
1312
  <td>
1313
+ <?php _e('Content', 'relevanssi'); ?>
1314
  </td>
1315
  <td class="col-2">
1316
  <input type='text' name='relevanssi_content_boost' id='relevanssi_content_boost' size='4' value='<?php echo $content_boost ?>' />
1318
  </tr>
1319
  <tr>
1320
  <td>
1321
+ <?php _e('Titles', 'relevanssi'); ?>
1322
  </td>
1323
  <td class="col-2">
1324
  <input type='text' name='relevanssi_title_boost' id='relevanssi_title_boost' size='4' value='<?php echo $title_boost ?>' />
2360
  'indexing_taxonomies' => __('Indexing the following taxonomies:', 'relevanssi'),
2361
  'counting_posts' => __('Counting posts...', 'relevanssi'),
2362
  'counting_terms' => __('Counting taxonomy terms...', 'relevanssi'),
2363
+ 'counting_users' => __('Counting users...', 'relevanssi'),
2364
  'posts_found' => __('posts found.', 'relevanssi'),
2365
  'terms_found' => __('taxonomy terms found.', 'relevanssi'),
2366
+ 'users_found' => __('users found.', 'relevanssi'),
2367
  'taxonomy_disabled' => __('Taxonomy term indexing is disabled.', "relevanssi"),
2368
+ 'user_disabled' => __('User indexing is disabled.', "relevanssi"),
2369
  'indexing_complete' => __('Indexing complete.', 'relevanssi'),
2370
  'excluded_posts' => __('posts excluded.', 'relevanssi'),
2371
  'options_changed' => __("Settings have changed, please save the options before indexing.", 'relevanssi'),
2386
 
2387
  wp_localize_script( 'relevanssi_admin_js', 'relevanssi', $translation );
2388
  }
2389
+
2390
+ /* Copy of sanitize_hex_color(), because that isn't always available
2391
+ */
2392
+ function relevanssi_sanitize_hex_color($color) {
2393
+ if ( '' === $color ) {
2394
+ return '';
2395
+ }
2396
+
2397
+ // 3 or 6 hex digits, or the empty string.
2398
+ if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
2399
+ return $color;
2400
+ }
2401
+ }
lib/search.php CHANGED
@@ -287,7 +287,7 @@ function relevanssi_search($args) {
287
  else {
288
  $positive_terms = false;
289
  }
290
-
291
  $terms = relevanssi_tokenize($q, $remove_stopwords);
292
 
293
  if (count($terms) < 1) {
@@ -806,6 +806,9 @@ function relevanssi_do_query(&$query) {
806
  $multi_args['post_type'] = $query->query_vars["post_types"];
807
  }
808
 
 
 
 
809
  $operator = "";
810
  if (function_exists('relevanssi_set_operator')) {
811
  $operator = relevanssi_set_operator($query);
@@ -1517,9 +1520,9 @@ function relevanssi_process_tax_query_row($row, $is_sub_row, $global_relation, $
1517
  }
1518
  }
1519
  else {
1520
- if ($tq_operator == 'IN') $local_term_tax_ids[] = $term_tax_id;
1521
- if ($tq_operator == 'NOT IN') $local_not_term_tax_ids[] = $term_tax_id;
1522
- if ($tq_operator == 'AND') $local_and_term_tax_ids[] = $term_tax_id;
1523
  }
1524
  }
1525
  else {
@@ -1527,7 +1530,7 @@ function relevanssi_process_tax_query_row($row, $is_sub_row, $global_relation, $
1527
  $wp_query->is_category = false;
1528
  }
1529
 
1530
- if ($is_sub_row && $global_relation == 'and' && $tax_query_relation == 'or') {
1531
  $local_term_tax_ids = array_unique($local_term_tax_ids);
1532
  $local_not_term_tax_ids = array_unique($local_not_term_tax_ids);
1533
  $local_and_term_tax_ids = array_unique($local_and_term_tax_ids);
@@ -1560,7 +1563,7 @@ function relevanssi_process_tax_query_row($row, $is_sub_row, $global_relation, $
1560
 
1561
  $copy_term_tax_ids = false;
1562
  if (!$is_sub_row) $copy_term_tax_ids = true;
1563
- if ($is_sub_row && $global_relation == 'or') $copy_term_tax_ids = true;
1564
 
1565
  if ($copy_term_tax_ids) {
1566
  $term_tax_ids = array_merge($term_tax_ids, $local_term_tax_ids);
@@ -1569,7 +1572,4 @@ function relevanssi_process_tax_query_row($row, $is_sub_row, $global_relation, $
1569
  }
1570
 
1571
  return array($query_restrictions, $term_tax_ids, $not_term_tax_ids, $and_term_tax_ids);
1572
- }
1573
-
1574
-
1575
- ?>
287
  else {
288
  $positive_terms = false;
289
  }
290
+
291
  $terms = relevanssi_tokenize($q, $remove_stopwords);
292
 
293
  if (count($terms) < 1) {
806
  $multi_args['post_type'] = $query->query_vars["post_types"];
807
  }
808
 
809
+ if (isset($query->query_vars['order'])) $multi_args['order'] = $query->query_vars['order'];
810
+ if (isset($query->query_vars['orderby'])) $multi_args['orderby'] = $query->query_vars['orderby'];
811
+
812
  $operator = "";
813
  if (function_exists('relevanssi_set_operator')) {
814
  $operator = relevanssi_set_operator($query);
1520
  }
1521
  }
1522
  else {
1523
+ if ($tq_operator === 'IN') $local_term_tax_ids[] = $term_tax_id;
1524
+ if ($tq_operator === 'NOT IN') $local_not_term_tax_ids[] = $term_tax_id;
1525
+ if ($tq_operator === 'AND') $local_and_term_tax_ids[] = $term_tax_id;
1526
  }
1527
  }
1528
  else {
1530
  $wp_query->is_category = false;
1531
  }
1532
 
1533
+ if ($is_sub_row && $global_relation === 'and' && $tax_query_relation === 'or') {
1534
  $local_term_tax_ids = array_unique($local_term_tax_ids);
1535
  $local_not_term_tax_ids = array_unique($local_not_term_tax_ids);
1536
  $local_and_term_tax_ids = array_unique($local_and_term_tax_ids);
1563
 
1564
  $copy_term_tax_ids = false;
1565
  if (!$is_sub_row) $copy_term_tax_ids = true;
1566
+ if ($is_sub_row && $global_relation === 'or') $copy_term_tax_ids = true;
1567
 
1568
  if ($copy_term_tax_ids) {
1569
  $term_tax_ids = array_merge($term_tax_ids, $local_term_tax_ids);
1572
  }
1573
 
1574
  return array($query_restrictions, $term_tax_ids, $not_term_tax_ids, $and_term_tax_ids);
1575
+ }
 
 
 
lib/shortcodes.php CHANGED
@@ -39,7 +39,7 @@ function relevanssi_noindex_shortcode_indexing($atts, $content) {
39
  }
40
 
41
  function relevanssi_search_form() {
42
- return get_search_form();
43
  }
44
 
45
  ?>
39
  }
40
 
41
  function relevanssi_search_form() {
42
+ return get_search_form(false);
43
  }
44
 
45
  ?>
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: msaari
3
  Donate link: https://www.relevanssi.com/buy-premium/
4
  Tags: search, relevance, better search
5
  Requires at least: 4.0
6
- Tested up to: 4.9.1
7
  Requires PHP: 5.6
8
- Stable tag: 4.0.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -15,7 +15,9 @@ Relevanssi replaces the default search with a partial-match search that sorts re
15
 
16
  Relevanssi replaces the standard WordPress search with a better search engine, with lots of features and configurable options. You'll get better results, better presentation of results - your users will thank you.
17
 
18
- This is the free version of Relevanssi. There's also Relevanssi Premium, which has added features, including Multisite support. This free version does not work properly on Multisite. For more information about Premium, see [Relevanssi.com](https://www.relevanssi.com/).
 
 
19
 
20
  = Key features =
21
  * Search results sorted in the order of relevance, not by date.
@@ -34,14 +36,12 @@ This is the free version of Relevanssi. There's also Relevanssi Premium, which h
34
  * Index custom post types and custom taxonomies.
35
  * Index the contents of shortcodes.
36
  * Google-style "Did you mean?" suggestions based on successful user searches.
37
- * Automatic support for [WPML multi-language plugin](http://wpml.org/).
38
- * Automatic support for [s2member membership plugin](http://www.s2member.com/).
39
  * Advanced filtering to help hacking the search results the way you want.
40
  * Search result throttling to improve performance on large databases.
41
  * Disable indexing of post content and post titles with a simple filter hook.
42
 
43
- Relevanssi is available in two versions, regular and Premium. Regular Relevanssi is and will remain free to download and use. Relevanssi Premium comes with a cost, but will get all the new features. Standard Relevanssi will be updated to fix bugs, but new features will mostly appear in Premium. Also, support for standard Relevanssi depends very much on my mood and available time. Premium pricing includes support.
44
-
45
  = Premium features (only in Relevanssi Premium) =
46
  * Indexing PDF content.
47
  * Improved spelling correction in "Did you mean?" suggestions.
@@ -57,12 +57,7 @@ Relevanssi is available in two versions, regular and Premium. Regular Relevanssi
57
  * [WP CLI commands](https://www.relevanssi.com/user-manual/wp-cli/).
58
 
59
  = Relevanssi in Facebook =
60
- You can find [Relevanssi in Facebook](https://www.facebook.com/relevanssi). Become a fan to follow the development of the plugin, I'll post updates on bugs, new features and new versions to the Facebook page.
61
-
62
- = Other search plugins =
63
- Relevanssi owes a lot to [wpSearch](https://wordpress.org/extend/plugins/wpsearch/) by Kenny Katzgrau. Relevanssi was built to replace wpSearch, when it started to fail.
64
-
65
- Search Unleashed is a popular search plugin, but it hasn't been updated since 2010. Relevanssi is in active development and does what Search Unleashed does.
66
 
67
  == Screenshots ==
68
 
@@ -76,103 +71,34 @@ Search Unleashed is a popular search plugin, but it hasn't been updated since 20
76
 
77
  == Installation ==
78
 
79
- 1. Extract all files from the ZIP file, and then upload the plugin's folder to /wp-content/plugins/.
80
- 1. If your blog is in English, skip to the next step. If your blog is in other language, rename the file *stopwords* in the plugin directory as something else or remove it. If there is *stopwords.yourlanguage*, rename it to *stopwords*.
81
- 1. Activate the plugin through the 'Plugins' menu in WordPress.
82
- 1. Go to the plugin settings and build the index following the instructions there.
83
 
84
- To update your installation, simply overwrite the old files with the new, activate the new version and if the new version has changes in the indexing, rebuild the index.
85
-
86
- = Note on updates =
87
- If it seems the plugin doesn't work after an update, the first thing to try is deactivating and reactivating the plugin. If there are changes in the database structure, those changes do not happen without a deactivation, for some reason.
88
-
89
- = Changes to templates =
90
- None necessary! Relevanssi uses the standard search form and doesn't usually need any changes in the search results template.
91
 
92
  If the search does not bring any results, your theme probably has a query_posts() call in the search results template. That throws Relevanssi off. For more information, see [The most important Relevanssi debugging trick](https://www.relevanssi.com/knowledge-base/query_posts/).
93
 
94
- = How to index =
95
- Check the options to make sure they're to your liking, then click "Save indexing options and build the index". If everything's fine, you'll see the Relevanssi options screen again with a message "Indexing successful!"
96
-
97
- If something fails, usually the result is a blank screen. The most common problem is a timeout: server ran out of time while indexing. The solution to that is simple: just return to Relevanssi screen (do not just try to reload the blank page) and click "Continue indexing". Indexing will continue. Most databases will get indexed in just few clicks of "Continue indexing". You can follow the process in the "State of the Index": if the amount of documents is growing, the indexing is moving along.
98
-
99
- If the indexing gets stuck, something's wrong. I've had trouble with some plugins, for example Flowplayer video player stopped indexing. I had to disable the plugin, index and then activate the plugin again. Try disabling plugins, especially those that use shortcodes, to see if that helps. Relevanssi shows the highest post ID in the index - start troubleshooting from the post or page with the next highest ID. Server error logs may be useful, too.
100
-
101
- = Using custom search results =
102
- If you want to use the custom search results, make sure your search results template uses `the_excerpt()` to display the entries, because the plugin creates the custom snippet by replacing the post excerpt.
103
-
104
- If you're using a plugin that affects excerpts (like Advanced Excerpt), you may run into some problems. For those cases, I've included the function `relevanssi_the_excerpt()`, which you can use instead of `the_excerpt()`. It prints out the excerpt, but doesn't apply `wp_trim_excerpt()` filters (it does apply `the_content()`, `the_excerpt()`, and `get_the_excerpt()` filters).
105
-
106
- To avoid trouble, use the function like this:
107
-
108
- `<?php if (function_exists('relevanssi_the_excerpt')) { relevanssi_the_excerpt(); }; ?>`
109
-
110
- See Frequently Asked Questions for more instructions on what you can do with Relevanssi.
111
-
112
- = The advanced hacker option =
113
- If you're doing something unusual with your search and Relevanssi doesn't work, try using `relevanssi_do_query()`. See [Knowledge Base](https://www.relevanssi.com/knowledge-base/relevanssi_do_query/).
114
-
115
  = Uninstalling =
116
  To uninstall the plugin remove the plugin using the normal WordPress plugin management tools (from the Plugins page, first Deactivate, then Delete). If you remove the plugin files manually, the database tables and options will remain.
117
 
118
- = Combining with other plugins =
119
- Relevanssi doesn't work with plugins that rely on standard WP search. Those plugins want to access the MySQL queries, for example. That won't do with Relevanssi. [Search Light](http://wordpress.org/extend/plugins/search-light/), for example, won't work with Relevanssi.
120
-
121
- Some plugins cause problems when indexing documents. These are generally plugins that use shortcodes to do something somewhat complicated. One such plugin is [MapPress Easy Google Maps](http://wordpress.org/extend/plugins/mappress-google-maps-for-wordpress/). When indexing, you'll get a white screen. To fix the problem, disable either the offending plugin or shortcode expansion in Relevanssi while indexing. After indexing, you can activate the plugin again.
122
-
123
  == Frequently Asked Questions ==
124
 
125
  = Knowledge Base =
126
  You can find solutions and answers at the [Relevanssi Knowledge Base](https://www.relevanssi.com/category/knowledge-base/).
127
 
 
 
 
128
  = Relevanssi doesn't work =
129
- If you the results don't change after installing and activating Relevanssi, the most likely reason is that you have a call to `query_posts()` on your search results template. This confuses Relevanssi. Try removing the query_posts call and see what happens.
130
 
131
  = Searching for words with ampersands or hyphens doesn't work =
132
- Please read [Words with punctuation can't be found](https://www.relevanssi.com/knowledge-base/words-ampersands-cant-found/). This is a Relevanssi feature, but you can circumvent it with a simple filter function.
133
 
134
  = Where are the user search logs? =
135
- See the top of the admin menu. There's 'User searches'. There. If the logs are empty, please note showing the results needs at least MySQL 5.
136
-
137
- = Displaying the number of search results found =
138
-
139
- The typical solution to showing the number of search results found does not work with Relevanssi. However, there's a solution that's much easier: the number of search results is stored in a variable within $wp_query. Just add the following code to your search results template:
140
-
141
- `<?php echo 'Relevanssi found ' . $wp_query->found_posts . ' hits'; ?>`
142
-
143
- = Advanced search result filtering =
144
-
145
- If you want to add extra filters to the search results, you can add them using a hook. Relevanssi searches for results in the _relevanssi table, where terms and post_ids are listed. The various filtering methods work by listing either allowed or forbidden post ids in the query WHERE clause. Using the `relevanssi_where` hook you can add your own restrictions to the WHERE clause.
146
-
147
- These restrictions must be in the general format of
148
- ` AND doc IN (' . {a list of post ids, which could be a subquery} . ')`
149
-
150
- For more details, see where the filter is applied in the `relevanssi_search()` function. This is stricly an advanced hacker option for those people who're used to using filters and MySQL WHERE clauses and it is possible to break the search results completely by doing something wrong here.
151
-
152
- There's another filter hook, `relevanssi_hits_filter`, which lets you modify the hits directly. The filter passes an array, where index 0 gives the list of hits in the form of an array of post objects and index 1 has the search query as a string. The filter expects you to return an array containing the array of post objects in index 0 (`return array($your_processed_hit_array)`).
153
-
154
- = Direct access to query engine =
155
- Relevanssi can't be used in any situation, because it checks the presence of search with the `is_search()` function. This causes some unfortunate limitations and reduces the general usability of the plugin.
156
-
157
- You can now access the query engine directly. There's a new function `relevanssi_do_query()`, which can be used to do search queries just about anywhere. The function takes a WP_Query object as a parameter, so you need to store all the search parameters in the object (for example, put the search terms in `$your_query_object->query_vars['s']`). Then just pass the WP_Query object to Relevanssi with `relevanssi_do_query($your_wp_query_object);`.
158
-
159
- Relevanssi will process the query and insert the found posts as `$your_query_object->posts`. The query object is passed as reference and modified directly, so there's no return value. The posts array will contain all results that are found.
160
-
161
- = Sorting search results =
162
- If you want something else than relevancy ranking, you can use orderby and order parameters. Orderby accepts $post variable attributes and order can be "asc" or "desc". The most relevant attributes here are most likely "post_date" and "comment_count".
163
-
164
- If you want to give your users the ability to sort search results by date, you can just add a link to http://www.yourblogdomain.com/?s=search-term&orderby=post_date&order=desc to your search result page.
165
-
166
- Order by relevance is either orderby=relevance or no orderby parameter at all.
167
-
168
- = Filtering results by date =
169
- You can specify date limits on searches with `by_date` search parameter. You can use it your search result page like this: http://www.yourblogdomain.com/?s=search-term&by_date=1d to offer your visitor the ability to restrict their search to certain time limit (see [RAPLIQ](http://www.rapliq.org/) for a working example).
170
-
171
- The date range is always back from the current date and time. Possible units are hour (h), day (d), week (w), month (m) and year (y). So, to see only posts from past week, you could use by_date=7d or by_date=1w.
172
-
173
- Using wrong letters for units or impossible date ranges will lead to either defaulting to date or no results at all, depending on case.
174
-
175
- Thanks to Charles St-Pierre for the idea.
176
 
177
  = Displaying the relevance score =
178
  Relevanssi stores the relevance score it uses to sort results in the $post variable. Just add something like
@@ -182,80 +108,7 @@ Relevanssi stores the relevance score it uses to sort results in the $post varia
182
  to your search results template inside a PHP code block to display the relevance score.
183
 
184
  = Did you mean? suggestions =
185
- To use Google-style "did you mean?" suggestions, first enable search query logging. The suggestions are based on logged queries, so without good base of logged queries, the suggestions will be odd and not very useful.
186
-
187
- To use the suggestions, add the following line to your search result template, preferably before the have_posts() check:
188
-
189
- `<?php if (function_exists('relevanssi_didyoumean')) { relevanssi_didyoumean(get_search_query(), "<p>Did you mean: ", "?</p>", 5); }?>`
190
-
191
- The first parameter passes the search term, the second is the text before the result, the third is the text after the result and the number is the amount of search results necessary to not show suggestions. With the default value of 5, suggestions are not shown if the search returns more than 5 hits.
192
-
193
- Relevanssi Premium has a much better version of this feature.
194
-
195
- = Search shortcode =
196
- Relevanssi also adds a shortcode to help making links to search results. That way users can easily find more information about a given subject from your blog. The syntax is simple:
197
-
198
- `[search]John Doe[/search]`
199
-
200
- This will make the text John Doe a link to search results for John Doe. In case you want to link to some other search term than the anchor text (necessary in languages like Finnish), you can use:
201
-
202
- `[search term="John Doe"]Mr. John Doe[/search]`
203
-
204
- Now the search will be for John Doe, but the anchor says Mr. John Doe.
205
-
206
- One more parameter: setting `[search phrase="on"]` will wrap the search term in quotation marks, making it a phrase. This can be useful in some cases.
207
-
208
- = Restricting searches to categories and tags =
209
- Relevanssi supports the hidden input field `cat` to restrict searches to certain categories (or tags, since those are pretty much the same). Just add a hidden input field named `cat` in your search form and list the desired category or tag IDs in the `value` field - positive numbers include those categories and tags, negative numbers exclude them.
210
-
211
- This input field can only take one category or tag id (a restriction caused by WordPress, not Relevanssi). If you need more, use `cats` and use a comma-separated list of category IDs.
212
-
213
- The same works with post types. The input fields are called `post_type` and `post_types`.
214
-
215
- You can also set the restriction from general plugin settings (and then override it in individual search forms with the special field). This works with custom taxonomies as well, just replace `cat` with the name of your taxonomy.
216
-
217
- If you want to restrict the search to categories using a dropdown box on the search form, use a code like this:
218
-
219
- `<form method="get" action="<?php bloginfo('url'); ?>">
220
- <div><label class="screen-reader-text" for="s">Search</label>
221
- <input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
222
- <?php
223
- wp_dropdown_categories(array('show_option_all' => 'All categories'));
224
- ?>
225
- <input type="submit" id="searchsubmit" value="Search" />
226
- </div>
227
- </form>`
228
-
229
- This produces a search form with a dropdown box for categories. Do note that this code won't work when placed in a Text widget: either place it directly in the template or use a PHP widget plugin to get a widget that can execute PHP code.
230
-
231
- = Restricting searches with taxonomies =
232
-
233
- You can use taxonomies to restrict search results to posts and pages tagged with a certain taxonomy term. If you have a custom taxonomy of "People" and want to search entries tagged "John" in this taxonomy, just use `?s=keyword&people=John` in the URL. You should be able to use an input field in the search form to do this, as well - just name the input field with the name of the taxonomy you want to use.
234
-
235
- It's also possible to do a dropdown for custom taxonomies, using the same function. Just adjust the arguments like this:
236
-
237
- `wp_dropdown_categories(array('show_option_all' => 'All people', 'name' => 'people', 'taxonomy' => 'people'));`
238
-
239
- This would do a dropdown box for the "People" taxonomy. The 'name' must be the keyword used in the URL, while 'taxonomy' has the name of the taxonomy.
240
-
241
- = Automatic indexing =
242
- Relevanssi indexes changes in documents as soon as they happen. However, changes in shortcoded content won't be registered automatically. If you use lots of shortcodes and dynamic content, you may want to add extra indexing. Here's how to do it:
243
-
244
- `if (!wp_next_scheduled('relevanssi_build_index')) {
245
- wp_schedule_event( time(), 'daily', 'relevanssi_build_index' );
246
- }`
247
-
248
- Add the code above in your theme functions.php file so it gets executed. This will cause WordPress to build the index once a day. This is an untested and unsupported feature that may cause trouble and corrupt index if your database is large, so use at your own risk. This was presented at [forum](http://wordpress.org/support/topic/plugin-relevanssi-a-better-search-relevanssi-chron-indexing?replies=2).
249
-
250
- = Highlighting terms =
251
- Relevanssi search term highlighting can be used outside search results. You can access the search term highlighting function directly. This can be used for example to highlight search terms in structured search result data that comes from custom fields and isn't normally highlighted by Relevanssi.
252
-
253
- Just pass the content you want highlighted through `relevanssi_highlight_terms()` function. The content to highlight is the first parameter, the search query the second. The content with highlights is then returned by the function. Use it like this:
254
-
255
- `if (function_exists('relevanssi_highlight_terms')) {
256
- echo relevanssi_highlight_terms($content, get_search_query());
257
- }
258
- else { echo $content; }`
259
 
260
  = What is tf * idf weighing? =
261
 
@@ -267,10 +120,6 @@ Thus, the weight of the word for a document increases the more often it appears
267
 
268
  Each document database is full of useless words. All the little words that appear in just about every document are completely useless for information retrieval purposes. Basically, their inverted document frequency is really low, so they never have much power in matching. Also, removing those words helps to make the index smaller and searching faster.
269
 
270
- == Known issues and To-do's ==
271
- * Known issue: In general, multiple Loops on the search page may cause surprising results. Please make sure the actual search results are the first loop.
272
- * Known issue: Relevanssi doesn't necessarily play nice with plugins that modify the excerpt. If you're having problems, try using relevanssi_the_excerpt() instead of the_excerpt().
273
-
274
  == Thanks ==
275
  * Cristian Damm for tag indexing, comment indexing, post/page exclusion and general helpfulness.
276
  * Marcus Dalgren for UTF-8 fixing.
@@ -280,986 +129,16 @@ Each document database is full of useless words. All the little words that appea
280
 
281
  == Changelog ==
282
 
283
- = 4.0.3 =
284
- * Relevanssi didn't index all posts with one go. It does now.
285
- * © and ® symbols caused problems in indexing; they are now included in the default punctuation removal.
286
- * In some cases excerpt-building could take ages because of autoembed link discovery. Relevanssi now blocks the autoembed procedure in link-building.
287
- * New filter: `relevanssi_custom_field_value` is used to filter custom field values both before indexing and before excerpt-building. Parameters include the field name and the post ID.
288
- * Updated filter: `relevanssi_index_custom_fields` now gets a second parameter that contains the post ID.
289
-
290
- = 4.0.2 =
291
- * Removed couple of error notices in the code.
292
- * Improved the support for page builders.
293
- * Improvements to the Polylang setting.
294
-
295
- = 4.0.1 =
296
- * The plugin can now be uninstalled.
297
-
298
- = 4.0 =
299
- * Legacy code has been removed. If you have a version older than 3.6, update first to 3.6.2.2 to guarantee smooth upgrade process.
300
- * Improved indexing: no more clicking "Continue indexing" again and again!
301
- * Settings pages have been completely rewritten.
302
- * There's documentation in the WordPress contextual help: just click Help on the top right corner.
303
- * Better Polylang support. A new option to remove the Polylang language filter.
304
- * Logs can be automatically trimmed. Old log entries are removed to save space.
305
- * Finally a setting to adjust content weight!
306
- * Excerpts can use the custom field content.
307
- * Highlighting in documents is changed: it now requires a `highlight` query parameter. This helps getting pass caching and makes the highlighting more reliable. To get the query parameter active, use `relevanssi_get_permalink()` to print out the permalinks on the search results templates.
308
- * Relevanssi added synonyms to highlighting even if synonyms were not used for searching. In some cases, synonyms were added twice.
309
- * The User Searches page got a makeover, too.
310
- * Relevanssi is automatically disabled in REST API searches.
311
- * Groups and Simple Membership support has been improved.
312
- * Sorting search results is now up to 300 times faster than before.
313
- * Lots of improvements all over the place.
314
- * New filter: `relevanssi_excerpt_custom_field_content` lets you modify custom field content that is used for excerpts.
315
- * New filter: `relevanssi_punctuation_filter` allows for easy modification of punctuation handling.
316
- * New filter: `relevanssi_default_punctuation_replacement` changes the default way to handle the rest of the punctuation.
317
- * New filter: `relevanssi_search_again` lets you run the search again if no results are found and to modify the parameters between search runs.
318
- * New filter: `relevanssi_fallback` allows you to do fallback searches.
319
- * New filter: `relevanssi_page_builder_shortcodes` lets you control which page builder shortcodes Relevanssi removes before building the excerpts.
320
- * New filter: `relevanssi_optimize_excerpts` makes excerpt-building faster, if you make the filter return `true`.
321
-
322
- = 3.6.2.2 =
323
- * A bug in post sorting broke string sorting (mostly post title sorting).
324
-
325
- = 3.6.2.1 =
326
- * A bug was left in the post ordering code. That bug is now squashed.
327
-
328
- = 3.6.2 =
329
- * Simple Membership plugin is now supported automatically to restrict access to posts.
330
- * Relevanssi can now handle orderby parameter in array format.
331
- * Relevanssi now blocks Easy Digital Downloads shortcodes when indexing to improve compatibility with EDD.
332
- * When using `fields` to only fetch post IDs, Relevanssi doesn't try to highlight post titles.
333
- * New action: `relevanssi_update_options` lets you adjust Relevanssi options immediately after the defaults are set.
334
- * Remove notices about duplicated database columns when installing the plugin.
335
-
336
- = 3.6.1 =
337
- * SECURITY: This version fixes a SQL injection vulnerability, where a site admin could theoretically inject SQL code into Relevanssi search queries. Doing this required access to Relevanssi settings page and in my tests, I couldn't do any damage, just break the Relevanssi search, but in any case, this vulnerability is now fixed.
338
- * Search and Filter shortcode is added to the blacklist.
339
- * Groups plugin is now supported automatically to restrict access to posts.
340
- * The filter `relevanssi_index_custom_fields` now works even if the custom field setting is empty.
341
- * The filter `relevanssi_post_to_index` now has a second parameter. For posts, it simply repeats the post object, but for taxonomy terms, it has the term object.
342
-
343
- = 3.6.0 =
344
- * Changed a bit how Relevanssi attaches itself to queries. Instead of the global $wp_query, Relevanssi now uses the query passed as the parameter to `the_posts` filter hook. This should improve compatibility in some cases, but may cause problems in some fringe cases. If you're doing something unusual with Relevanssi, try this out before deploying to public use.
345
- * Some meta queries caused major problems with the Relevanssi weighting algorithm. This has now been fixed.
346
- * Error notices caused by trying to use a non-existing taxonomy term have been removed.
347
-
348
- = 3.5.12 =
349
- * Post type exclusion didn't work as expected.
350
- * Relevanssi couldn't handle nested tax queries (such as those generated by WooCommerce product visibility filtering) properly.
351
-
352
- = 3.5.11.1 =
353
- * New filter: `relevanssi_allow_one_letter_highlights` lets you allow one-letter highlights. Just make the filter function return `true`.
354
- * New filter: `relevanssi_block_one_letter_searches` by default blocks one-letter searches. If you want to enable them, add a filter function that always returns `false`.
355
- * Fixed an undefined variable notice.
356
-
357
- = 3.5.11 =
358
- * Synonym indexing failed if synonyms contained a forward slash.
359
- * Highlighting HTML tags has been improved further.
360
- * New filter: `relevanssi_tag_before_tokenize` allows you to access tag content before indexing.
361
- * Relevanssi now actively blocks one-letter search terms, as they are generally pointless and can cause "out of memory" issues. One-letter search terms are no longer highlighted, either. These are usually caused by cases like "word's" being interpreted as "word s".
362
- * New filter: `relevanssi_disable_shortcodes_excerpt` lets you add more shortcodes to be disabled before excerpts are built.
363
-
364
- = 3.5.10 =
365
- * Some users got a fatal parse error. That shouldn't happen anymore.
366
- * FacetWP users ran into trouble, as `relevanssi_do_query()` started to explicitly expect a WP_Query object in version 1.15.0. That expectation is removed; it's still highly recommended for future compatibility that you use WP_Query objects.
367
- * Small bug fix: `get_current_screen()` is now only used when it's available to avoid occasional fatal errors.
368
- * Error messages from `DOING_AJAX` being undefined should be removed.
369
-
370
- = 3.5.9.1 =
371
- * WP.org plugin repo didn't like 3.5.9 for some reason, hoping to have better luck with this.
372
-
373
- = 3.5.9 =
374
- * Improved the way highlighting handles HTML tags, especially when highlighting on post pages.
375
- * The throttle limit setting was removed from the settings page for causing trouble. If you need to change it, update `relevanssi_throttle_limit` option directly.
376
- * Relevanssi didn't support tax_queries with `field` set to `name`. That works now.
377
- * Much faster way of showing the 25 most common words in the index. If you've disabled this feature because it was so slow, try enabling it - you might be surprised!
378
-
379
- = 3.5.8 =
380
- * Did you mean function had a XSS vulnerability, which is now removed.
381
- * Minimum word length wasn't applied to titles in indexing. It is now fixed. If you think this is a problem, rebuild the index.
382
- * TablePress compatibility has been improved.
383
- * Meta query handling has been improved, thanks to Maxime Culea.
384
- * Improved WP_Query parameter support: setting query variable `sentence` to 1 forces phrase search.
385
- * Improved ACF compatibility.
386
-
387
- = 3.5.7.1 =
388
- * Small fix for a bug that broke the settings page.
389
-
390
- = 3.5.7 =
391
- * An improved version of the sorting function will not throw notices when Intuitive Custom Post Order plugin is used.
392
- * New filter: `relevanssi_missing_sort_key` can be used to adjust the result sorting when using keys that are not present in all posts (eg. menu_order).
393
- * Czech translation and stopwords, thanks to Michael Kucera.
394
- * Relevanssi broke the WP admin menu search when admin searches were enabled.
395
- * Relevanssi broke the admin page search under WP 4.7. Relevanssi is now disabled in admin page searches.
396
- * The way accented characters are handled in highlighting is improved. A new filter, `relevanssi_accents_replacement_arrays`, can be used to adjust the accent replacement.
397
-
398
- = 3.5.6.1 =
399
- * Fix for a fatal bug in 3.5.6.
400
-
401
- = 3.5.6 =
402
- * Relevanssi admin page had a vulnerability that allowed SQL injection attacks. That is now fixed.
403
- * Relevanssi didn't like to highlight search terms that are followed by a ?, an ! or an apostrophe.
404
- * New filter: `relevanssi_ok_to_log` lets you control whether search queries are logged or not.
405
-
406
- = 3.5.5 =
407
- * 500 errors caused by arrays in custom fields should be gone now.
408
- * Improvements to the ACF "select" field support.
409
- * Relevanssi will not break when frontend plugins insert posts.
410
- * `relevanssi_match` filter has a new parameter, which contains the search term.
411
- * Polylang support has been improved.
412
- * WPML and Polylang filters work when "fields" is set to "ids".
413
- * New filter: `relevanssi_log_get_user` gets passed the user object before Relevanssi decides if the query should be logged or not.
414
-
415
- = 3.5.4 =
416
- * Relevanssi had a bug that lead to inflated relevancy scores for posts.
417
- * Relevanssi can now index the human-readable labels of ACF "select" fields. (Thanks to Raphaël Droz.)
418
- * New filter: `relevanssi_30days` can be used to adjust the 30 day logs to a different number of days.
419
- * Adding stopwords that contain apostrophes didn't work.
420
- * Ensured PHP7 and WP 4.6 compatibility.
421
- * Fixed a small glitch that could happen if a highlighted term is next to a starting square bracket.
422
-
423
- = 3.5.3 =
424
- * New filter `relevanssi_user_searches_limit` to adjust the number of user searches shown in the logs.
425
- * Old data check is only done on Relevanssi settings page, not on all admin pages. That should improve admin performance.
426
- * Fixed a fatal error when searching includes private posts.
427
- * New filter: `relevanssi_remote_addr` can be used to modify the IP address logged to Relevanssi logs.
428
- * Blocked CFDB and WooCommerce shortcodes that are causing problems with Relevanssi.
429
-
430
- = 3.5.2 =
431
- * Added correct support for `term_taxonomy_id` in the `fields` parameter in tax_queries.
432
-
433
- = 3.5.1 =
434
- * Fixed an error in the Did you mean function.
435
- * Fixed an error if the search term was not found in content.
436
- * Fixed an error when building excerpts from posts shorter than the excerpt length.
437
- * Blocked the `[starpro]` shortcode that was causing problems with Relevanssi.
438
- * New filter: `relevanssi_remove_stopwords_in_titles` allows you to include stopwords in titles.
439
- * Added support for `term_tax_id` in the `fields` parameter in tax_queries.
440
- * Excerpt-building failed if multibyte string operations were missing. It should work now.
441
-
442
- = 3.5 =
443
- * Tokenizer was using `strlen()` and not `mb_strlen()`, so word lengths were not calculated properly. If your site uses non-ASCII alphabet, rebuilding the index is a good idea.
444
- * Small improvement to WPML multilanguage filtering.
445
- * `relevanssi_the_title()` got a new parameter: if you don't want to echo the title, you can use it like `relevanssi_the_title(false)` to make it return the title.
446
- * Relevanssi had `the_title` filter hook calls that were missing the second parameter; that's now fixed.
447
- * The excerpt-building algorithm is completely rewritten based on work by Ben Boyter (http://www.boyter.org/).
448
- * The `[watupro]` shortcode didn't work with Relevanssi, so Relevanssi will now bypass it.
449
- * The plugin i18n features have been improved slightly.
450
- * New filter: `relevanssi_didyoumean_suggestion` lets you modify the Did you mean? suggestion before it's displayed.
451
- * `relevanssi_didyoumean()` has a new parameter: you can now choose whether the result is echoed out (the default value) or just returned.
452
- * In the search results breakdown, you can now use %categories% and %taxonomies% to show the number of matches in categories and taxonomies other than tags and cats, respectively.
453
- * Relevanssi supports `fields` parameter (both `ids` and `id=>parent`) to return only post IDs or post IDs and post parents.
454
-
455
- = 3.4.2 =
456
- * Empty lines on synonym settings caused problems. Fixed that.
457
- * In WordPress 4.2 installations, emoji in will be handled better. Emoji in posts may cause problems with WordPress versions below 4.2, so please update!
458
-
459
- = 3.4.1 =
460
- * Removed a notice about an undefined variable.
461
-
462
- = 3.4 =
463
- * New filter: `relevanssi_valid_admin_status` can be used to adjust post statuses that Relevanssi will handle.
464
- * If Relevanssi creates an empty excerpt for a post and there's a user-set excerpt for the post, that excerpt is used.
465
- * No ellipsis is added to the post excerpt, if the post excerpt shows the whole post.
466
- * The `relevanssi_post_title_before_tokenize` filter now has a second parameter that contains the post object.
467
- * New filter: `relevanssi_display_common_words` can be used to disable the "25 most common words" listing on the settings page, if it's too heavy to load.
468
- * Relevanssi was sanitizing taxonomy titles too aggressively. That is now toned down a bit.
469
- * Relevanssi now supports `post_parent`, `post_parent__in` and `post_parent__not_in`, though you have to set them in `relevanssi_modify_wp_query` filter for them to work.
470
- * Meta query support should now be perfect; there were some limitations with complicated meta queries before.
471
-
472
- = 3.3.8 =
473
- * Fixed a bug that caused the results to change depending of the order of words in a multi-word search query.
474
- * Added `product_categories` and `recent_products` from WooCommerce to the list of blocked shortcodes.
475
- * There are improvements in excerpt-building and highlighting, especially when fuzzy search is enabled.
476
- * Fixed a possible (if quite unlikely) XSS vulnerability.
477
- * Improved search performance (thanks to MikeNGarrett).
478
- * Sometimes highlights in documents make the document content disappear. I don't know why, but I've added a fix that should make the content visible (without the highlights) if a problem appears.
479
-
480
- = 3.3.7.1 =
481
- * Fixed bbPress compatibility.
482
-
483
- = 3.3.7 =
484
- * Fixed bbPress compatibility.
485
-
486
- = 3.3.6 =
487
- * Relevanssi handles taxonomy terms in search better. The change requires a reindexing.
488
- * Fix in indexing: Relevanssi will now bypass the global $post when indexing. This should help with problems with the Cookie Law Info plugin, for example.
489
- * Tax query relation setting didn't work properly. It is now fixed.
490
- * Word-based excerpt building sometimes created too short excerpts. That is now fixed.
491
- * Synonyms are now highlighted.
492
- * Phrase matching had issues where searching for a too common phrase crashed the search. That has been fixed.
493
- * LIKE operator didn't work properly in meta_queries.
494
- * Problems with Avatar Upload plugin are fixed.
495
- * Offset errors with mb_stripos() shouldn't happen anymore.
496
- * A small problem in taxonomy search MySQL fixed, also a small problem with AND operator in tax_queries.
497
- * New filter: `relevanssi_post_to_index` lets you access the post object before the post is indexed.
498
- * New filter: `relevanssi_orderby` lets you modify the $orderby value before Relevanssi sorts posts.
499
- * New filter: `relevanssi_order` lets you modify the $order value before Relevanssi sorts posts.
500
- * New filter: `relevanssi_post_title_before_tokenize` lets you modify post titles before indexing.
501
- * New filter: `relevanssi_private_cap` lets you adjust the capability setting for private posts in custom post types.
502
- * Deprecated use of `like_escape` has been fixed.
503
-
504
- = 3.3.5 =
505
- * Fixed a bug where excluding posts would cause the search to fail.
506
- * Fixed a bug causing duplicate search results in WPML searches.
507
- * Increased plugin safety against hackers.
508
- * There was a bug in `relevanssi_comment_content_to_index` filter.
509
- * Some people had problems with the log entry timestamps. Fixed that.
510
- * New filter: `relevanssi_prevent_default_request` gives you more control over where Relevanssi prevents the default query from running.
511
- * New filter: `relevanssi_private_cap` lets you set the correct capability for finding private posts in custom post types.
512
- * The option to exclude categories and tags from search only worked for categories, not tags. Tags have been separated to a different option.
513
-
514
- = 3.3.4 =
515
- * Couple of bug fixes.
516
-
517
- = 3.3.3 =
518
- * OR fallback had problems.
519
- * Indexing sub pages didn't work.
520
- * Relevanssi now automatically treats 'ß' as 'ss'. If your site has 'ß' in text, reindexing the database is a good idea.
521
- * Query variable `post_status` is now supported.
522
-
523
- = 3.3.2 =
524
- * Fixed a warning on search results page.
525
-
526
- = 3.3.1 =
527
- * Fixed bugs related to the removal of the cache feature.
528
-
529
- = 3.3 =
530
- * Improvements to excerpts: excerpts with phrases work much better now, and the excerpt creation logic has been improved: the excerpts are now better. The process takes a bit more time, though.
531
- * Allowing HTML tags in excerpts could lead to those tags being left open. Relevanssi will now try to close open HTML tags in excerpts.
532
- * Allowed tags were not controlled in comments. They are now.
533
- * Highlighting in documents didn't always work; it should be more reliable now.
534
- * Non-integer values are removed from `post__in` and `post__not_in` before processing them.
535
- * Query variables `p` and `page_id` are now supported.
536
- * Relevanssi now understands `date_query` variables as well.
537
- * The original post excerpt is stored in $post->original_excerpt.
538
- * Taxonomy search works better with term id parameters (for example from `wp_category_dropdown`).
539
- * Errors about $wpdb->prepare() missing an argument removed.
540
- * New functions: `relevanssi_the_title()` and `relevanssi_get_the_title()` can be used to display highlighted titles in search results.
541
- * The old title highlighting method has been disabled, because it caused highlights in wrong places. Now the highlighted title is stored in $post->highlighted_post_title, take it from there or use the Relevanssi title functions to display it.
542
- * Polylang and WPML support was adjusted to perform better in edge cases.
543
- * Indexing is faster, thanks to some improved code from Tom Novelli.
544
- * MySQL injection attack vulnerability removed.
545
- * The cache feature is now removed. Relevanssi should automatically drop the cache tables.
546
- * New filter: `relevanssi_indexing_data` lets you modify the data before it's indexed.
547
-
548
- = 3.2 =
549
- * Fixed a bug in the TablePress support.
550
- * Titles are put through the_title filter before indexing.
551
- * New filter: `relevanssi_join` can be used to join tables in the Relevanssi search MySQL queries. Thanks to Ninos Ego.
552
- * New filter: `relevanssi_post_content` can be used to modify post content before any Relevanssi processing.
553
- * New filter: `relevanssi_post_content_before_tokenize` can be used to modify post content just before it's tokenized.
554
- * New filter: `relevanssi_indexing_values` can be used to modify what Relevanssi stores in the index.
555
- * New filter: `relevanssi_default_meta_query_relation` can be used to change the default meta query relation (default value is "AND").
556
- * When using a meta_query, `relation` can be set to OR now.
557
- * Phrases are now matched to excerpts.
558
- * Number of queries Relevanssi generates is much, much lower.
559
- * New filter: `relevanssi_didyoumean_url` lets you modify the URL generated by the did you mean feature.
560
- * Better set of Russian stopwords.
561
- * Relevanssi now highlights search query synonyms as well in documents.
562
-
563
- = 3.1.9 =
564
- * Fix to make Relevanssi compatible with WordPress 3.7.
565
- * Fixed a mistyped database table name.
566
- * Relevanssi disables responsive-flipbook shortcode in indexing; it was causing problems.
567
- * Fixed a problem with an author dropdown with no author selected.
568
-
569
- = 3.1.8 =
570
- * Category restriction and exclusion and couple of other category-related settings didn't work properly.
571
- * Support for Polylang broke the support for WPML. That is now fixed.
572
- * One deprecated `$wpdb->escape()` was still left; it's gone now.
573
- * Shortcode `layerslider` was causing problems with Relevanssi; Relevanssi now disables it before building excerpts.
574
- * Relevanssi won't break BBPress search anymore.
575
- * If Relevanssi Premium is installed, deleting Relevanssi will not remove the databases and the options.
576
-
577
- = 3.1.7 =
578
- * New filter: `relevanssi_comment_content_to_index` lets you modify comment content before it's indexed by Relevanssi (to index comment meta, for example).
579
- * Facetious support: if post_type is set to -1, Relevanssi will not hang up on it.
580
- * Numerical search terms work better now.
581
- * Excerpt-building had issues, which are now fixed.
582
- * Punctuation removal now replaces &nbsp; with a space.
583
- * "starrater" short code from GD Star Rating is now disabled in indexing.
584
- * Punctuation removal now replaces invisible spaces with a normal space.
585
- * Division by zero error caused by 0 in posts_per_page is now prevented, and -1 value for posts_per_page handled better.
586
- * Relevanssi doesn't apply `get_the_excerpt` filters to excerpts it builds any more.
587
- * New filter: `relevanssi_excerpt` lets you modify the excerpts Relevanssi creates.
588
- * Relevanssi now suspends WP post cache while indexing, making indexing a lot more efficient. Thanks to Julien Mession for this one.
589
- * Deprecated function errors in 3.6 removed.
590
- * When search included user profiles or taxonomy terms, Relevanssi would generate lots of MySQL errors. Not anymore.
591
- * New filter: `relevanssi_valid_status` lets you modify the post statuses Relevanssi indexes.
592
- * New filter: `relevanssi_index_taxonomies_args` lets you modify the arguments passed to get_terms() when indexing taxonomies (for example to set 'hide_empty' to false).
593
- * Searching by taxonomy ID could confuse two taxonomies with the same term_id. The search is now checking the taxonomy as well to see it's correct.
594
- * Basic support for Polylang plugin.
595
- * Russian and Italian stopwords are now included, thanks to Flector and Valerio Vendrame.
596
- * Small fix in the way user meta fields are handled.
597
-
598
- = 3.1.6 =
599
- * DEACTIVATE AND ACTIVATE THE PLUGIN AFTER YOU UPDATE.
600
- * Fuzzy searches are now a lot more efficient; they were a huge resource hog before.
601
- * Fixed a possible MySQL injection attack.
602
- * Fixed MySQL errors from empty meta queries.
603
- * Sort order (orderby and order variables) are now read from query variables instead of global variables.
604
- * Relevanssi will not choke on bad values of orderby anymore.
605
- * Limit searches is improved: when using AND search it is less likely to miss results.
606
- * Phrase recognition read the whole post content (which it didn't need) from database, causing memory issues in some cases. Fixed that.
607
- * Highlighting was broken, and should work much better now.
608
-
609
- = 3.1.5 =
610
- * OR fallback didn't actually fall back to OR, but instead got stuck in an endless loop of AND searches.
611
- * Meta queries didn't work without a key; now they work with just meta_value or meta_value_num.
612
- * Meta queries had problems with meta_value being set to null.
613
- * Relevanssi now supports category__and. By default this sets include_children to false.
614
- * When querying by slug, the term taxonomy is also taken into consideration, fixing problems when same slug appears in different taxonomies.
615
- * Author search didn't work.
616
- * Fixed an error message caused by all-number synonyms starting with zero, like 02.
617
- * Synonyms are now case-insensitive.
618
- * New filter: `relevanssi_default_tax_query_relation` can be used to change the default tax query relation from OR to AND.
619
- * Fixed undefined variable errors when doing an OR fallback.
620
- * New filter: `relevanssi_bots_to_not_log` makes it possible to block bots from logs. The format matches what other plugins, ie. WP-Useronline, use for bot blocking, so you can share block lists.
621
- * New filter: `relevanssi_admin_search_ok` gives you more control when Relevanssi overrides the default WP search in admin, useful for fixing P2P_Box AJAX search.
622
- * Ordering search results by title or date in admin search works now.
623
- * Modified the way the highlights work; now highlighting words with apostrophes should produce more meaningful results.
624
- * Highlighting should not highlight anything between & and ; or in <style> or <script> tags, thus solving some of the problems related to highlights. Reports of how well this works are welcome.
625
- * On-post highlighting now only highlights content in the loop, so menu texts and other off-the-loop stuff should not get highlights anymore.
626
- * New action hook: `relevanssi_pre_indexing_query` can be used to "SET OPTION SQL_BIG_SELECTS=1" if needed.
627
- * Major indexing problems caused by shortcodes changing the post ID during the indexing of posts are now fixed.
628
- * Relevanssi was being called twice when a post was saved, on `save_post` and `wp_insert_post`. I removed the hook on `save_post`.
629
- * Unsuccessful searches are now ordered by count, like the successful queries are.
630
-
631
- = 3.1.4 =
632
- * Choosing which taxonomies to index is now done with an easy-to-use checkbox list.
633
- * Support for WP Table Reloaded and TablePress. Tables created with these plugins will now be expanded and the content indexed by Relevanssi.
634
- * New filter: `relevanssi_index_comments_exclude` can be used to exclude comments from indexing. The filter gets the post ID as a parameter, so you can prevent comments of particular posts being indexed, yet index those posts.
635
- * Relevanssi now adds spaces between tags when creating excerpts to make neater excerpts from tables and other similar situations.
636
- * Relevanssi now indexes unattached attachments, if you choose to index attachments.
637
- * Fixed the problems with Twenty Ten and Twenty Eleven themes better.
638
- * $match->tag now contains the number of tag hits.
639
- * Relevanssi now adds relevance score to posts before passing them to relevanssi_hits_filter. You can find it in $post->relevance_score.
640
- * Tags in breakdowns always showed 0, even though tags were indexed and searched correctly. That's now fixed.
641
-
642
- = 3.1.3 =
643
- * AND search did not work in all cases.
644
- * Posts couldn't be found by category name. Fixed that.
645
-
646
- = 3.1.2 =
647
- * Exclude category option was broken. Fixed that.
648
- * Searching for a non-existing category ID caused an error. Fixed that.
649
- * Occasional blank screens of death occurred when multibyte string operations weren't installed. That should not happen anymore.
650
- * Fallback to OR search was a bit broken.
651
-
652
- = 3.1.1 =
653
- * Small fix to prevent database errors.
654
- * Small fix to prevent disappearing excerpts.
655
-
656
- = 3.1 =
657
- * Fixed the uninstalling instructions.
658
- * Fixes a problem with Twenty Ten and Twenty Eleven themes that caused doubled "Continue Reading" links.
659
- * Fixed a notice about undefined variable on plugin update pages.
660
- * Small bug fixes on search to remove warning notices.
661
- * New filter: `relevanssi_index_custom_fields` can be used to modify the list of custom fields to index.
662
- * Deleting menus caused a warning. That is now fixed.
663
- * Relevanssi has an option to disable IP logging (which is actually illegal in some countries). Thanks to Stefan Eufinger.
664
- * Searching in subcategories worked sometimes, but not always. Thanks to Faebu.
665
- * The "Limit searches" option didn't work too well in the case of strong weightings, as it didn't take note of any weights. Now it works better.
666
- * Added a note about disabling custom excerpts when they are not needed - they can slow down the search quite a bit.
667
- * New filter: `relevanssi_options_capability` can be used to modify the capability required to see the options page (default is `manage_options`).
668
- * Fixed the way IDF is calculated to account some extreme cases with small databases.
669
- * New filter: `relevanssi_index_custom_fields` gives added control over which custom fields are indexed.
670
- * Fixed filter: `relevanssi_pre_excerpt_content` wasn't working properly.
671
- * Relevanssi now supports tax_query, for most part. You can query multiple taxonomies, use relation AND and OR, use operators AND, IN and NOT IN and choose include_children (which defaults to true). Old `taxonomy` and `term` still work, but I recommend using tax_query for the level of control it offers.
672
- * Relevanssi now works better with category restrictions. The extra `cats` query variable is no longer necessary, Relevanssi can now read multiple categories from `cat`. You can also use `category__and`, `category__in` and `category__not_in`.
673
- * Same goes with tags: `tags` is now longer necessary. Relevanssi has full support for `tag`, `tag_id`, `tag__and`, `tag__in`, `tag__not_in`, `tag_slug__and`, `tag_slug__in` and `tag_slug__not_in`. For `tag`, both `term1+term2` and `term1,term2` is supported.
674
- * Relevanssi now supports `author_name` and negative values for `author`.
675
- * Relevanssi now supports `offset` query variable.
676
- * Relevanssi now supports meta_query. You can use all comparisons (also EXISTS and NOT EXISTS, even if you don't have WP 3.5). You can also use the older `meta_key` and `meta_value` query variables, including all the comparisons. I have not tested all possible meta_query constructions, so bug reports of things that don't work as expected are welcome.
677
- * New index on the database makes some database operations faster.
678
- * Removed a bug that prevents one-character words from being indexed in titles, despite the minimum word length setting.
679
- * Removed a warning when searching for nothing.
680
- * Fixes a warning about $wpdb->prepare() caused by a change in WordPress 3.5.
681
-
682
- = 3.0.5 =
683
- * AFTER UPGRADING FROM 2.x: Make sure you deactivate and reactivate Relevanssi in order to make the database changes happen.
684
- * Fixed a major bug that caused the searches to fail when "Limit searches" was enabled, but "Limit" was not defined.
685
- * Modified `relevanssi_remove_punct()` to replace curly apostrophes and quotes with spaces instead of removing them, to make the index more consistent (regular apostrophes were replaced with spaces). Reindexing the database is a good idea.
686
- * Fixed some misleading text on the options page.
687
-
688
- = 3.0.4 =
689
- * AFTER UPGRADING FROM 2.x: Make sure you deactivate and reactivate Relevanssi in order to make the database changes happen.
690
- * Fixed another problem with the Jetpack Contact Form.
691
- * Fixed an error message caused by searching for numbers.
692
- * Phrases are now also recognized in drafts and attachments.
693
- * You can now set `post_types` to 'any'.
694
-
695
- = 3.0.3 =
696
- * AFTER UPGRADING FROM 2.x: Make sure you deactivate and reactivate Relevanssi in order to make the database changes happen.
697
- * Fixed a bug that made custom taxonomy term searches fail.
698
- * New filter: `relevanssi_user_searches_capability` lets you modify the minimum capability required to see the User searches page.
699
-
700
- = 3.0.2 =
701
- * AFTER UPGRADING FROM 2.x: Make sure you deactivate and reactivate Relevanssi in order to make the database changes happen.
702
- * Fixed the "Cannot use a scalar value as an array" bug in indexing.
703
- * Role-Scoper users: in order to make Relevanssi work with Role-Scoper, replace the Relevanssi helper file in Role-Scoper with [this file](https://www.relevanssi.com/relevanssi-helper-front_rs.txt).
704
- * Removed an error message about set_time_limit() under safe_mode.
705
- * Jetpack Contact Form shortcode caused problems when indexing. Relevanssi will now simply remove the shortcode before indexing.
706
- * Fixed errors caused by / characters in highlighting.
707
-
708
- = 3.0.1 =
709
- * AFTER UPGRADING FROM 2.x: Make sure you deactivate and reactivate Relevanssi in order to make the database changes happen.
710
- * Fixed lots of problems in logging searches.
711
- * Added an alert when user hasn't selected any post types to index (and default values).
712
- * Custom field setting 'visible' works now.
713
- * Searching by category title works now, and you can adjust the category weight in the settings.
714
-
715
- = 3.0 =
716
- * AFTER UPGRADING FROM 2.x: Make sure you deactivate and reactivate Relevanssi in order to make the database changes happen.
717
- * WORD OF WARNING: This is a major update, with lots of changes as you can see, and since I couldn't find any beta testers to help test it out, consider this a beta release, with bugs probable.
718
- * The database has been updated to match the more advanced structure in Relevanssi Premium. This requires a re-indexing of the database.
719
- * The indexing process is more efficient now.
720
- * Relevanssi now includes a throttle feature, which makes the searches more efficient.
721
- * Relevanssi now disables the default WP search.
722
- * The custom field search hack using `cat` set to "custom" doesn't work any more. If you wish to filter by custom field, you need Relevanssi Premium, which does it better anyway.
723
- * Relevanssi can handle certain whitespace characters better in indexing.
724
- * Apostrophes are now replaced with whitespace instead of being removed.
725
- * Relevanssi now shows correct number of results when posts_per_page is set to -1.
726
- * Fuzzy search didn't always activate when it should, if all found posts are private posts that can't be shown to user.
727
- * Tab characters in excerpts are handled better now.
728
- * Relevanssi search logs will now store user ID's and IP addresses for each query.
729
- * You can now use user logins as well as numeric ID's to stop user from being logged.
730
- * Attachments are now handled better. I'd still like to hear any complaints about attachments.
731
- * Relevanssi now updates index for posts added with wp_update_post() function. (Thanks to Simon Blackbourn)
732
- * Searching for pages in admin didn't work properly. Fixed that.
733
- * Fixed warnings for undefined variables.
734
- * Relevanssi won't mess media library searches any more.
735
- * Search terms are no longer highlighted in titles on post pages. That caused too many problems.
736
- * New collation rules to MySQL databases will make sure that word pairs like "pode" and "pôde" will not be considered duplicates in the stopword database.
737
- * You can now set the "Custom fields to index" to "all" to index all custom fields and "visible" to index all visible custom fields (but not the ones with names starting with an underscore).
738
- * Plugin now works properly without multibyte string functions.
739
- * You can now choose to allow HTML tags in excerpts.
740
- * New filter: `relevanssi_modify_wp_query` lets you modify $wp_query before it is passed to Relevanssi.
741
- * New filter: `relevanssi_search_ok` lets you adjust when search is enabled.
742
- * New filter: `relevanssi_pre_excerpt_content` lets you adjust post content before excerpt creation.
743
- * New filter: `relevanssi_excerpt_content` lets you adjust post content before excerpt creation, but after `the_content`.
744
- * New filter: `relevanssi_ellipsis` lets you change the default '...' in excerpts to something else.
745
- * New filter: `relevanssi_do_not_index` is given a post ID and expects a boolean in return: should this post be indexed or not?
746
- * New filter: `relevanssi_match` lets you meddle with the matching engine.
747
- * New filter: `relevanssi_results` filters the result set from the search.
748
- * New filter: `relevanssi_content_to_index` let's you add whatever content you wish to posts before they are indexed.
749
- * New filter: `relevanssi_didyoumean_query` let's you modify the query for Did you mean? queries
750
- * Changed filter: `relevanssi_post_ok` has different arguments, see source code for details.
751
- * New shortcode: use shortcode `noindex` to wrap parts of posts you want to keep from the index.
752
- * And a bunch of other changes.
753
-
754
- = 2.9.14 =
755
- * Relevanssi will now index pending and future posts. These posts are only shown in the admin search.
756
-
757
- = 2.9.13 =
758
- * Stripping shortcodes from excerpts didn't work properly. Should work now.
759
- * Fixed a mistake in the FAQ: correct post date parameter is `post_date`, not `date`.
760
- * New filter `relevanssi_results` added. This filter will process an array with (post->ID => document weight) pairs.
761
- * Private and draft posts were deleted from the index when they were edited. This bug has been fixed. (Thanks to comprock.)
762
- * When continuing indexing, Relevanssi now tells if there's more to index. (Thanks to mrose17.)
763
- * Fixed problems with searching attachments. Indexing attachments still has some problems. When you build the index, attachments are indexed properly.
764
- * Improved WPML support.
765
- * The `relevanssi_index_doc()` function has a new parameter that allows you to bypass global $post and force the function to index the document given as a parameter (see 2.9.13 release notes at Relevanssi.com for more details).
766
-
767
- = 2.9.12 =
768
- * Scheduled cache truncate wasn't scheduled properly. It is now.
769
- * Added support for 'author' query variable.
770
- * Fixed a bug with indexing custom post types.
771
-
772
- = 2.9.11 =
773
- * Plugin now works properly without multibyte string functions.
774
- * Fixed s2member support for s2member versions 110912 and above. (Thanks to Jason Caldwell.)
775
- * Added support for 'tag' query variable.
776
-
777
- = 2.9.10 =
778
- * AND search failed, when search query included terms that are shorter than the minimum word length.
779
- * Improved s2member support.
780
- * Fixed errors about deprecated ereg_replace.
781
- * Small fix to Did you mean suggestions.
782
-
783
- = 2.9.9 =
784
- * Removed warnings about undefined functions and missing $wpdb.
785
- * Fixed a bug that removed 'à' from search terms.
786
- * Phrases are recognized from custom field searches.
787
-
788
- = 2.9.8 =
789
- * Support for s2member membership plugin. Search won't show posts that the current user isn't allowed to see.
790
- * New filter `relevanssi_post_ok` can be used to add support for other membership plugins.
791
- * Post meta fields that contain arrays are now indexed properly, expanding all the arrays.
792
-
793
- = 2.9.7 =
794
- * Fixed a bug that causes problems when paging search results.
795
- * Taxonomy term restrictions didn't work most of the time.
796
- * the_content filters didn't run on excerpts.
797
- * Style data and other extra elements created by short codes are now stripped.
798
-
799
- = 2.9.6 =
800
- * Fixed a problem causing "Attempt to modify property of non-object" errors.
801
- * Fixed a warning message.
802
-
803
- = 2.9.5 =
804
- * Searching for private posts caused an error message.
805
-
806
- = 2.9.4 =
807
- * Relevanssi should now be much lighter on server.
808
- * Post date selection didn't work properly. Fixed that.
809
- * Stopwords can be exported.
810
- * Restricting indexing on custom post types works better.
811
- * Minimum word length is properly enforced in indexing.
812
- * Punctuation removal is more efficient.
813
- * Fixed a MySQL error that was triggered by a media upload.
814
- * Fixed a bug that caused an error when quick editing a post.
815
-
816
- = 2.9.3 =
817
- * A call to a non-existing function in 2.9.2 made all sorts of mess. This release fixes all problems with broken loops. I'm sorry about the bug.
818
-
819
- = 2.9.2 =
820
- * It's now possible to adjust the number of search results per page. See [Changing posts_per_page](https://www.relevanssi.com/knowledge-base/posts-per-page/) for instructions.
821
- * Somebody reported revisions appearing in the search results. Added an extra check to prevent that.
822
- * Improved the indexing procedure to prevent MySQL errors from appearing and to streamline the process.
823
- * Improved the way custom post types can be handled in indexing.
824
- * Improved the method of removing nested highlights.
825
-
826
- = 2.9.1 =
827
- * It is now possible to change the default result order from relevance to post date.
828
- * Fixed a bug that caused wrong $post object to be set in indexing.
829
- * Added a new hook `relevanssi_excerpt_content`; see [Knowledge Base](https://www.relevanssi.com/category/knowledge-base/) for details.
830
-
831
- = 2.9 =
832
- * Fixed a bug that caused Cyrillic searches in the log to get corrupted.
833
- * Punctuation removal function is now triggered with a filter call and can thus be replaced.
834
- * Google Adsense caused double hits to the user search logs. That's now fixed thanks to Justin Klein.
835
- * User search log is available to user with `edit_post` capabilities (editor role). Thanks to John Blackbourn.
836
- * A proper database collation is now set. Thanks to John Blackbourn.
837
- * UI looks better. Thanks to John Blackbourn.
838
- * Lots of small fixes here and there.
839
-
840
- = 2.8.2 =
841
- * The `order` parameter was case sensitive. It isn't anymore.
842
- * WordPress didn't support searching for multiple categories with the `cat` query variable. There's now new `cats` which can take multiple categories.
843
- * Similar to `cats` vs `cat`, you can use `post_types` to restrict the search to multiple post types.
844
-
845
- = 2.8.1 =
846
- * Fixed two small mistakes that caused error notices.
847
- * Custom post types, particularly those created by More Types plugin, were causing problems.
848
-
849
- = 2.8 =
850
- * There's now a way to truncate the cache (sorry it took so long). Expired cache data is now automatically removed from the database every day. There's also an option to clear the caches.
851
- * Highlights didn't work properly with non-ASCII alphabets. Now there's an option to make them work.
852
- * Title highlight option now affects external search term highlights as well.
853
- * There were some bugs on the options page.
854
-
855
- = 2.7.5 =
856
- * There was a bug that caused shortcodes to fail in 2.7.4. That's fixed now.
857
- * Category search will now include subcategories as well, both when including and excluding.
858
-
859
- = 2.7.4 =
860
- * Improved the fallback to fuzzy search if no hits are found with regular search.
861
- * AND searches sometimes failed to work properly, causing unnecessary fallback to OR search. Fixed.
862
- * When using WPML, it's now possible to choose if the searches are limited to current language.
863
- * Adding stopwords from the list of 25 common words didn't work. It works now.
864
- * The instructions to add a category dropdown to search form weren't quite correct. They are now.
865
- * Small fix that makes shortcodes in posts more compatible with Relevanssi.
866
-
867
- = 2.7.3 =
868
- * IMPORTANT SECURITY UPDATE: Earlier versions of Relevanssi have a cross-site scripting (XSS) vulnerability. Please install this update as soon as possible.
869
- * Added instructions of doing a category dropdown in the search form in the FAQ.
870
-
871
- = 2.7.2 =
872
- * A silly typo caused the caching not to work. That's fixed now.
873
- * A new filter: `relevanssi_didyoumean_query` lets you modify the query used for 'Did you mean?' searches.
874
-
875
- = 2.7.1 =
876
- * Thanks to a bug in the code, the WPML support didn't work. It's fixed now.
877
-
878
- = 2.7 =
879
- * Caching search results is possible. If you have lots of repeated queries, caching will provide extra speed and less wear on server.
880
- * Multilanguage plugin WPML is now supported. If WPML is active, Relevanssi will automatically restrict search results to current language.
881
- * New filter: `relevanssi_search_filter` lets you adjust search query variables. See source code for further details. Thanks to Sam Hotchkiss.
882
- * Got a report of synonyms not working; hopefully fixed it now.
883
- * It is now possible to set the minimum word length to index. Default is now 3 instead of 2.
884
- * You can now add several stopwords at one go and remove all stopwords.
885
- * Author search didn't work properly. It works now.
886
- * Search result highlighting functions properly now, there might've been some problems with it.
887
-
888
- = 2.6 =
889
- * New setting allows user to define how `exclude_from_search` is handled. It's now possible to exclude a custom post type from general searches and search for it specifically by defining post_type.
890
- * New filter: `relevanssi_hits_filter` lets you process hits found by Relevanssi. See FAQ.
891
-
892
- = 2.5.6 =
893
- * Attachments are no longer automatically indexed; there's an option for it now.
894
- * You can now exclude custom post types from index.
895
- * When AND search fails, it falls back to OR search. It's now possible to disable this fallback.
896
-
897
- = 2.5.5 =
898
- * The stopword management created empty stopwords. It won't anymore.
899
- * Faulty HTML code in the admin page has been fixed.
900
- * Indexing shortcodes that need the global $post context is now possible.
901
- * Relevanssi is now aware of attachments and manages post_status of "inherit".
902
- * These fixes were provided by Warren Tape, thanks!
903
-
904
- = 2.5.4 =
905
- * Small bugfix relating to post types.
906
- * Added stopword management tools: way to remove and add stopwords.
907
- * Custom excerpts can now be created from post excerpts as well, if those are indexed.
908
- * Added answers to some frequently asked questions to the documentation.
909
-
910
- = 2.5.3 =
911
- * Very small bugfix fixing the error on line 1192.
912
-
913
- = 2.5.2 =
914
- * Fixed a bug about `mysql_real_escape_string()` expecting a string.
915
- * Added documentation about compatibility issues.
916
-
917
- = 2.5.1 =
918
- * Option to highlight search terms in comment text as well.
919
- * Fixed a small problem in highlighting search terms.
920
-
921
- = 2.5 =
922
- * Better support for other search plugins like [Dave's WordPress Live Search](http://wordpress.org/extend/plugins/daves-wordpress-live-search/).
923
- * New User searches screen that shows more data about user searches.
924
- * Search logs can now be emptied.
925
- * Custom fields weren't indexed on updated posts. That is now fixed.
926
- * Once again improved the highlighting: now the highlighting will look for word boundaries and won't highlight terms inside words.
927
- * Relevanssi query engine can now be accessed directly, making all sorts of advanced hacking easier. See FAQ.
928
-
929
- = 2.4.1 =
930
- * Fixed a problem where search term highlighting was changing terms to lowercase.
931
- * Fixed a problem with highlighting breaking stuff in shortcodes.
932
- * Made some changes to the admin interface - there's more to come here, as the admin page is a bit of a mess right now.
933
-
934
- = 2.4 =
935
- * Highlighting post content won't highlight inside HTML tags anymore.
936
- * Soft hyphens inside words are now removed in indexing. They still confuse the highlighting.
937
- * Matching engine is now able to match category titles that contain apostrophes.
938
-
939
- = 2.3.3.1 =
940
- * Suppressed the error messages on the correct mb_strpos() function call. If you still get mb_strpos() errors, update.
941
- * Added a FAQ note on getting the number of search results found.
942
-
943
- = 2.3.3 =
944
- * Suppressed notices on one mb_strpos() call.
945
- * Added a search variable "by_date" to filter search results, see FAQ for details.
946
-
947
- = 2.3.2 =
948
- * Fixed a serious bug related to taxonomy term searches that could cause strange search results. Thanks to Charles St-Pierre for finding and killing the bug.
949
- * Spanish stopwords are now included (thanks to Miguel Mariano).
950
-
951
- = 2.3.1 =
952
- * I fixed the highlighting logic a bit, the highlighting didn't work properly before.
953
-
954
- = 2.3 =
955
- * New highlighting option: HTML5 mark tag. Thanks to Jeff Byrnes.
956
- * Relevanssi can now highlight search term hits in the posts user views from search. Highlighting for search term hits from external searches will be added later.
957
- * It is now possible to add custom filtering to search results, see FAQ for details. Thanks to Charles St-Pierre.
958
- * Removed search result highlighting from admin search, where it wasn't very useful.
959
-
960
- = 2.2 =
961
- * Relevanssi used to index navigation menu items. It won't, anymore.
962
- * Translation and stopwords in Brazilian Portuguese added, thanks to Pedro Padron.
963
-
964
- = 2.1.9 =
965
- * No changes, I'm just trying to resurrect the broken Relevanssi plugin page.
966
-
967
- = 2.1.8 =
968
- * Including the popular microtime_float function caused conflicts with several other plugins (whose authors are just as sloppy as I am!). Fixed that.
969
-
970
- = 2.1.7 =
971
- * The index categories option wasn't saved properly. Now it is.
972
- * Fixed the %terms% breakdown option to show correct counts and added %total% to show total hit count.
973
- * Phrases are now matched also in post titles and category titles (before they were only matched against post content).
974
- * Post excerpts can now be indexed and searched. I would appreciate feedback from people who use this feature: do you use the excerpts in search results? If you use custom snippets created by Relevanssi, what you want them to display?
975
- * Set the constant TIMER to true to enable timing of the search process for debugging reasons.
976
-
977
- = 2.1.6 =
978
- * Title highlighting caused an error. That is now fixed. I also streamlined the highlighting code a bit.
979
-
980
- = 2.1.5 =
981
- * You can now enter synonyms, expanding queries with synonyms when doing an OR search. This is useful to expand acronyms and abbreviations, for example.
982
- * When doing a phrase search, highlighting will only highlight phrase hits.
983
- * New breakdown variable %terms% will list hits by term.
984
- * Some users reported error messages about unexpected T_OBJECT_OPERATOR. Those shouldn't happen, please let me know if they still do.
985
- * Highlighting will now highlight only complete words.
986
-
987
- = 2.1.4 =
988
- * Fixed a small bug that could cause all queries by anonymous users to go unlogged.
989
-
990
- = 2.1.3 =
991
- * OR operator makes a comeback! The default operator is now an option, and if you choose AND and search gets no results, an OR search is also run.
992
- * You can now give a list of user ids - any searches by those users will not be logged. List your admin user id, so your test searches won't clutter the log.
993
-
994
- = 2.1.2 =
995
- * Removing punctuation didn't work properly, making phrase search impossible. I'd thought I'd fix it, but for some reason I made a mistake and the fix didn't appear in the released versions.
996
- * Search has now an implicit AND operator, which means that every search term must appear in all result documents. Please let me know if you'd prefer an implicit OR operator, like Relevanssi had before.
997
- * Relevanssi options page now shows the amount of indexed documents, making troubleshooting indexing easier.
998
-
999
- = 2.1.1 =
1000
- * "Did you mean" suggestions now work in blogs that are not in root directory.
1001
- * Early 2.1 downloads had faulty encodings. Update to make sure you've got a good file.
1002
-
1003
- = 2.1 =
1004
- * An experimental "Did you mean" suggestion feature. Feedback is most welcome.
1005
- * Added a short code to facilitate adding links to search results.
1006
- * Fixed a small bug that in some cases caused MySQL errors.
1007
-
1008
- = 2.0.3 =
1009
- * Fixed problems relating to the orderby parameter.
1010
-
1011
- = 2.0.2 =
1012
- * Small bug fix: with private posts, sometimes correct amount of posts weren't displayed.
1013
-
1014
- = 2.0.1 =
1015
- * Exclude posts/pages option wasn't saved on the options page. It works now.
1016
- * 2.0 included an unnecessary function that broke Relevanssi in WP 2.8.5. Fixed that.
1017
-
1018
- = 2.0 =
1019
- * Post authors can now be indexed and searched. Author are indexed by their display name.
1020
- * In search results, $post->relevance_score variable will now contain the score of the search result.
1021
- * Comment authors are now included in the index, if comments are indexed.
1022
- * Search results can be sorted by any $post field and in any order, in addition of sorting them by relevancy.
1023
- * Private posts are indexed and displayed to the users capable of seeing them. This uses Role-Scoper plugin, if it's available, otherwise it goes by WordPress capabilities.
1024
- * Searches can be restricted with a taxonomy term (see FAQ for details).
1025
-
1026
- = 1.9 =
1027
- * Excerpts are now better and will contain more search terms and not just the first hit.
1028
- * Fixed an error relating to shortcodes in excerpts.
1029
- * If comments are indexed, custom excerpts will show text from comments as well as post content.
1030
- * Custom post type posts are now indexed as they are edited. That didn't work before.
1031
- * Cleaned out more error notices.
1032
-
1033
- = 1.8.1 =
1034
- * Sometimes empty ghost entries would appear in search results. No more.
1035
- * Added support for the WordPress' post_type argument to restrict search results to single post type.
1036
- * Relevanssi will now check for the presence of multibyte string functions and warn if they're missing.
1037
- * The category indexing option checkbox didn't work. It's now fixed.
1038
- * Small fix in the way punctuation is removed.
1039
- * Added a new indexing option to index all public post types.
1040
-
1041
- = 1.8 =
1042
- * Fixed lots of error notices that popped up when E_NOTICE was on. Sorry about those.
1043
- * Custom post types can now be indexed if wanted. Default behaviour is to index all post types (posts, pages and custom types).
1044
- * Custom taxonomies can also be indexed in addition to standard post tags. Default behaviour is to index nothing. If somebody knows a way to list all custom taxonomies, that information would be appreciated.
1045
-
1046
- = 1.7.3 =
1047
- * Small bug fix: code that created database indexes was broken. Say "ALTER TABLE `wp_relevanssi` ADD INDEX (doc)" and "ALTER TABLE `wp_relevanssi` ADD INDEX (term)" to your MySQL db to fix this for an existing installation.
1048
-
1049
- = 1.7.2 =
1050
- * Small bug fix: public posts that are changed to private are now removed from index (password protected posts remain in index).
1051
- * An Italian translation is now included (thanks to Alessandro Fiorotto).
1052
-
1053
- = 1.7.1 =
1054
- * Small fix: the hidden variable cat now accepts negative category and tag ids. Negative categories and tags are excluded in search. Mixing inclusion and exclusion is possible.
1055
-
1056
- = 1.7 =
1057
- * Major bug fix: Relevanssi doesn't kill other post loops on the search result page anymore. Please let me know if Relevanssi feels too slow after the update.
1058
- * Post categories can now be indexed.
1059
-
1060
- = 1.6 =
1061
- * Relevanssi is now able to expand shortcodes before indexing to include shortcode content to the index.
1062
- * Fixed a bug related to indexing, where tag stripping didn't work quite as expected.
1063
-
1064
- = 1.5.3 =
1065
- * Added a way to uninstall the plugin.
1066
- * A French translation is now included (thanks to Jean-Michel Meyer).
1067
-
1068
- = 1.5.2 =
1069
- * Fixed a small typo in the code, tag and comment hit count didn't work in the breakdown. If you don't use the breakdown feature, updating is not necessary.
1070
-
1071
- = 1.5.1 =
1072
- * User interface update, small changes to make the plugin easier to use.
1073
- * Fixed a small bug that sometimes causes "Empty haystack" warnings.
1074
-
1075
- = 1.5 =
1076
- * Comments can now be indexed and searched (thanks to Cristian Damm).
1077
- * Tags can also be indexed (thanks to Cristian Damm).
1078
- * Search term hits in the titles can be highlighted in search results (thanks to Cristian Damm).
1079
- * When using custom excerpts, it's possible to add extra information on where the hits were made.
1080
- * Fuzzy matching is now user-adjustable.
1081
- * UTF-8 support is now better (thanks to Marcus Dalgren).
1082
-
1083
- = 1.4.4 =
1084
- * Added an option to exclude posts or pages from search results. This feature was requested and provided by Cristian Damm.
1085
-
1086
- = 1.4.3 =
1087
- * Indexing of custom fields is now possible. Just add a list of custom field names you want to include in the index on the settings page and re-index.
1088
-
1089
- = 1.4.2 =
1090
- * Users can search for specific phrases by wrapping the phase with "quotes".
1091
- * Fixed a bug that caused broken HTML in some cases of highlighted search results (search term matches in highlighting HTML tags were being highlighted).
1092
- * Improved punctuation removal. This change requires reindexing the whole database.
1093
-
1094
- = 1.4.1 =
1095
- * Fixed a bug that caused empty search snippets when using word-based snippets.
1096
- * Improved support for WP 2.5.
1097
- * Added an option to exclude categories and tags from search results.
1098
- * Added an option to index only posts or pages.
1099
- * Added French stopwords.
1100
-
1101
- = 1.4 =
1102
- * Added an option to restrict searches to certain categories or tags, either by plugin option or hidden input field in the search form.
1103
- * The contents of `<script>` and other such tags are now removed from excerpts.
1104
- * When indexing, HTML tags and `[shortcodes]` are removed.
1105
- * Digits are no longer removed from terms. Re-index database to get them indexed.
1106
- * Wrapped the output of `relevanssi_the_excerpt()` in <p> tags.
1107
- * Stopwords are no longer removed from search queries.
1108
- * Search result snippet length can now be determined in characters or whole words.
1109
-
1110
- = 1.3.3 =
1111
- * Small bug fixes, removed the error message caused by a query that is all stop words.
1112
- * Content and excerpt filters are now applied to excerpts created by Relevanssi.
1113
- * Default highlight CSS class has a unique name, `search-results` was already used by WordPress.
1114
-
1115
- = 1.3.2 =
1116
- * Quicktags are now stripped from custom-created excerpts.
1117
- * Added a function `relevanssi_the_excerpt()`, which prints out the excerpt without triggering `wp_trim_excerpt()` filters.
1118
-
1119
- = 1.3.1 =
1120
- * Another bug fix release.
1121
-
1122
- = 1.3 =
1123
- * New query logging feature. Any feedback on query log display features would be welcome: what information you want to see?
1124
- * Added a CSS class option for search term highlighting.
1125
- * Fixed a bug in the search result excerpt generation code that caused endless loops with certain search terms.
1126
-
1127
- = 1.2 =
1128
- * Added new features to display custom search result snippets and highlight the search terms in the results.
1129
-
1130
- = 1.1.3 =
1131
- * Fixed a small bug, made internationalization possible (translations are welcome!).
1132
-
1133
- = 1.1.2 =
1134
- * English stopword file had a problem, which is now fixed.
1135
-
1136
- = 1.1.1 =
1137
- * Fixed a stupid bug introduced in the previous update. Remember always to test your code before sending files to repository!
1138
-
1139
- = 1.1 =
1140
- * Fixes the problem with pages in search results.
1141
-
1142
- = 1.0 =
1143
- * First published version.
1144
 
1145
  == Upgrade notice ==
1146
 
1147
- = 4.0.3 =
1148
- * Small bugfixes, correction to indexing procedure.
1149
-
1150
- = 4.0.2 =
1151
- * Minor bugfixes.
1152
-
1153
- = 4.0.1 =
1154
- * Fixes a bug in uninstalling the plugin.
1155
-
1156
- = 4.0 =
1157
- * Major new release. Testing at staging is recommended. Deactivate and reactivate after upgrade!
1158
-
1159
- = 3.6.2.2 =
1160
- * Fixes a bug in string sorting (for example post title ordering).
1161
-
1162
- = 3.6.2.1 =
1163
- * Fixes a bug in the post sorting algorithm.
1164
-
1165
- = 3.6.2 =
1166
- * Support for array orderby and other fine features.
1167
-
1168
- = 3.6.1 =
1169
- * Fix for a security vulnerability where a site admin could inject SQL code into search queries.
1170
-
1171
- = 3.6.0 =
1172
- * A big change in how Relevanssi works with queries. This should reduce compatibility issues, but may cause unexpected results.
1173
-
1174
- = 3.5.11 =
1175
- * Improvements in excerpts, new filters.
1176
-
1177
- = 3.5.10 =
1178
- * Prevented a fatal error for some users, small bug fixes.
1179
-
1180
- = 3.5.9.1 =
1181
- * Improvements in highlighting and taxonomy searches.
1182
-
1183
- = 3.5.9 =
1184
- * Improvements in highlighting and taxonomy searches.
1185
-
1186
- = 3.5.8 =
1187
- * Fix for a XSS vulnerability.
1188
-
1189
- = 3.5.7.1 =
1190
- * Fix for the broken settings page.
1191
-
1192
- = 3.5.7 =
1193
- * Bug fixes and small improvements.
1194
-
1195
- = 3.5.6.1 =
1196
- * Fix for a fatal error.
1197
-
1198
- = 3.5.6 =
1199
- * Fix for a SQL injection vulnerability.
1200
-
1201
- = 3.5.5 =
1202
- * Bug fixes and small improvements.
1203
-
1204
- = 3.5.4 =
1205
- * Fix for a small bug that leads to inflated relevancy scores.
1206
-
1207
- = 3.5.3 =
1208
- * New filters and a fix for a fatal error.
1209
-
1210
- = 3.5.2 =
1211
- * Small fix: Relevanssi now supports term_taxonomy_id parameter in tax_queries
1212
-
1213
- = 3.5.1 =
1214
- * Small bug fixes and a new filter.
1215
-
1216
- = 3.5 =
1217
- * Improved excerpt-building, several bug fixes, couple of small updates.
1218
-
1219
- = 3.4.2 =
1220
- * Better emoji support in WP 4.2, fixed issues with synonyms.
1221
-
1222
- = 3.4.1 =
1223
- * Removed a notice about an undefined variable.
1224
-
1225
- = 3.4 =
1226
- * Bug fixes, better meta_query support, better excerpt handling.
1227
-
1228
- = 3.3.8 =
1229
- * Bug fixes, fix for a possible XSS vulnerability, improved performance.
1230
-
1231
- = 3.3.7.1 =
1232
- * Improved bbPress compatibility.
1233
-
1234
- = 3.3.7 =
1235
- * Fixed bbPress compatibility.
1236
-
1237
- = 3.3.6 =
1238
- * Many new features, small bug fixes and WP 4.0 compatibility.
1239
-
1240
- = 3.3.5 =
1241
- * Bug fixes and security updates.
1242
-
1243
- = 3.3.4 =
1244
- * Bug fixes.
1245
-
1246
- = 3.3.3 =
1247
- * OR fallback and indexing sub pages fixed.
1248
-
1249
- = 3.3.2 =
1250
- * Fixes a warning on search page.
1251
-
1252
- = 3.3.1 =
1253
- * Removing the cache feature wasn't complete, which caused problems. Those should be fixed now.
1254
-
1255
- = 3.3 =
1256
- * Critical MySQL injection vulnerability fixed, better excerpts and highlights, bug fixes. This version removes the cache feature.
1257
-
1258
- = 3.2 =
1259
- * New filters, better search efficiency, new features, small bug fixes.
1260
-
1261
- = 3.1.9 =
1262
- * WordPress 3.7 compatibility, couple of minor bug fixes.
1263
-
1264
- = 3.1.8 =
1265
- * Recommended for users of WPML and BBpress. Category exclusions and restrictions are also fixed.
3
  Donate link: https://www.relevanssi.com/buy-premium/
4
  Tags: search, relevance, better search
5
  Requires at least: 4.0
6
+ Tested up to: 5.0
7
  Requires PHP: 5.6
8
+ Stable tag: 4.0.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
15
 
16
  Relevanssi replaces the standard WordPress search with a better search engine, with lots of features and configurable options. You'll get better results, better presentation of results - your users will thank you.
17
 
18
+ This is the free version of Relevanssi. There's also Relevanssi Premium, which has added features. For more information about Premium, see [Relevanssi.com](https://www.relevanssi.com/).
19
+
20
+ Do note that using Relevanssi may require large amounts (hundreds of megabytes) of database space. If your hosting setup has a limited amount of space for database tables, using Relevanssi may cause problems. In those cases use of Relevanssi cannot be recommended.
21
 
22
  = Key features =
23
  * Search results sorted in the order of relevance, not by date.
36
  * Index custom post types and custom taxonomies.
37
  * Index the contents of shortcodes.
38
  * Google-style "Did you mean?" suggestions based on successful user searches.
39
+ * Support for [WPML multi-language plugin](http://wpml.org/) and [Polylang](https://wordpress.org/plugins/polylang/).
40
+ * Support for [s2member membership plugin](http://www.s2member.com/), [Members](https://wordpress.org/plugins/members/), [Groups](https://wordpress.org/plugins/groups/) and [Simple Membership](https://wordpress.org/plugins/simple-membership/).
41
  * Advanced filtering to help hacking the search results the way you want.
42
  * Search result throttling to improve performance on large databases.
43
  * Disable indexing of post content and post titles with a simple filter hook.
44
 
 
 
45
  = Premium features (only in Relevanssi Premium) =
46
  * Indexing PDF content.
47
  * Improved spelling correction in "Did you mean?" suggestions.
57
  * [WP CLI commands](https://www.relevanssi.com/user-manual/wp-cli/).
58
 
59
  = Relevanssi in Facebook =
60
+ You can find [Relevanssi in Facebook](https://www.facebook.com/relevanssi).
 
 
 
 
 
61
 
62
  == Screenshots ==
63
 
71
 
72
  == Installation ==
73
 
74
+ 1. Install the plugin from the WordPress plugin screen.
75
+ 1. Activate the plugin.
76
+ 1. Go to the plugin settings page and build the index following the instructions there.
77
+ 1. That's it!
78
 
79
+ Relevanssi uses the standard search form and doesn't usually need any changes in the search results template.
 
 
 
 
 
 
80
 
81
  If the search does not bring any results, your theme probably has a query_posts() call in the search results template. That throws Relevanssi off. For more information, see [The most important Relevanssi debugging trick](https://www.relevanssi.com/knowledge-base/query_posts/).
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  = Uninstalling =
84
  To uninstall the plugin remove the plugin using the normal WordPress plugin management tools (from the Plugins page, first Deactivate, then Delete). If you remove the plugin files manually, the database tables and options will remain.
85
 
 
 
 
 
 
86
  == Frequently Asked Questions ==
87
 
88
  = Knowledge Base =
89
  You can find solutions and answers at the [Relevanssi Knowledge Base](https://www.relevanssi.com/category/knowledge-base/).
90
 
91
+ = Contextual help =
92
+ Answers to many common problems can be found from the contextual menu. Just click "Help" in the top right corner of your WordPress admin dashboard on the Relevanssi settings page.
93
+
94
  = Relevanssi doesn't work =
95
+ If you the results don't change after installing and activating Relevanssi, the most likely reason is that you have a call to `query_posts()` on your search results template. This confuses Relevanssi. Try removing the `query_posts()` call and see what happens.
96
 
97
  = Searching for words with ampersands or hyphens doesn't work =
98
+ Please read [Words with punctuation can't be found](https://www.relevanssi.com/knowledge-base/words-ampersands-cant-found/). This is a Relevanssi feature, but you can fix it from Relevanssi indexing settings.
99
 
100
  = Where are the user search logs? =
101
+ See the top of the admin menu. There's 'User searches'.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  = Displaying the relevance score =
104
  Relevanssi stores the relevance score it uses to sort results in the $post variable. Just add something like
108
  to your search results template inside a PHP code block to display the relevance score.
109
 
110
  = Did you mean? suggestions =
111
+ Relevanssi offers Google-style "Did you mean?" suggestions. See ["Did you mean" suggestions](https://www.relevanssi.com/knowledge-base/did-you-mean-suggestions/) in the Knowledge Base for more details.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
  = What is tf * idf weighing? =
114
 
120
 
121
  Each document database is full of useless words. All the little words that appear in just about every document are completely useless for information retrieval purposes. Basically, their inverted document frequency is really low, so they never have much power in matching. Also, removing those words helps to make the index smaller and searching faster.
122
 
 
 
 
 
123
  == Thanks ==
124
  * Cristian Damm for tag indexing, comment indexing, post/page exclusion and general helpfulness.
125
  * Marcus Dalgren for UTF-8 fixing.
129
 
130
  == Changelog ==
131
 
132
+ = 4.0.5 =
133
+ * Relevanssi code has been reviewed and modified to follow WordPress coding standards. As a result, there have been minor improvements all around the code to make things more robust and secure.
134
+ * Custom field detail is no longer serialized. It's now JSON. If you use custom field detail, rebuild the index and change your code to use json_decode() instead of unserialize().
135
+ * `relevanssi_the_tags()` and `relevanssi_get_the_tags()` now have different set of parameters, more in line with `the_tags()` and `get_the_tags()`.
136
+ * Taxonomy indexing settings were emptied out if you saved another options tab. That is now fixed.
137
+ * Improvements to WPML support; WPML is now less likely to be confused in multisite searches.
138
+ * Updated filter: `relevanssi_search_ok` now gets the WP_Query object as a parameter, which is helpful if you're not using the global $wp_query.
139
+ * ACF Flexible Content field indexing didn't work properly, possibly due to a change in ACF. That should now work better.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
  == Upgrade notice ==
142
 
143
+ = 4.0.4 =
144
+ * Codebase review, lots of small improvements everywhere.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
relevanssi.php CHANGED
@@ -3,13 +3,13 @@
3
  Plugin Name: Relevanssi
4
  Plugin URI: https://www.relevanssi.com/
5
  Description: This plugin replaces WordPress search with a relevance-sorting search.
6
- Version: 4.0.3
7
  Author: Mikko Saari
8
  Author URI: http://www.mikkosaari.fi/
9
  Text Domain: relevanssi
10
  */
11
 
12
- /* Copyright 2017 Mikko Saari (email: mikko@mikkosaari.fi)
13
 
14
  This file is part of Relevanssi, a search plugin for WordPress.
15
 
3
  Plugin Name: Relevanssi
4
  Plugin URI: https://www.relevanssi.com/
5
  Description: This plugin replaces WordPress search with a relevance-sorting search.
6
+ Version: 4.0.4
7
  Author: Mikko Saari
8
  Author URI: http://www.mikkosaari.fi/
9
  Text Domain: relevanssi
10
  */
11
 
12
+ /* Copyright 2018 Mikko Saari (email: mikko@mikkosaari.fi)
13
 
14
  This file is part of Relevanssi, a search plugin for WordPress.
15