Relevanssi – A Better Search - Version 4.8.3

Version Description

  • New feature: Both relevanssi_fuzzy_query and relevanssi_term_where now get the current search term as a parameter.
  • Minor fix: Relevanssi database tables don't have PRIMARY keys, only UNIQUE keys. In case this is a problem (for example on Digital Ocean servers), deactivate and activate Relevanssi to fix the problem.
  • Minor fix: When posts_per_page was set to -1, the max_num_pages was incorrectly set to the number of posts found. It should, of course, be 1.
  • Minor fix: Excluding from logs didn't work if user IDs had spaces between them ('user_a, user_b'). This is now fixed for good, the earlier fix didn't work.
Download this release

Release Info

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

Code changes from version 4.8.2 to 4.8.3

lib/common.php CHANGED
@@ -1862,7 +1862,7 @@ function relevanssi_flatten_array( array $array ) {
1862
  foreach ( new RecursiveIteratorIterator( new RecursiveArrayIterator( $array ) ) as $value ) {
1863
  $return_value .= ' ' . $value;
1864
  }
1865
- return $return_value;
1866
  }
1867
 
1868
  /**
1862
  foreach ( new RecursiveIteratorIterator( new RecursiveArrayIterator( $array ) ) as $value ) {
1863
  $return_value .= ' ' . $value;
1864
  }
1865
+ return trim( $return_value );
1866
  }
1867
 
1868
  /**
lib/init.php CHANGED
@@ -46,6 +46,7 @@ add_filter( 'relevanssi_remove_punctuation', 'relevanssi_remove_punct' );
46
  add_filter( 'relevanssi_post_ok', 'relevanssi_default_post_ok', 9, 2 );
47
  add_filter( 'relevanssi_query_filter', 'relevanssi_limit_filter' );
48
  add_action( 'relevanssi_trim_logs', 'relevanssi_trim_logs' );
 
49
  add_action( 'relevanssi_custom_field_value', 'relevanssi_filter_custom_fields', 10, 2 );
50
 
51
  // Page builder shortcodes.
@@ -368,7 +369,7 @@ function relevanssi_create_database_tables( $relevanssi_db_version ) {
368
  mysqlcolumn_detail longtext NOT NULL,
369
  type varchar(210) NOT NULL DEFAULT 'post',
370
  item bigint(20) NOT NULL DEFAULT '0',
371
- UNIQUE KEY doctermitem (doc, term, item)) $charset_collate";
372
 
373
  dbDelta( $sql );
374
 
@@ -379,6 +380,7 @@ function relevanssi_create_database_tables( $relevanssi_db_version ) {
379
  $relevanssi_term_reverse_idx_exists = false;
380
  $docs_exists = false;
381
  $typeitem_exists = false;
 
382
  foreach ( $indices as $index ) {
383
  if ( 'terms' === $index->Key_name ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
384
  $terms_exists = true;
@@ -392,6 +394,9 @@ function relevanssi_create_database_tables( $relevanssi_db_version ) {
392
  if ( 'typeitem' === $index->Key_name ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
393
  $typeitem_exists = true;
394
  }
 
 
 
395
  }
396
 
397
  if ( ! $terms_exists ) {
@@ -414,8 +419,13 @@ function relevanssi_create_database_tables( $relevanssi_db_version ) {
414
  $wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery
415
  }
416
 
 
 
 
 
 
417
  $sql = 'CREATE TABLE ' . $relevanssi_stopword_table . " (stopword varchar(50) $charset_collate_bin_column NOT NULL,
418
- UNIQUE KEY stopword (stopword)) $charset_collate;";
419
 
420
  dbDelta( $sql );
421
 
@@ -425,7 +435,7 @@ function relevanssi_create_database_tables( $relevanssi_db_version ) {
425
  time timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
426
  user_id bigint(20) NOT NULL DEFAULT '0',
427
  ip varchar(40) NOT NULL DEFAULT '',
428
- UNIQUE KEY id (id)) $charset_collate;";
429
 
430
  dbDelta( $sql );
431
 
@@ -433,10 +443,14 @@ function relevanssi_create_database_tables( $relevanssi_db_version ) {
433
  $indices = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching
434
 
435
  $query_exists = false;
 
436
  foreach ( $indices as $index ) {
437
  if ( 'query' === $index->Key_name ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
438
  $query_exists = true;
439
  }
 
 
 
440
  }
441
 
442
  if ( ! $query_exists ) {
@@ -444,6 +458,11 @@ function relevanssi_create_database_tables( $relevanssi_db_version ) {
444
  $wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching
445
  }
446
 
 
 
 
 
 
447
  update_option( 'relevanssi_db_version', $relevanssi_db_version );
448
  }
449
 
46
  add_filter( 'relevanssi_post_ok', 'relevanssi_default_post_ok', 9, 2 );
47
  add_filter( 'relevanssi_query_filter', 'relevanssi_limit_filter' );
48
  add_action( 'relevanssi_trim_logs', 'relevanssi_trim_logs' );
49
+ add_action( 'relevanssi_update_counts', 'relevanssi_update_counts' );
50
  add_action( 'relevanssi_custom_field_value', 'relevanssi_filter_custom_fields', 10, 2 );
51
 
52
  // Page builder shortcodes.
369
  mysqlcolumn_detail longtext NOT NULL,
370
  type varchar(210) NOT NULL DEFAULT 'post',
371
  item bigint(20) NOT NULL DEFAULT '0',
372
+ PRIMARY KEY doctermitem (doc, term, item)) $charset_collate";
373
 
374
  dbDelta( $sql );
375
 
380
  $relevanssi_term_reverse_idx_exists = false;
381
  $docs_exists = false;
382
  $typeitem_exists = false;
383
+ $doctermitem_exists = false;
384
  foreach ( $indices as $index ) {
385
  if ( 'terms' === $index->Key_name ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
386
  $terms_exists = true;
394
  if ( 'typeitem' === $index->Key_name ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
395
  $typeitem_exists = true;
396
  }
397
+ if ( 'doctermitem' === $index->Key_name ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
398
+ $doctermitem_exists = true;
399
+ }
400
  }
401
 
402
  if ( ! $terms_exists ) {
419
  $wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery
420
  }
421
 
422
+ if ( $doctermitem_exists ) {
423
+ $sql = "DROP INDEX doctermitem ON $relevanssi_table";
424
+ $wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery
425
+ }
426
+
427
  $sql = 'CREATE TABLE ' . $relevanssi_stopword_table . " (stopword varchar(50) $charset_collate_bin_column NOT NULL,
428
+ PRIMARY KEY stopword (stopword)) $charset_collate;";
429
 
430
  dbDelta( $sql );
431
 
435
  time timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
436
  user_id bigint(20) NOT NULL DEFAULT '0',
437
  ip varchar(40) NOT NULL DEFAULT '',
438
+ PRIMARY KEY id (id)) $charset_collate;";
439
 
440
  dbDelta( $sql );
441
 
443
  $indices = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching
444
 
445
  $query_exists = false;
446
+ $id_exists = false;
447
  foreach ( $indices as $index ) {
448
  if ( 'query' === $index->Key_name ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
449
  $query_exists = true;
450
  }
451
+ if ( 'id' === $index->Key_name ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
452
+ $id_exists = true;
453
+ }
454
  }
455
 
456
  if ( ! $query_exists ) {
458
  $wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching
459
  }
460
 
461
+ if ( $id_exists ) {
462
+ $sql = "DROP INDEX id ON $relevanssi_log_table";
463
+ $wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching
464
+ }
465
+
466
  update_option( 'relevanssi_db_version', $relevanssi_db_version );
467
  }
468
 
lib/interface.php CHANGED
@@ -844,88 +844,106 @@ function relevanssi_options_form() {
844
  printf( "<input type='hidden' name='tab' value='%s' />", esc_attr( $active_tab ) );
845
 
846
  $this_page = '?page=' . plugin_basename( $relevanssi_variables['file'] );
847
- ?>
848
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
849
  <h2 class="nav-tab-wrapper">
850
- <a href="<?php echo esc_attr( $this_page ); ?>&amp;tab=overview" class="nav-tab <?php echo 'overview' === $active_tab ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Overview', 'relevanssi' ); ?></a>
851
- <a href="<?php echo esc_attr( $this_page ); ?>&amp;tab=indexing" class="nav-tab <?php echo 'indexing' === $active_tab ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Indexing', 'relevanssi' ); ?></a>
852
- <a href="<?php echo esc_attr( $this_page ); ?>&amp;tab=attachments" class="nav-tab <?php echo 'attachments' === $active_tab ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Attachments', 'relevanssi' ); ?></a>
853
- <a href="<?php echo esc_attr( $this_page ); ?>&amp;tab=searching" class="nav-tab <?php echo 'searching' === $active_tab ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Searching', 'relevanssi' ); ?></a>
854
- <a href="<?php echo esc_attr( $this_page ); ?>&amp;tab=logging" class="nav-tab <?php echo 'logging' === $active_tab ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Logging', 'relevanssi' ); ?></a>
855
- <a href="<?php echo esc_attr( $this_page ); ?>&amp;tab=excerpts" class="nav-tab <?php echo 'excerpts' === $active_tab ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Excerpts and highlights', 'relevanssi' ); ?></a>
856
- <a href="<?php echo esc_attr( $this_page ); ?>&amp;tab=synonyms" class="nav-tab <?php echo 'synonyms' === $active_tab ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Synonyms', 'relevanssi' ); ?></a>
857
- <a href="<?php echo esc_attr( $this_page ); ?>&amp;tab=stopwords" class="nav-tab <?php echo 'stopwords' === $active_tab ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Stopwords', 'relevanssi' ); ?></a>
858
- <a href="<?php echo esc_attr( $this_page ); ?>&amp;tab=redirects" class="nav-tab <?php echo 'redirects' === $active_tab ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Redirects', 'relevanssi' ); ?></a>
859
- <?php if ( RELEVANSSI_PREMIUM ) : ?>
860
- <a href="<?php echo esc_attr( $this_page ); ?>&amp;tab=related" class="nav-tab <?php echo 'related' === $active_tab ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Related', 'relevanssi' ); ?></a>
861
- <a href="<?php echo esc_attr( $this_page ); ?>&amp;tab=importexport" class="nav-tab <?php echo 'importexport' === $active_tab ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Import / Export options', 'relevanssi' ); ?></a>
862
- <?php endif; ?>
863
  </h2>
864
 
865
  <?php
866
- if ( 'overview' === $active_tab ) {
867
- if ( ! RELEVANSSI_PREMIUM ) {
868
- $display_save_button = false;
869
- }
870
- require_once 'tabs/overview-tab.php';
871
- relevanssi_overview_tab();
872
- }
873
- if ( 'logging' === $active_tab ) {
874
- require_once 'tabs/logging-tab.php';
875
- relevanssi_logging_tab();
876
- }
877
- if ( 'searching' === $active_tab ) {
878
- require_once 'tabs/searching-tab.php';
879
- relevanssi_searching_tab();
880
- }
881
- if ( 'excerpts' === $active_tab ) {
882
- require_once 'tabs/excerpts-tab.php';
883
- relevanssi_excerpts_tab();
884
- }
885
- if ( 'indexing' === $active_tab ) {
886
- require_once 'tabs/indexing-tab.php';
887
- relevanssi_indexing_tab();
888
- }
889
- if ( 'attachments' === $active_tab ) {
890
- if ( ! RELEVANSSI_PREMIUM ) {
891
- $display_save_button = false;
892
- require_once 'tabs/attachments-tab.php';
893
- relevanssi_attachments_tab();
894
- } else {
895
- require_once dirname( $relevanssi_variables['file'] ) . '/premium/tabs/attachments-tab.php';
896
- relevanssi_attachments_tab();
897
- }
898
- }
899
- if ( 'synonyms' === $active_tab ) {
900
- require_once 'tabs/synonyms-tab.php';
901
- relevanssi_synonyms_tab();
902
- }
903
- if ( 'stopwords' === $active_tab ) {
904
- require_once 'tabs/stopwords-tab.php';
905
- relevanssi_stopwords_tab();
906
- }
907
- if ( 'importexport' === $active_tab ) {
908
- if ( RELEVANSSI_PREMIUM ) {
909
- require_once dirname( $relevanssi_variables['file'] ) . '/premium/tabs/import-export-tab.php';
910
- relevanssi_import_export_tab();
911
- }
912
- }
913
- if ( 'related' === $active_tab ) {
914
- if ( RELEVANSSI_PREMIUM ) {
915
- require_once dirname( $relevanssi_variables['file'] ) . '/premium/tabs/related-tab.php';
916
- relevanssi_related_tab();
917
- }
918
  }
919
- if ( 'redirects' === $active_tab ) {
920
- if ( ! RELEVANSSI_PREMIUM ) {
921
- $display_save_button = false;
922
- require_once 'tabs/redirects-tab.php';
923
- relevanssi_redirects_tab();
924
- } else {
925
- require_once dirname( $relevanssi_variables['file'] ) . '/premium/tabs/redirects-tab.php';
926
- relevanssi_redirects_tab();
927
- }
928
  }
 
929
 
930
  if ( $display_save_button ) :
931
  ?>
844
  printf( "<input type='hidden' name='tab' value='%s' />", esc_attr( $active_tab ) );
845
 
846
  $this_page = '?page=' . plugin_basename( $relevanssi_variables['file'] );
 
847
 
848
+ $tabs = array(
849
+ array(
850
+ 'slug' => 'overview',
851
+ 'name' => __( 'Overview', 'relevanssi' ),
852
+ 'require' => 'tabs/overview-tab.php',
853
+ 'callback' => 'relevanssi_overview_tab',
854
+ 'save' => 'premium',
855
+ ),
856
+ array(
857
+ 'slug' => 'indexing',
858
+ 'name' => __( 'Indexing', 'relevanssi' ),
859
+ 'require' => 'tabs/indexing-tab.php',
860
+ 'callback' => 'relevanssi_indexing_tab',
861
+ 'save' => true,
862
+ ),
863
+ array(
864
+ 'slug' => 'attachments',
865
+ 'name' => __( 'Attachments', 'relevanssi' ),
866
+ 'require' => 'tabs/attachments-tab.php',
867
+ 'callback' => 'relevanssi_attachments_tab',
868
+ 'save' => false,
869
+ ),
870
+ array(
871
+ 'slug' => 'searching',
872
+ 'name' => __( 'Searching', 'relevanssi' ),
873
+ 'require' => 'tabs/searching-tab.php',
874
+ 'callback' => 'relevanssi_searching_tab',
875
+ 'save' => true,
876
+ ),
877
+ array(
878
+ 'slug' => 'logging',
879
+ 'name' => __( 'Logging', 'relevanssi' ),
880
+ 'require' => 'tabs/logging-tab.php',
881
+ 'callback' => 'relevanssi_logging_tab',
882
+ 'save' => true,
883
+ ),
884
+ array(
885
+ 'slug' => 'excerpts',
886
+ 'name' => __( 'Excerpts and Highlights', 'relevanssi' ),
887
+ 'require' => 'tabs/excerpts-tab.php',
888
+ 'callback' => 'relevanssi_excerpts_tab',
889
+ 'save' => true,
890
+ ),
891
+ array(
892
+ 'slug' => 'synonyms',
893
+ 'name' => __( 'Synonyms', 'relevanssi' ),
894
+ 'require' => 'tabs/synonyms-tab.php',
895
+ 'callback' => 'relevanssi_synonyms_tab',
896
+ 'save' => true,
897
+ ),
898
+ array(
899
+ 'slug' => 'stopwords',
900
+ 'name' => __( 'Stopwords', 'relevanssi' ),
901
+ 'require' => 'tabs/stopwords-tab.php',
902
+ 'callback' => 'relevanssi_stopwords_tab',
903
+ 'save' => true,
904
+ ),
905
+ array(
906
+ 'slug' => 'redirects',
907
+ 'name' => __( 'Redirects', 'relevanssi' ),
908
+ 'require' => 'tabs/redirects-tab.php',
909
+ 'callback' => 'relevanssi_redirects_tab',
910
+ 'save' => false,
911
+ ),
912
+ );
913
+
914
+ /**
915
+ * Allows adding new tabs to the Relevanssi menu.
916
+ *
917
+ * @param array $tabs An array of arrays defining the tabs.
918
+ *
919
+ * @return array Filtered tab array.
920
+ */
921
+ $tabs = apply_filters( 'relevanssi_tabs', $tabs );
922
+ ?>
923
  <h2 class="nav-tab-wrapper">
924
+ <?php
925
+ array_walk(
926
+ $tabs,
927
+ function( $tab ) use ( $this_page, $active_tab ) {
928
+ ?>
929
+ <a href="<?php echo esc_attr( $this_page ); ?>&amp;tab=<?php echo esc_attr( $tab['slug'] ); ?>"
930
+ class="nav-tab <?php echo esc_attr( $tab['slug'] === $active_tab ? 'nav-tab-active' : '' ); ?>">
931
+ <?php echo esc_html( $tab['name'] ); ?></a>
932
+ <?php
933
+ }
934
+ );
935
+ ?>
 
936
  </h2>
937
 
938
  <?php
939
+ $current_tab = $tabs[ array_search( $active_tab, wp_list_pluck( $tabs, 'slug' ), true ) ];
940
+ if ( ! $current_tab['save'] || ( ! RELEVANSSI_PREMIUM && 'premium' === $current_tab['save'] ) ) {
941
+ $display_save_button = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
942
  }
943
+ if ( $current_tab['require'] ) {
944
+ require_once $current_tab['require'];
 
 
 
 
 
 
 
945
  }
946
+ call_user_func( $current_tab['callback'] );
947
 
948
  if ( $display_save_button ) :
949
  ?>
lib/log.php CHANGED
@@ -18,10 +18,12 @@
18
  *
19
  * @param string $query The search query.
20
  * @param int $hits The number of hits found.
 
 
21
  */
22
  function relevanssi_update_log( $query, $hits ) {
23
  if ( empty( $query ) ) {
24
- return;
25
  }
26
 
27
  // Bot filter, by Justin_K.
@@ -39,9 +41,9 @@ function relevanssi_update_log( $query, $hits ) {
39
  * @param array $bots An array of bot user agents.
40
  */
41
  $bots = apply_filters( 'relevanssi_bots_to_not_log', $bots );
42
- foreach ( $bots as $name => $lookfor ) {
43
  if ( false !== stristr( $user_agent, $lookfor ) ) {
44
- return;
45
  }
46
  }
47
  }
@@ -57,12 +59,12 @@ function relevanssi_update_log( $query, $hits ) {
57
  $user = apply_filters( 'relevanssi_log_get_user', wp_get_current_user() );
58
  if ( 0 !== $user->ID && get_option( 'relevanssi_omit_from_logs' ) ) {
59
  $omit = explode( ',', get_option( 'relevanssi_omit_from_logs' ) );
60
- array_walk( $omit, 'trim' );
61
  if ( in_array( strval( $user->ID ), $omit, true ) ) {
62
- return;
63
  }
64
  if ( in_array( $user->user_login, $omit, true ) ) {
65
- return;
66
  }
67
  }
68
 
@@ -107,7 +109,9 @@ function relevanssi_update_log( $query, $hits ) {
107
  $ip
108
  )
109
  );
 
110
  }
 
111
  }
112
 
113
  /**
@@ -117,11 +121,13 @@ function relevanssi_update_log( $query, $hits ) {
117
  *
118
  * @global object $wpdb The WordPress database interface.
119
  * @global array $relevanssi_variables The global Relevanssi variables, used for database table names.
 
 
120
  */
121
  function relevanssi_trim_logs() {
122
  global $wpdb, $relevanssi_variables;
123
  $interval = intval( get_option( 'relevanssi_trim_logs' ) );
124
- $wpdb->query(
125
  $wpdb->prepare(
126
  'DELETE FROM ' . $relevanssi_variables['log_table'] . ' WHERE time < TIMESTAMP(DATE_SUB(NOW(), INTERVAL %d DAY))', // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.PreparedSQL.InterpolatedNotPrepared
127
  $interval
@@ -169,7 +175,7 @@ function relevanssi_export_log_data( $user_id, $page ) {
169
 
170
  $item_id = "relevanssi_logged_search-{$id}";
171
  $group_id = 'relevanssi_logged_searches';
172
- $group_label = __( 'Logged seaches', 'relevanssi' );
173
  $data = array(
174
  array(
175
  'name' => __( 'Time', 'relevanssi' ),
18
  *
19
  * @param string $query The search query.
20
  * @param int $hits The number of hits found.
21
+ *
22
+ * @return boolean True if logged, false if not logged.
23
  */
24
  function relevanssi_update_log( $query, $hits ) {
25
  if ( empty( $query ) ) {
26
+ return false;
27
  }
28
 
29
  // Bot filter, by Justin_K.
41
  * @param array $bots An array of bot user agents.
42
  */
43
  $bots = apply_filters( 'relevanssi_bots_to_not_log', $bots );
44
+ foreach ( array_values( $bots ) as $lookfor ) {
45
  if ( false !== stristr( $user_agent, $lookfor ) ) {
46
+ return false;
47
  }
48
  }
49
  }
59
  $user = apply_filters( 'relevanssi_log_get_user', wp_get_current_user() );
60
  if ( 0 !== $user->ID && get_option( 'relevanssi_omit_from_logs' ) ) {
61
  $omit = explode( ',', get_option( 'relevanssi_omit_from_logs' ) );
62
+ $omit = array_map( 'trim', $omit );
63
  if ( in_array( strval( $user->ID ), $omit, true ) ) {
64
+ return false;
65
  }
66
  if ( in_array( $user->user_login, $omit, true ) ) {
67
+ return false;
68
  }
69
  }
70
 
109
  $ip
110
  )
111
  );
112
+ return true;
113
  }
114
+ return false;
115
  }
116
 
117
  /**
121
  *
122
  * @global object $wpdb The WordPress database interface.
123
  * @global array $relevanssi_variables The global Relevanssi variables, used for database table names.
124
+ *
125
+ * @return int|bool Number of rows deleted, or false on error.
126
  */
127
  function relevanssi_trim_logs() {
128
  global $wpdb, $relevanssi_variables;
129
  $interval = intval( get_option( 'relevanssi_trim_logs' ) );
130
+ return $wpdb->query(
131
  $wpdb->prepare(
132
  'DELETE FROM ' . $relevanssi_variables['log_table'] . ' WHERE time < TIMESTAMP(DATE_SUB(NOW(), INTERVAL %d DAY))', // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.PreparedSQL.InterpolatedNotPrepared
133
  $interval
175
 
176
  $item_id = "relevanssi_logged_search-{$id}";
177
  $group_id = 'relevanssi_logged_searches';
178
+ $group_label = __( 'Logged searches', 'relevanssi' );
179
  $data = array(
180
  array(
181
  'name' => __( 'Time', 'relevanssi' ),
lib/search.php CHANGED
@@ -903,7 +903,7 @@ function relevanssi_do_query( &$query ) {
903
  $query->query_vars['posts_per_page'] = -1;
904
  }
905
  if ( -1 === $query->query_vars['posts_per_page'] ) {
906
- $query->max_num_pages = $hits_count;
907
  } else {
908
  $query->max_num_pages = ceil( $hits_count / $query->query_vars['posts_per_page'] );
909
  }
@@ -1109,10 +1109,12 @@ function relevanssi_generate_term_where( $term, $force_fuzzy = false, $no_terms
1109
  * hook that returns '(relevanssi.term LIKE '%#term#%')'.
1110
  *
1111
  * @param string The partial matching query.
 
1112
  */
1113
  $fuzzy_query = apply_filters(
1114
  'relevanssi_fuzzy_query',
1115
- "(relevanssi.term LIKE '#term#%' OR relevanssi.term_reverse LIKE CONCAT(REVERSE('#term#'), '%')) "
 
1116
  );
1117
  $basic_query = " relevanssi.term = '#term#' ";
1118
 
@@ -1154,8 +1156,9 @@ function relevanssi_generate_term_where( $term, $force_fuzzy = false, $no_terms
1154
  * Filters the term WHERE condition for the Relevanssi MySQL query.
1155
  *
1156
  * @param string $term_where The WHERE condition for the terms.
 
1157
  */
1158
- return apply_filters( 'relevanssi_term_where', $term_where );
1159
  }
1160
 
1161
  /**
@@ -1340,108 +1343,8 @@ function relevanssi_compile_search_args( $query, $q ) {
1340
  $parent_query = array( 'parent not in' => $query->query_vars['post_parent__not_in'] );
1341
  }
1342
 
1343
- $meta_query = array();
1344
- if ( ! empty( $query->query_vars['meta_query'] ) ) {
1345
- $meta_query = $query->query_vars['meta_query'];
1346
- }
1347
-
1348
- if ( isset( $query->query_vars['customfield_key'] ) ) {
1349
- $build_meta_query = array();
1350
-
1351
- // Use meta key.
1352
- $build_meta_query['key'] = $query->query_vars['customfield_key'];
1353
-
1354
- /**
1355
- * Check the value is not empty for ordering purpose,
1356
- * set it or not for the current meta query.
1357
- */
1358
- if ( ! empty( $query->query_vars['customfield_value'] ) ) {
1359
- $build_meta_query['value'] = $query->query_vars['customfield_value'];
1360
- }
1361
-
1362
- // Set the compare.
1363
- $build_meta_query['compare'] = '=';
1364
- $meta_query[] = $build_meta_query;
1365
- }
1366
-
1367
- if ( ! empty( $query->query_vars['meta_key'] ) || ! empty( $query->query_vars['meta_value'] ) || ! empty( $query->query_vars['meta_value_num'] ) ) {
1368
- $build_meta_query = array();
1369
-
1370
- // Use meta key.
1371
- $build_meta_query['key'] = $query->query_vars['meta_key'];
1372
-
1373
- $value = null;
1374
- if ( ! empty( $query->query_vars['meta_value'] ) ) {
1375
- $value = $query->query_vars['meta_value'];
1376
- } elseif ( ! empty( $query->query_vars['meta_value_num'] ) ) {
1377
- $value = $query->query_vars['meta_value_num'];
1378
- }
1379
-
1380
- /**
1381
- * Check the meta value, as it could be not set for ordering purpose.
1382
- * Set it or not for the current meta query.
1383
- */
1384
- if ( ! empty( $value ) ) {
1385
- $build_meta_query['value'] = $value;
1386
- }
1387
-
1388
- // Set meta compare.
1389
- $build_meta_query['compare'] = '=';
1390
- if ( ! empty( $query->query_vars['meta_compare'] ) ) {
1391
- $build_meta_query['compare'] = $query->query_vars['meta_compare'];
1392
- }
1393
-
1394
- $meta_query[] = $build_meta_query;
1395
- }
1396
-
1397
- $date_query = false;
1398
- if ( ! empty( $query->date_query ) ) {
1399
- if ( is_object( $query->date_query ) && 'WP_Date_Query' === get_class( $query->date_query ) ) {
1400
- $date_query = $query->date_query;
1401
- } else {
1402
- $date_query = new WP_Date_Query( $query->date_query );
1403
- }
1404
- } elseif ( ! empty( $query->query_vars['date_query'] ) ) {
1405
- // The official date query is in $query->date_query, but this allows
1406
- // users to set the date query from query variables.
1407
- $date_query = new WP_Date_Query( $query->query_vars['date_query'] );
1408
- }
1409
-
1410
- if ( ! $date_query ) {
1411
- $date_query = array();
1412
- if ( ! empty( $query->query_vars['year'] ) ) {
1413
- $date_query['year'] = intval( $query->query_vars['year'] );
1414
- }
1415
- if ( ! empty( $query->query_vars['monthnum'] ) ) {
1416
- $date_query['month'] = intval( $query->query_vars['monthnum'] );
1417
- }
1418
- if ( ! empty( $query->query_vars['w'] ) ) {
1419
- $date_query['week'] = intval( $query->query_vars['w'] );
1420
- }
1421
- if ( ! empty( $query->query_vars['day'] ) ) {
1422
- $date_query['day'] = intval( $query->query_vars['day'] );
1423
- }
1424
- if ( ! empty( $query->query_vars['hour'] ) ) {
1425
- $date_query['hour'] = intval( $query->query_vars['hour'] );
1426
- }
1427
- if ( ! empty( $query->query_vars['minute'] ) ) {
1428
- $date_query['minute'] = intval( $query->query_vars['minute'] );
1429
- }
1430
- if ( ! empty( $query->query_vars['second'] ) ) {
1431
- $date_query['second'] = intval( $query->query_vars['second'] );
1432
- }
1433
- if ( ! empty( $query->query_vars['m'] ) ) {
1434
- if ( 6 === strlen( $query->query_vars['m'] ) ) {
1435
- $date_query['year'] = intval( substr( $query->query_vars['m'], 0, 4 ) );
1436
- $date_query['month'] = intval( substr( $query->query_vars['m'], -2, 2 ) );
1437
- }
1438
- }
1439
- if ( ! empty( $date_query ) ) {
1440
- $date_query = new WP_Date_Query( $date_query );
1441
- } else {
1442
- $date_query = false;
1443
- }
1444
- }
1445
 
1446
  $post_type = false;
1447
  if ( isset( $query->query_vars['post_type'] ) && 'any' !== $query->query_vars['post_type'] ) {
@@ -1551,3 +1454,135 @@ function relevanssi_compile_search_args( $query, $q ) {
1551
 
1552
  return $search_params;
1553
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
903
  $query->query_vars['posts_per_page'] = -1;
904
  }
905
  if ( -1 === $query->query_vars['posts_per_page'] ) {
906
+ $query->max_num_pages = 1;
907
  } else {
908
  $query->max_num_pages = ceil( $hits_count / $query->query_vars['posts_per_page'] );
909
  }
1109
  * hook that returns '(relevanssi.term LIKE '%#term#%')'.
1110
  *
1111
  * @param string The partial matching query.
1112
+ * @param string $term The search term.
1113
  */
1114
  $fuzzy_query = apply_filters(
1115
  'relevanssi_fuzzy_query',
1116
+ "(relevanssi.term LIKE '#term#%' OR relevanssi.term_reverse LIKE CONCAT(REVERSE('#term#'), '%')) ",
1117
+ $term
1118
  );
1119
  $basic_query = " relevanssi.term = '#term#' ";
1120
 
1156
  * Filters the term WHERE condition for the Relevanssi MySQL query.
1157
  *
1158
  * @param string $term_where The WHERE condition for the terms.
1159
+ * @param string $term The search term.
1160
  */
1161
+ return apply_filters( 'relevanssi_term_where', $term_where, $term );
1162
  }
1163
 
1164
  /**
1343
  $parent_query = array( 'parent not in' => $query->query_vars['post_parent__not_in'] );
1344
  }
1345
 
1346
+ $meta_query = relevanssi_meta_query_from_query_vars( $query );
1347
+ $date_query = relevanssi_wp_date_query_from_query_vars( $query );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1348
 
1349
  $post_type = false;
1350
  if ( isset( $query->query_vars['post_type'] ) && 'any' !== $query->query_vars['post_type'] ) {
1454
 
1455
  return $search_params;
1456
  }
1457
+
1458
+ /**
1459
+ * Generates a WP_Date_Query from the query date variables.
1460
+ *
1461
+ * First checks $query->date_query, if that doesn't exist then looks at the
1462
+ * other date parameters to construct a date query.
1463
+ *
1464
+ * @param WP_Query $query The query object.
1465
+ *
1466
+ * @return WP_Date_Query|boolean The date query object or false, if no date
1467
+ * parameters can be parsed.
1468
+ */
1469
+ function relevanssi_wp_date_query_from_query_vars( $query ) {
1470
+ $date_query = false;
1471
+ if ( ! empty( $query->date_query ) ) {
1472
+ if ( is_object( $query->date_query ) && 'WP_Date_Query' === get_class( $query->date_query ) ) {
1473
+ $date_query = $query->date_query;
1474
+ } else {
1475
+ $date_query = new WP_Date_Query( $query->date_query );
1476
+ }
1477
+ } elseif ( ! empty( $query->query_vars['date_query'] ) ) {
1478
+ // The official date query is in $query->date_query, but this allows
1479
+ // users to set the date query from query variables.
1480
+ $date_query = new WP_Date_Query( $query->query_vars['date_query'] );
1481
+ }
1482
+
1483
+ if ( ! $date_query ) {
1484
+ $date_query = array();
1485
+ if ( ! empty( $query->query_vars['year'] ) ) {
1486
+ $date_query['year'] = intval( $query->query_vars['year'] );
1487
+ }
1488
+ if ( ! empty( $query->query_vars['monthnum'] ) ) {
1489
+ $date_query['month'] = intval( $query->query_vars['monthnum'] );
1490
+ }
1491
+ if ( ! empty( $query->query_vars['w'] ) ) {
1492
+ $date_query['week'] = intval( $query->query_vars['w'] );
1493
+ }
1494
+ if ( ! empty( $query->query_vars['day'] ) ) {
1495
+ $date_query['day'] = intval( $query->query_vars['day'] );
1496
+ }
1497
+ if ( ! empty( $query->query_vars['hour'] ) ) {
1498
+ $date_query['hour'] = intval( $query->query_vars['hour'] );
1499
+ }
1500
+ if ( ! empty( $query->query_vars['minute'] ) ) {
1501
+ $date_query['minute'] = intval( $query->query_vars['minute'] );
1502
+ }
1503
+ if ( ! empty( $query->query_vars['second'] ) ) {
1504
+ $date_query['second'] = intval( $query->query_vars['second'] );
1505
+ }
1506
+ if ( ! empty( $query->query_vars['m'] ) ) {
1507
+ if ( 6 === strlen( $query->query_vars['m'] ) ) {
1508
+ $date_query['year'] = intval( substr( $query->query_vars['m'], 0, 4 ) );
1509
+ $date_query['month'] = intval( substr( $query->query_vars['m'], -2, 2 ) );
1510
+ }
1511
+ }
1512
+ if ( ! empty( $date_query ) ) {
1513
+ $date_query = new WP_Date_Query( $date_query );
1514
+ } else {
1515
+ $date_query = false;
1516
+ }
1517
+ }
1518
+ return $date_query;
1519
+ }
1520
+
1521
+ /**
1522
+ * Generates a meta_query array from the query meta variables.
1523
+ *
1524
+ * First checks $query->meta_query, if that doesn't exist then looks at the
1525
+ * other meta query and custom field parameters to construct a meta query.
1526
+ *
1527
+ * @param WP_Query $query The query object.
1528
+ *
1529
+ * @return array|boolean The meta query object or false, if no meta query
1530
+ * parameters can be parsed.
1531
+ */
1532
+
1533
+ function relevanssi_meta_query_from_query_vars( $query ) {
1534
+ $meta_query = false;
1535
+ if ( ! empty( $query->query_vars['meta_query'] ) ) {
1536
+ $meta_query = $query->query_vars['meta_query'];
1537
+ }
1538
+
1539
+ if ( isset( $query->query_vars['customfield_key'] ) ) {
1540
+ $build_meta_query = array();
1541
+
1542
+ // Use meta key.
1543
+ $build_meta_query['key'] = $query->query_vars['customfield_key'];
1544
+
1545
+ /**
1546
+ * Check the value is not empty for ordering purpose,
1547
+ * set it or not for the current meta query.
1548
+ */
1549
+ if ( ! empty( $query->query_vars['customfield_value'] ) ) {
1550
+ $build_meta_query['value'] = $query->query_vars['customfield_value'];
1551
+ }
1552
+
1553
+ // Set the compare.
1554
+ $build_meta_query['compare'] = '=';
1555
+ $meta_query[] = $build_meta_query;
1556
+ }
1557
+
1558
+ if ( ! empty( $query->query_vars['meta_key'] ) || ! empty( $query->query_vars['meta_value'] ) || ! empty( $query->query_vars['meta_value_num'] ) ) {
1559
+ $build_meta_query = array();
1560
+
1561
+ // Use meta key.
1562
+ $build_meta_query['key'] = $query->query_vars['meta_key'];
1563
+
1564
+ $value = null;
1565
+ if ( ! empty( $query->query_vars['meta_value'] ) ) {
1566
+ $value = $query->query_vars['meta_value'];
1567
+ } elseif ( ! empty( $query->query_vars['meta_value_num'] ) ) {
1568
+ $value = $query->query_vars['meta_value_num'];
1569
+ }
1570
+
1571
+ /**
1572
+ * Check the meta value, as it could be not set for ordering purpose.
1573
+ * Set it or not for the current meta query.
1574
+ */
1575
+ if ( ! empty( $value ) ) {
1576
+ $build_meta_query['value'] = $value;
1577
+ }
1578
+
1579
+ // Set meta compare.
1580
+ $build_meta_query['compare'] = '=';
1581
+ if ( ! empty( $query->query_vars['meta_compare'] ) ) {
1582
+ $build_meta_query['compare'] = $query->query_vars['meta_compare'];
1583
+ }
1584
+
1585
+ $meta_query[] = $build_meta_query;
1586
+ }
1587
+ return $meta_query;
1588
+ }
lib/shortcodes.php CHANGED
@@ -15,8 +15,8 @@ add_shortcode( 'searchform', 'relevanssi_search_form' );
15
  /**
16
  * Creates a link to search results.
17
  *
18
- * Using this is generally not a brilliant idea, actually. Google doesn't like if you
19
- * create links to internal search results.
20
  *
21
  * Usage: [search term='tomato']tomatoes[/search] would create a link like this:
22
  * <a href="/?s=tomato">tomatoes</a>
@@ -25,8 +25,8 @@ add_shortcode( 'searchform', 'relevanssi_search_form' );
25
  *
26
  * @global object $wpdb The WordPress database interface.
27
  *
28
- * @param array $atts The shortcode attributes. If 'term' is set, will use it as
29
- * the search term, otherwise the content word is used as the term.
30
  * @param string $content The content inside the shortcode tags.
31
  *
32
  * @return string A link to search results.
@@ -112,15 +112,12 @@ function relevanssi_search_form( $atts ) {
112
  $additional_fields = array();
113
  foreach ( $atts as $key => $value ) {
114
  if ( 'dropdown' === $key ) {
115
- switch ( $value ) {
116
- case 'category':
117
- $name = 'cat';
118
- break;
119
- case 'post_tag':
120
- $name = 'tag';
121
- break;
122
- default:
123
- $name = $value;
124
  }
125
  $args = array(
126
  'taxonomy' => $value,
15
  /**
16
  * Creates a link to search results.
17
  *
18
+ * Using this is generally not a brilliant idea, actually. Google doesn't like
19
+ * it if you create links to internal search results.
20
  *
21
  * Usage: [search term='tomato']tomatoes[/search] would create a link like this:
22
  * <a href="/?s=tomato">tomatoes</a>
25
  *
26
  * @global object $wpdb The WordPress database interface.
27
  *
28
+ * @param array $atts The shortcode attributes. If 'term' is set, will use
29
+ * it as the search term, otherwise the content word is used as the term.
30
  * @param string $content The content inside the shortcode tags.
31
  *
32
  * @return string A link to search results.
112
  $additional_fields = array();
113
  foreach ( $atts as $key => $value ) {
114
  if ( 'dropdown' === $key ) {
115
+ $name = $value;
116
+ if ( 'category' === $value ) {
117
+ $name = 'cat';
118
+ }
119
+ if ( 'post_tag' === $value ) {
120
+ $name = 'tag';
 
 
 
121
  }
122
  $args = array(
123
  'taxonomy' => $value,
lib/sorting.php CHANGED
@@ -172,7 +172,6 @@ function relevanssi_get_compare_values( $key, $item_1, $item_2 ) {
172
  $key = $meta_row['key'];
173
  }
174
  }
175
-
176
  if ( empty( $key ) ) {
177
  // The key is not set.
178
  return array( '', '' );
@@ -313,15 +312,9 @@ function relevanssi_filter_compare( $key1, $key2 ) {
313
 
314
  // Set the default values so that if the key is not found in the array, it's last.
315
  $max_key = max( $order );
316
- $val_1 = $max_key + 1;
317
- $val_2 = $max_key + 1;
318
 
319
- if ( isset( $order[ $key1 ] ) ) {
320
- $val_1 = $order[ $key1 ];
321
- }
322
- if ( isset( $order[ $key2 ] ) ) {
323
- $val_2 = $order[ $key2 ];
324
- }
325
 
326
  return $val_1 - $val_2;
327
  }
172
  $key = $meta_row['key'];
173
  }
174
  }
 
175
  if ( empty( $key ) ) {
176
  // The key is not set.
177
  return array( '', '' );
312
 
313
  // Set the default values so that if the key is not found in the array, it's last.
314
  $max_key = max( $order );
 
 
315
 
316
+ $val_1 = isset( $order[ $key1 ] ) ? $order[ $key1 ] : $max_key + 1;
317
+ $val_2 = isset( $order[ $key2 ] ) ? $order[ $key2 ] : $max_key + 1;
 
 
 
 
318
 
319
  return $val_1 - $val_2;
320
  }
lib/tabs/indexing-tab.php CHANGED
@@ -141,8 +141,8 @@ function relevanssi_indexing_tab() {
141
  </p>
142
  <p><?php echo esc_html( $terms_count ); ?> <?php echo esc_html( _n( 'term in the index.', 'terms in the index.', $terms_count, 'relevanssi' ) ); ?><br />
143
  <?php echo esc_html( $lowest_doc ); ?> <?php esc_html_e( 'is the lowest post ID indexed.', 'relevanssi' ); ?></p>
144
- <?php /** Translators: %1$s opens the a tag, %2$s closes it. */ ?>
145
- <p class="description">(<?php printf( esc_html__( 'These values may be inaccurate. If you need exact values, %1$supdate the counts%2$s' ), '<a href="' . esc_attr( $update_url ) . '">', '</a>' ); ?>.)</p>
146
  </td>
147
  </tr>
148
  </table>
141
  </p>
142
  <p><?php echo esc_html( $terms_count ); ?> <?php echo esc_html( _n( 'term in the index.', 'terms in the index.', $terms_count, 'relevanssi' ) ); ?><br />
143
  <?php echo esc_html( $lowest_doc ); ?> <?php esc_html_e( 'is the lowest post ID indexed.', 'relevanssi' ); ?></p>
144
+ <?php /* Translators: %1$s opens the a tag, %2$s closes it. */ ?>
145
+ <p class="description">(<?php printf( esc_html__( 'These values may be inaccurate. If you need exact values, %1$supdate the counts%2$s', 'relevanssi' ), '<a href="' . esc_attr( $update_url ) . '">', '</a>' ); ?>.)</p>
146
  </td>
147
  </tr>
148
  </table>
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: msaari
3
  Donate link: https://www.relevanssi.com/buy-premium/
4
  Tags: search, relevance, better search, product search, woocommerce search
5
  Requires at least: 4.9
6
- Tested up to: 5.5
7
  Requires PHP: 7.0
8
- Stable tag: 4.8.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -133,6 +133,12 @@ Each document database is full of useless words. All the little words that appea
133
  * John Calahan for extensive 4.0 beta testing.
134
 
135
  == Changelog ==
 
 
 
 
 
 
136
  = 4.8.2 =
137
  * New feature: New filter hook `relevanssi_term_where` lets you filter the term WHERE conditional for the search query.
138
  * Minor fix: Doing the document count updates asynchronously caused problems in some cases (eg. importing posts). Now the document count is only updated after a full indexing and once per week.
@@ -180,6 +186,9 @@ Each document database is full of useless words. All the little words that appea
180
  * Minor fix: User Access Manager showed drafts in search results for all users. This is now fixed.
181
 
182
  == Upgrade notice ==
 
 
 
183
  = 4.8.2 =
184
  * Performance and phrase search improvements.
185
 
3
  Donate link: https://www.relevanssi.com/buy-premium/
4
  Tags: search, relevance, better search, product search, woocommerce search
5
  Requires at least: 4.9
6
+ Tested up to: 5.5.1
7
  Requires PHP: 7.0
8
+ Stable tag: 4.8.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
133
  * John Calahan for extensive 4.0 beta testing.
134
 
135
  == Changelog ==
136
+ = 4.8.3 =
137
+ * New feature: Both `relevanssi_fuzzy_query` and `relevanssi_term_where` now get the current search term as a parameter.
138
+ * Minor fix: Relevanssi database tables don't have PRIMARY keys, only UNIQUE keys. In case this is a problem (for example on Digital Ocean servers), deactivate and activate Relevanssi to fix the problem.
139
+ * Minor fix: When `posts_per_page` was set to -1, the `max_num_pages` was incorrectly set to the number of posts found. It should, of course, be 1.
140
+ * Minor fix: Excluding from logs didn't work if user IDs had spaces between them ('user_a, user_b'). This is now fixed for good, the earlier fix didn't work.
141
+
142
  = 4.8.2 =
143
  * New feature: New filter hook `relevanssi_term_where` lets you filter the term WHERE conditional for the search query.
144
  * Minor fix: Doing the document count updates asynchronously caused problems in some cases (eg. importing posts). Now the document count is only updated after a full indexing and once per week.
186
  * Minor fix: User Access Manager showed drafts in search results for all users. This is now fixed.
187
 
188
  == Upgrade notice ==
189
+ = 4.8.3 =
190
+ * Small bug fixes and database improvements.
191
+
192
  = 4.8.2 =
193
  * Performance and phrase search improvements.
194
 
relevanssi.php CHANGED
@@ -13,7 +13,7 @@
13
  * Plugin Name: Relevanssi
14
  * Plugin URI: https://www.relevanssi.com/
15
  * Description: This plugin replaces WordPress search with a relevance-sorting search.
16
- * Version: 4.8.2
17
  * Author: Mikko Saari
18
  * Author URI: http://www.mikkosaari.fi/
19
  * Text Domain: relevanssi
@@ -67,7 +67,7 @@ $relevanssi_variables['database_version'] = 5;
67
  $relevanssi_variables['file'] = __FILE__;
68
  $relevanssi_variables['plugin_dir'] = plugin_dir_path( __FILE__ );
69
  $relevanssi_variables['plugin_basename'] = plugin_basename( __FILE__ );
70
- $relevanssi_variables['plugin_version'] = '4.8.2';
71
 
72
  require_once 'lib/admin-ajax.php';
73
  require_once 'lib/common.php';
13
  * Plugin Name: Relevanssi
14
  * Plugin URI: https://www.relevanssi.com/
15
  * Description: This plugin replaces WordPress search with a relevance-sorting search.
16
+ * Version: 4.8.3
17
  * Author: Mikko Saari
18
  * Author URI: http://www.mikkosaari.fi/
19
  * Text Domain: relevanssi
67
  $relevanssi_variables['file'] = __FILE__;
68
  $relevanssi_variables['plugin_dir'] = plugin_dir_path( __FILE__ );
69
  $relevanssi_variables['plugin_basename'] = plugin_basename( __FILE__ );
70
+ $relevanssi_variables['plugin_version'] = '4.8.3';
71
 
72
  require_once 'lib/admin-ajax.php';
73
  require_once 'lib/common.php';