Relevanssi – A Better Search - Version 3.3.8

Version Description

  • Fixed a bug that caused the results to change depending of the order of words in a multi-word search query.
  • Added product_categories and recent_products from WooCommerce to the list of blocked shortcodes.
  • There are improvements in excerpt-building and highlighting, especially when fuzzy search is enabled.
  • Fixed a possible (if quite unlikely) XSS vulnerability.
  • Improved search performance (thanks to MikeNGarrett).
  • 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.
Download this release

Release Info

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

Code changes from version 3.2 to 3.3.8

lib/common.php CHANGED
@@ -2,8 +2,8 @@
2
 
3
  // thanks to rvencu
4
  function relevanssi_wpml_filter($data) {
5
- $use_filter = get_option('relevanssi_wpml_only_current');
6
- if ('on' == $use_filter) {
7
  //save current blog language
8
  $lang = get_bloginfo('language');
9
  $filtered_hits = array();
@@ -12,14 +12,27 @@ function relevanssi_wpml_filter($data) {
12
  switch_to_blog($hit->blog_id);
13
  }
14
  global $sitepress;
15
- if (function_exists('icl_object_id') && $sitepress->is_translated_post_type($hit->post_type)) {
16
- if ($hit->ID == icl_object_id($hit->ID, $hit->post_type,false,ICL_LANGUAGE_CODE))
17
- $filtered_hits[] = $hit;
 
 
 
 
 
18
  }
19
  elseif (function_exists('icl_object_id') && function_exists('pll_is_translated_post_type')) {
20
  if (pll_is_translated_post_type($hit->post_type)) {
21
- if ($hit->ID == icl_object_id($hit->ID, $hit->post_type,false,ICL_LANGUAGE_CODE))
22
- $filtered_hits[] = $hit;
 
 
 
 
 
 
 
 
23
  }
24
  }
25
 
@@ -125,11 +138,8 @@ function relevanssi_update_log($query, $hits) {
125
  }
126
  }
127
 
128
- if (get_option('relevanssi_log_queries_with_ip') == "on") {
129
- $q = $wpdb->prepare("INSERT INTO " . $relevanssi_variables['log_table'] . " (query, hits, user_id, ip) VALUES (%s, %d, %d, %s)", $query, intval($hits), $user->ID, $_SERVER['REMOTE_ADDR']);
130
- } else {
131
- $q = $wpdb->prepare("INSERT INTO " . $relevanssi_variables['log_table'] . " (query, hits, user_id, ip) VALUES (%s, %d, %d, '')", $query, intval($hits), $user->ID, $_SERVER['REMOTE_ADDR']);
132
- }
133
  $wpdb->query($q);
134
  }
135
 
@@ -162,6 +172,7 @@ function relevanssi_default_post_ok($post_ok, $doc) {
162
  // Basic WordPress version
163
  $type = relevanssi_get_post_type($doc);
164
  $cap = 'read_private_' . $type . 's';
 
165
  if (current_user_can($cap)) {
166
  $post_ok = true;
167
  }
@@ -268,103 +279,60 @@ function relevanssi_extract_phrases($q) {
268
  else
269
  $phrase = substr($q, $start + 1, $end - $start - 1);
270
 
271
- $phrases[] = $phrase;
 
 
272
  $pos = $end;
273
  }
274
  return $phrases;
275
  }
276
 
277
- /* If no phrase hits are made, this function returns false
278
- * If phrase matches are found, the function presents a comma-separated list of doc id's.
279
- * If phrase matches are found, but no matching documents, function returns -1.
280
  */
281
  function relevanssi_recognize_phrases($q) {
282
  global $wpdb;
283
 
284
  $phrases = relevanssi_extract_phrases($q);
285
 
 
286
  if (count($phrases) > 0) {
287
- $phrase_matches = array();
288
  foreach ($phrases as $phrase) {
 
289
  $phrase = esc_sql($phrase);
290
  "on" == get_option("relevanssi_index_excerpt") ? $excerpt = " OR post_excerpt LIKE '%$phrase%'" : $excerpt = "";
291
- $query = "SELECT ID FROM $wpdb->posts
292
  WHERE (post_content LIKE '%$phrase%' OR post_title LIKE '%$phrase%' $excerpt)
293
- AND post_status IN ('publish', 'draft', 'private', 'pending', 'future', 'inherit')";
294
 
295
- $docs = $wpdb->get_results($query);
296
-
297
- if (is_array($docs)) {
298
- foreach ($docs as $doc) {
299
- if (!isset($phrase_matches[$phrase])) {
300
- $phrase_matches[$phrase] = array();
301
- }
302
- $phrase_matches[$phrase][] = $doc->ID;
303
- }
304
- }
305
 
306
- $query = "SELECT ID FROM $wpdb->posts as p, $wpdb->term_relationships as r, $wpdb->term_taxonomy as s, $wpdb->terms as t
307
  WHERE r.term_taxonomy_id = s.term_taxonomy_id AND s.term_id = t.term_id AND p.ID = r.object_id
308
- AND t.name LIKE '%$phrase%' AND p.post_status IN ('publish', 'draft', 'private', 'pending', 'future', 'inherit')";
309
-
310
- $docs = $wpdb->get_results($query);
311
- if (is_array($docs)) {
312
- foreach ($docs as $doc) {
313
- if (!isset($phrase_matches[$phrase])) {
314
- $phrase_matches[$phrase] = array();
315
- }
316
- $phrase_matches[$phrase][] = $doc->ID;
317
- }
318
- }
319
 
320
- $query = "SELECT ID
 
 
321
  FROM $wpdb->posts AS p, $wpdb->postmeta AS m
322
  WHERE p.ID = m.post_id
323
  AND m.meta_value LIKE '%$phrase%'
324
- AND p.post_status IN ('publish', 'draft', 'private', 'pending', 'future', 'inherit')";
325
 
326
- $docs = $wpdb->get_results($query);
327
- if (is_array($docs)) {
328
- foreach ($docs as $doc) {
329
- if (!isset($phrase_matches[$phrase])) {
330
- $phrase_matches[$phrase] = array();
331
- }
332
- $phrase_matches[$phrase][] = $doc->ID;
333
- }
334
- }
335
- }
336
-
337
- if (count($phrase_matches) < 1) {
338
- $phrases = "-1";
339
- }
340
- else {
341
- // Complicated mess, but necessary...
342
- $i = 0;
343
- $phms = array();
344
- foreach ($phrase_matches as $phm) {
345
- $phms[$i++] = $phm;
346
- }
347
-
348
- $phrases = $phms[0];
349
- if ($i > 1) {
350
- for ($i = 1; $i < count($phms); $i++) {
351
- $phrases = array_intersect($phrases, $phms[$i]);
352
- }
353
- }
354
-
355
- if (count($phrases) < 1) {
356
- $phrases = "-1";
357
- }
358
- else {
359
- $phrases = implode(",", $phrases);
360
- }
361
  }
362
  }
363
  else {
364
- $phrases = false;
365
  }
366
 
367
- return $phrases;
 
 
368
  }
369
 
370
  // found here: http://forums.digitalpoint.com/showthread.php?t=1106745
@@ -422,6 +390,8 @@ function relevanssi_remove_punct($a) {
422
  $a = strip_tags($a);
423
  $a = stripslashes($a);
424
 
 
 
425
  $a = str_replace("·", '', $a);
426
  $a = str_replace("…", '', $a);
427
  $a = str_replace("€", '', $a);
@@ -463,13 +433,23 @@ function relevanssi_prevent_default_request( $request, $query ) {
463
  return $request;
464
  }
465
  }
466
- if (is_array($query->query_vars['post_type']) && in_array('forum', $query->query_vars['post_type'])) {
 
 
 
 
 
 
467
  // this is a BBPress search; do not meddle
468
  return $request;
469
  }
470
  $admin_search_ok = true;
471
  $admin_search_ok = apply_filters('relevanssi_admin_search_ok', $admin_search_ok, $query );
472
- if (!is_admin())
 
 
 
 
473
  $request = "SELECT * FROM $wpdb->posts WHERE 1=2";
474
  else if ('on' == get_option('relevanssi_admin_search') && $admin_search_ok )
475
  $request = "SELECT * FROM $wpdb->posts WHERE 1=2";
@@ -547,7 +527,7 @@ function relevanssi_get_post_status($id) {
547
  global $relevanssi_post_array;
548
 
549
  $type = substr($id, 0, 2);
550
- if ($type == 't_') {
551
  return 'publish';
552
  }
553
  if ($type == 'u_') {
@@ -648,4 +628,74 @@ function relevanssi_add_synonyms($q) {
648
  }
649
  return $q;
650
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
651
  ?>
2
 
3
  // thanks to rvencu
4
  function relevanssi_wpml_filter($data) {
5
+ $use_filter = get_option('relevanssi_wpml_only_current');
6
+ if ('on' == $use_filter) {
7
  //save current blog language
8
  $lang = get_bloginfo('language');
9
  $filtered_hits = array();
12
  switch_to_blog($hit->blog_id);
13
  }
14
  global $sitepress;
15
+
16
+ if (function_exists('icl_object_id') && !function_exists('pll_is_translated_post_type')) {
17
+ if ($sitepress->is_translated_post_type($hit->post_type)) {
18
+ if ($hit->ID == icl_object_id($hit->ID, $hit->post_type, false, ICL_LANGUAGE_CODE)) $filtered_hits[] = $hit;
19
+ }
20
+ else {
21
+ $filtered_hits[] = $hit;
22
+ }
23
  }
24
  elseif (function_exists('icl_object_id') && function_exists('pll_is_translated_post_type')) {
25
  if (pll_is_translated_post_type($hit->post_type)) {
26
+ global $polylang;
27
+ if ($polylang->model->get_post_language($hit->ID)->slug == ICL_LANGUAGE_CODE) {
28
+ $filtered_hits[] = $hit;
29
+ }
30
+ else if ($hit->ID == icl_object_id($hit->ID, $hit->post_type, false, ICL_LANGUAGE_CODE)) {
31
+ $filtered_hits[] = $hit;
32
+ }
33
+ }
34
+ else {
35
+ $filtered_hits[] = $hit;
36
  }
37
  }
38
 
138
  }
139
  }
140
 
141
+ get_option('relevanssi_log_queries_with_ip') == "on" ? $ip = $_SERVER['REMOTE_ADDR'] : $ip = '';
142
+ $q = $wpdb->prepare("INSERT INTO " . $relevanssi_variables['log_table'] . " (query, hits, user_id, ip, time) VALUES (%s, %d, %d, %s, NOW())", $query, intval($hits), $user->ID, $ip);
 
 
 
143
  $wpdb->query($q);
144
  }
145
 
172
  // Basic WordPress version
173
  $type = relevanssi_get_post_type($doc);
174
  $cap = 'read_private_' . $type . 's';
175
+ $cap = apply_filters('relevanssi_private_cap', $cap);
176
  if (current_user_can($cap)) {
177
  $post_ok = true;
178
  }
279
  else
280
  $phrase = substr($q, $start + 1, $end - $start - 1);
281
 
282
+ $phrase = trim($phrase);
283
+
284
+ if (!empty($phrase)) $phrases[] = $phrase;
285
  $pos = $end;
286
  }
287
  return $phrases;
288
  }
289
 
290
+ /* If no phrase hits are made, this function returns an empty string
291
+ * If phrase matches are found, the function returns MySQL queries
 
292
  */
293
  function relevanssi_recognize_phrases($q) {
294
  global $wpdb;
295
 
296
  $phrases = relevanssi_extract_phrases($q);
297
 
298
+ $all_queries = array();
299
  if (count($phrases) > 0) {
 
300
  foreach ($phrases as $phrase) {
301
+ $queries = array();
302
  $phrase = esc_sql($phrase);
303
  "on" == get_option("relevanssi_index_excerpt") ? $excerpt = " OR post_excerpt LIKE '%$phrase%'" : $excerpt = "";
304
+ $query = "(SELECT ID FROM $wpdb->posts
305
  WHERE (post_content LIKE '%$phrase%' OR post_title LIKE '%$phrase%' $excerpt)
306
+ AND post_status IN ('publish', 'draft', 'private', 'pending', 'future', 'inherit'))";
307
 
308
+ $queries[] = $query;
 
 
 
 
 
 
 
 
 
309
 
310
+ $query = "(SELECT ID FROM $wpdb->posts as p, $wpdb->term_relationships as r, $wpdb->term_taxonomy as s, $wpdb->terms as t
311
  WHERE r.term_taxonomy_id = s.term_taxonomy_id AND s.term_id = t.term_id AND p.ID = r.object_id
312
+ AND t.name LIKE '%$phrase%' AND p.post_status IN ('publish', 'draft', 'private', 'pending', 'future', 'inherit'))";
 
 
 
 
 
 
 
 
 
 
313
 
314
+ $queries[] = $query;
315
+
316
+ $query = "(SELECT ID
317
  FROM $wpdb->posts AS p, $wpdb->postmeta AS m
318
  WHERE p.ID = m.post_id
319
  AND m.meta_value LIKE '%$phrase%'
320
+ AND p.post_status IN ('publish', 'draft', 'private', 'pending', 'future', 'inherit'))";
321
 
322
+ $queries[] = $query;
323
+
324
+ $queries = implode(' OR relevanssi.doc IN ', $queries);
325
+ $queries = "AND (relevanssi.doc IN $queries)";
326
+ $all_queries[] = $queries;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
327
  }
328
  }
329
  else {
330
+ $phrases = "";
331
  }
332
 
333
+ $all_queries = implode(" ", $all_queries);
334
+
335
+ return $all_queries;
336
  }
337
 
338
  // found here: http://forums.digitalpoint.com/showthread.php?t=1106745
390
  $a = strip_tags($a);
391
  $a = stripslashes($a);
392
 
393
+ $a = str_replace('ß', 'ss', $a);
394
+
395
  $a = str_replace("·", '', $a);
396
  $a = str_replace("…", '', $a);
397
  $a = str_replace("€", '', $a);
433
  return $request;
434
  }
435
  }
436
+ $bbpress = false;
437
+ if ($query->query_vars['post_type'] == 'topic' || $query->query_vars['post_type'] == 'reply') $bbpress = true;
438
+ if (is_array($query->query_vars['post_type'])) {
439
+ if (in_array('topic', $query->query_vars['post_type'])) $bbpress = true;
440
+ if (in_array('reply', $query->query_vars['post_type'])) $bbpress = true;
441
+ }
442
+ if ($bbpress) {
443
  // this is a BBPress search; do not meddle
444
  return $request;
445
  }
446
  $admin_search_ok = true;
447
  $admin_search_ok = apply_filters('relevanssi_admin_search_ok', $admin_search_ok, $query );
448
+
449
+ $prevent = true;
450
+ $prevent = apply_filters('relevanssi_prevent_default_request', $prevent, $query );
451
+
452
+ if (!is_admin() && $prevent )
453
  $request = "SELECT * FROM $wpdb->posts WHERE 1=2";
454
  else if ('on' == get_option('relevanssi_admin_search') && $admin_search_ok )
455
  $request = "SELECT * FROM $wpdb->posts WHERE 1=2";
527
  global $relevanssi_post_array;
528
 
529
  $type = substr($id, 0, 2);
530
+ if ($type == '**') {
531
  return 'publish';
532
  }
533
  if ($type == 'u_') {
628
  }
629
  return $q;
630
  }
631
+
632
+ /* Helper function that does mb_stripos, falls back to mb_strpos and mb_strtoupper
633
+ * if that cannot be found, and falls back to just strpos if even that is not possible.
634
+ */
635
+ function relevanssi_stripos($content, $term, $offset) {
636
+ if (function_exists('mb_strlen')) {
637
+ if ($offset > mb_strlen($content)) return false;
638
+ }
639
+ else {
640
+ if ($offset > strlen($content)) return false;
641
+ }
642
+ if (function_exists('mb_stripos')) {
643
+ $pos = ("" == $content) ? false : mb_stripos($content, $term, $offset);
644
+ }
645
+ else if (function_exists('mb_strpos') && function_exists('mb_strtoupper') && function_exists('mb_substr')) {
646
+ $pos = mb_strpos(mb_strtoupper($content), mb_strtoupper($term), $offset);
647
+ }
648
+ else {
649
+ $pos = strpos(strtoupper($content), strtoupper($term), $offset);
650
+ }
651
+ return $pos;
652
+ }
653
+
654
+ /* Function to close tags in a bit of HTML code. Used to make sure no tags are left open
655
+ * in excerpts. This method is not foolproof, but it's good enough for now.
656
+ */
657
+ function relevanssi_close_tags($html) {
658
+ preg_match_all('#<(?!meta|img|br|hr|input\b)\b([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result);
659
+ $openedtags = $result[1];
660
+ preg_match_all('#</([a-z]+)>#iU', $html, $result);
661
+ $closedtags = $result[1];
662
+ $len_opened = count($openedtags);
663
+ if (count($closedtags) == $len_opened) {
664
+ return $html;
665
+ }
666
+ $openedtags = array_reverse($openedtags);
667
+ for ($i=0; $i < $len_opened; $i++) {
668
+ if (!in_array($openedtags[$i], $closedtags)) {
669
+ $html .= '</'.$openedtags[$i].'>';
670
+ } else {
671
+ unset($closedtags[array_search($openedtags[$i], $closedtags)]);
672
+ }
673
+ }
674
+ return $html;
675
+ }
676
+
677
+ /* Prints out post title with highlighting.
678
+ */
679
+ function relevanssi_the_title() {
680
+ global $post;
681
+ if (empty($post->post_highlighted_title)) $post->post_highlighted_title = $post->post_title;
682
+ echo $post->post_highlighted_title;
683
+ }
684
+
685
+ /* Returns the post title with highlighting.
686
+ */
687
+ function relevanssi_get_the_title($post_id) {
688
+ $post = get_post($post_id);
689
+ if (empty($post->post_highlighted_title)) $post->post_highlighted_title = $post->post_title;
690
+ return $post->post_highlighted_title;
691
+ }
692
+
693
+ function relevanssi_update_doc_count( $values, $post ) {
694
+ $D = get_option( 'relevanssi_doc_count');
695
+ $count = count($values);
696
+ if ($values && $count > 0) {
697
+ update_option( 'relevanssi_doc_count', $D + $count);
698
+ }
699
+ return $values;
700
+ }
701
  ?>
lib/excerpts-highlights.php CHANGED
@@ -19,7 +19,7 @@ function relevanssi_do_excerpt($t_post, $query) {
19
  $post = $t_post;
20
 
21
  $remove_stopwords = false;
22
- $terms = relevanssi_tokenize($query, $remove_stopwords, -1, false);
23
 
24
  // These shortcodes cause problems with Relevanssi excerpts
25
  remove_shortcode('layerslider');
@@ -35,21 +35,29 @@ function relevanssi_do_excerpt($t_post, $query) {
35
  $content = preg_replace("/\n\r|\r\n|\n|\r/", " ", $content);
36
  // $content = trim(preg_replace("/\s\s+/", " ", $content));
37
 
 
 
38
  $excerpt_data = relevanssi_create_excerpt($content, $terms, $query);
39
 
40
  if (get_option("relevanssi_index_comments") != 'none') {
41
  $comment_content = relevanssi_get_comments($post->ID);
42
- $comment_excerpts = relevanssi_create_excerpt($comment_content, $terms, $query);
43
- if ($comment_excerpts[1] > $excerpt_data[1]) {
44
- $excerpt_data = $comment_excerpts;
 
 
 
 
45
  }
46
  }
47
 
48
- if (get_option("relevanssi_index_excerpt") != 'none') {
49
  $excerpt_content = $post->post_excerpt;
50
- $excerpt_excerpts = relevanssi_create_excerpt($excerpt_content, $terms, $query);
51
- if ($excerpt_excerpts[1] > $excerpt_data[1]) {
52
- $excerpt_data = $excerpt_excerpts;
 
 
53
  }
54
  }
55
 
@@ -64,10 +72,13 @@ function relevanssi_do_excerpt($t_post, $query) {
64
  $highlight = get_option('relevanssi_highlight');
65
  if ("none" != $highlight) {
66
  if (!is_admin()) {
 
67
  $excerpt = relevanssi_highlight_terms($excerpt, $query);
68
  }
69
  }
70
 
 
 
71
  if (!$start && !empty($excerpt)) {
72
  $excerpt = $ellipsis . $excerpt;
73
  // do not add three dots to the beginning of the post
@@ -104,79 +115,92 @@ function relevanssi_create_excerpt($content, $terms, $query) {
104
  $non_phrase_terms = array();
105
  foreach ($phrases as $phrase) {
106
  $phrase_terms = array_keys(relevanssi_tokenize($phrase, $remove_stopwords = false));
107
- foreach ($terms as $term) {
108
  if (!in_array($term, $phrase_terms)) {
109
  $non_phrase_terms[] = $term;
110
  }
111
  }
 
112
  $terms = $non_phrase_terms;
113
- $terms[] = $phrase;
114
  }
115
 
116
  uksort($terms, 'relevanssi_strlen_sort');
117
 
118
- /*
119
- $highlight = get_option('relevanssi_highlight');
120
- if ("none" != $highlight) {
121
- if (!is_admin()) {
122
- $content = html_entity_decode($content, ENT_QUOTES, 'UTF-8');
123
- // html_entity_decode to avoid highlighting from breaking HTML entities
124
- }
125
- }
126
- */
127
-
128
  $start = false;
129
  if ("chars" == $type) {
130
- $term_hits = 0;
131
  foreach (array_keys($terms) as $term) {
132
- $term = " $term";
133
- if (function_exists('mb_stripos')) {
134
- $pos = ("" == $content) ? false : mb_stripos($content, $term);
135
- }
136
- else if (function_exists('mb_strpos') && function_exists('mb_strtoupper') && function_exists('mb_substr')) {
137
- $pos = mb_strpos($content, $term);
138
- if (false === $pos) {
139
- $titlecased = mb_strtoupper(mb_substr($term, 0, 1)) . mb_substr($term, 1);
140
- $pos = mb_strpos($content, $titlecased);
141
- if (false === $pos) {
142
- $pos = mb_strpos($content, mb_strtoupper($term));
143
- }
144
- }
145
- }
146
- else {
147
- $pos = strpos($content, $term);
148
- if (false === $pos) {
149
- $titlecased = strtoupper(substr($term, 0, 1)) . substr($term, 1);
150
- $pos = strpos($content, $titlecased);
151
- if (false === $pos) {
152
- $pos = strpos($content, strtoupper($term));
153
- }
154
  }
155
  }
 
 
 
 
 
 
 
 
 
 
 
156
 
157
- if (false !== $pos) {
158
- $term_hits++;
159
- if ($term_hits > $best_excerpt_term_hits) {
160
- $best_excerpt_term_hits = $term_hits;
161
- if ($pos + strlen($term) < $excerpt_length) {
162
- if (function_exists('mb_substr'))
163
- $excerpt = mb_substr($content, 0, $excerpt_length);
164
- else
165
- $excerpt = substr($content, 0, $excerpt_length);
166
- $start = true;
167
- }
168
- else {
169
- $half = floor($excerpt_length/2);
170
- $pos = $pos - $half;
171
- if (function_exists('mb_substr'))
172
- $excerpt = mb_substr($content, $pos, $excerpt_length);
173
- else
174
- $excerpt = substr($content, $pos, $excerpt_length);
175
- }
176
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  }
178
  }
179
 
 
 
 
180
  if ("" == $excerpt) {
181
  if (function_exists('mb_substr'))
182
  $excerpt = mb_substr($content, 0, $excerpt_length);
@@ -187,13 +211,14 @@ function relevanssi_create_excerpt($content, $terms, $query) {
187
  }
188
  else {
189
  $words = explode(' ', $content);
190
-
191
  $i = 0;
192
 
193
  while ($i < count($words)) {
194
  if ($i + $excerpt_length > count($words)) {
195
  $i = count($words) - $excerpt_length;
 
196
  }
 
197
  $excerpt_slice = array_slice($words, $i, $excerpt_length);
198
  $excerpt_slice = implode(' ', $excerpt_slice);
199
 
@@ -238,6 +263,7 @@ function relevanssi_create_excerpt($content, $terms, $query) {
238
  if (false !== $pos) {
239
  $term_hits++;
240
  if (0 == $i) $start = true;
 
241
  if ($term_hits > $best_excerpt_term_hits) {
242
  $best_excerpt_term_hits = $term_hits;
243
  $excerpt = $excerpt_slice;
@@ -255,7 +281,7 @@ function relevanssi_create_excerpt($content, $terms, $query) {
255
  $start = true;
256
  }
257
  }
258
-
259
  return array($excerpt, $best_excerpt_term_hits, $start);
260
  }
261
 
@@ -272,11 +298,13 @@ function relevanssi_highlight_in_docs($content) {
272
  if ( count( $args ) > 1 )
273
  parse_str( $args[1], $query );
274
 
275
- if (substr($referrer, 0, strlen($_SERVER['SERVER_NAME'])) == $_SERVER['SERVER_NAME']) {
276
  // Local search
277
  if (isset($query['s'])) {
278
  $q = relevanssi_add_synonyms($query['s']);
279
- $content = relevanssi_highlight_terms($content, $q);
 
 
280
  }
281
  }
282
  if (function_exists('relevanssi_nonlocal_highlighting')) {
@@ -362,13 +390,20 @@ function relevanssi_highlight_terms($excerpt, $query) {
362
 
363
  get_option('relevanssi_word_boundaries', 'on') == 'on' ? $word_boundaries = true : $word_boundaries = false;
364
  foreach ($terms as $term) {
365
- $pr_term = relevanssi_replace_punctuation(preg_quote($term, '/'));
366
-
 
 
 
 
367
  if ($word_boundaries) {
368
- $excerpt = preg_replace("/(\b$pr_term|$pr_term\b)(?!(^&+)?(;))/iu", $start_emp_token . '\\1' . $end_emp_token, $excerpt);
 
 
369
  }
370
  else {
371
  $excerpt = preg_replace("/($pr_term)(?!(^&+)?(;))/iu", $start_emp_token . '\\1' . $end_emp_token, $excerpt);
 
372
  }
373
 
374
  $preg_start = preg_quote($start_emp_token);
@@ -411,8 +446,9 @@ function relevanssi_highlight_terms($excerpt, $query) {
411
  return $excerpt;
412
  }
413
 
 
414
  function relevanssi_replace_punctuation($a) {
415
- $a = preg_replace('/[[:punct:]]+/u', '.+?', $a);
416
  return $a;
417
  }
418
 
19
  $post = $t_post;
20
 
21
  $remove_stopwords = false;
22
+ $terms = relevanssi_tokenize($query, $remove_stopwords, -1);
23
 
24
  // These shortcodes cause problems with Relevanssi excerpts
25
  remove_shortcode('layerslider');
35
  $content = preg_replace("/\n\r|\r\n|\n|\r/", " ", $content);
36
  // $content = trim(preg_replace("/\s\s+/", " ", $content));
37
 
38
+ $query = relevanssi_add_synonyms($query);
39
+
40
  $excerpt_data = relevanssi_create_excerpt($content, $terms, $query);
41
 
42
  if (get_option("relevanssi_index_comments") != 'none') {
43
  $comment_content = relevanssi_get_comments($post->ID);
44
+ $comment_content = preg_replace('/(<\/[^>]+?>)(<[^>\/][^>]*?>)/', '$1 $2', $comment_content); // add spaces between tags to avoid getting words stuck together
45
+ $comment_content = strip_tags($comment_content, get_option('relevanssi_excerpt_allowable_tags', '')); // this removes the tags, but leaves the content
46
+ if (!empty($comment_content)) {
47
+ $comment_excerpts = relevanssi_create_excerpt($comment_content, $terms, $query);
48
+ if ($comment_excerpts[1] > $excerpt_data[1]) {
49
+ $excerpt_data = $comment_excerpts;
50
+ }
51
  }
52
  }
53
 
54
+ if (get_option("relevanssi_index_excerpt") != 'off') {
55
  $excerpt_content = $post->post_excerpt;
56
+ if (!empty($excerpt_content)) {
57
+ $excerpt_excerpts = relevanssi_create_excerpt($excerpt_content, $terms, $query);
58
+ if ($excerpt_excerpts[1] > $excerpt_data[1]) {
59
+ $excerpt_data = $excerpt_excerpts;
60
+ }
61
  }
62
  }
63
 
72
  $highlight = get_option('relevanssi_highlight');
73
  if ("none" != $highlight) {
74
  if (!is_admin()) {
75
+ $query = relevanssi_add_synonyms($query);
76
  $excerpt = relevanssi_highlight_terms($excerpt, $query);
77
  }
78
  }
79
 
80
+ $excerpt = relevanssi_close_tags($excerpt);
81
+
82
  if (!$start && !empty($excerpt)) {
83
  $excerpt = $ellipsis . $excerpt;
84
  // do not add three dots to the beginning of the post
115
  $non_phrase_terms = array();
116
  foreach ($phrases as $phrase) {
117
  $phrase_terms = array_keys(relevanssi_tokenize($phrase, $remove_stopwords = false));
118
+ foreach (array_keys($terms) as $term) {
119
  if (!in_array($term, $phrase_terms)) {
120
  $non_phrase_terms[] = $term;
121
  }
122
  }
123
+
124
  $terms = $non_phrase_terms;
125
+ $terms[$phrase] = 1;
126
  }
127
 
128
  uksort($terms, 'relevanssi_strlen_sort');
129
 
 
 
 
 
 
 
 
 
 
 
130
  $start = false;
131
  if ("chars" == $type) {
132
+ $term_positions = array();
133
  foreach (array_keys($terms) as $term) {
134
+ $term = trim($term);
135
+ $term_key = $term;
136
+ get_option('relevanssi_fuzzy') != 'none' ? $term = "$term" : $term = " $term";
137
+
138
+ $pos = 0;
139
+ $n = 0;
140
+ while (false !== $pos) {
141
+ $pos = relevanssi_stripos($content, $term, $pos);
142
+ if (false !== $pos) {
143
+ $term_positions[$pos] = $term_key;
144
+ function_exists('mb_strlen') ? $pos = $pos + mb_strlen($term) : $pos = $pos + strlen(utf8_decode($term));
 
 
 
 
 
 
 
 
 
 
 
145
  }
146
  }
147
+ }
148
+ ksort($term_positions);
149
+ $positions = array_keys($term_positions);
150
+ $best_position = 0;
151
+ $best_position_hits = 0;
152
+ $quarter = floor($excerpt_length/4); // adjustment, so the excerpt doesn't start with the search term
153
+ for ($i = 0; $i < count($positions); $i++) {
154
+ $key = $positions[$i];
155
+ $orig_key = $key;
156
+ $key = $key - $quarter;
157
+ if ($key < 0) $key = 0;
158
 
159
+ $j = $i + 1;
160
+
161
+ $this_excerpt_terms = array();
162
+
163
+ if (isset($term_positions[$orig_key])) $this_excerpt_terms[$term_positions[$orig_key]] = true;
164
+
165
+ while (isset($positions[$j])) {
166
+ if (isset($positions[$j])) {
167
+ $next_key = $positions[$j];
168
+ }
169
+
170
+ if ($key + $excerpt_length > $next_key) {
171
+ $this_excerpt_terms[$term_positions[$next_key]] = true;
 
 
 
 
 
 
172
  }
173
+ else {
174
+ break; // farther than the excerpt length
175
+ }
176
+ $j++;
177
+ }
178
+
179
+ if (count($this_excerpt_terms) > $best_position_hits) {
180
+ $best_position_hits = count($this_excerpt_terms);
181
+ $best_position = $key;
182
+ }
183
+ }
184
+
185
+ if ($best_position + $excerpt_length < strlen($content)) {
186
+ if (function_exists('mb_substr'))
187
+ $excerpt = mb_substr($content, $best_position, $excerpt_length);
188
+ else
189
+ $excerpt = substr($content, $best_position, $excerpt_length);
190
+ }
191
+ else {
192
+ $fixed_position = strlen($content) - $excerpt_length;
193
+ if ($fixed_position > 0) {
194
+ if (function_exists('mb_substr'))
195
+ $excerpt = mb_substr($content, $fixed_position, $excerpt_length);
196
+ else
197
+ $excerpt = substr($content, $fixed_position, $excerpt_length);
198
  }
199
  }
200
 
201
+ if ($best_position == 0) $start = true;
202
+
203
+
204
  if ("" == $excerpt) {
205
  if (function_exists('mb_substr'))
206
  $excerpt = mb_substr($content, 0, $excerpt_length);
211
  }
212
  else {
213
  $words = explode(' ', $content);
 
214
  $i = 0;
215
 
216
  while ($i < count($words)) {
217
  if ($i + $excerpt_length > count($words)) {
218
  $i = count($words) - $excerpt_length;
219
+ if ($i < 0) $i = 0;
220
  }
221
+
222
  $excerpt_slice = array_slice($words, $i, $excerpt_length);
223
  $excerpt_slice = implode(' ', $excerpt_slice);
224
 
263
  if (false !== $pos) {
264
  $term_hits++;
265
  if (0 == $i) $start = true;
266
+
267
  if ($term_hits > $best_excerpt_term_hits) {
268
  $best_excerpt_term_hits = $term_hits;
269
  $excerpt = $excerpt_slice;
281
  $start = true;
282
  }
283
  }
284
+
285
  return array($excerpt, $best_excerpt_term_hits, $start);
286
  }
287
 
298
  if ( count( $args ) > 1 )
299
  parse_str( $args[1], $query );
300
 
301
+ if (stripos($referrer, $_SERVER['SERVER_NAME']) !== false) {
302
  // Local search
303
  if (isset($query['s'])) {
304
  $q = relevanssi_add_synonyms($query['s']);
305
+ $highlighted_content = relevanssi_highlight_terms($content, $q);
306
+ if (!empty($highlighted_content)) $content = $highlighted_content;
307
+ // Sometimes the content comes back empty; until I figure out why, this tries to be a solution.
308
  }
309
  }
310
  if (function_exists('relevanssi_nonlocal_highlighting')) {
390
 
391
  get_option('relevanssi_word_boundaries', 'on') == 'on' ? $word_boundaries = true : $word_boundaries = false;
392
  foreach ($terms as $term) {
393
+ // $pr_term = relevanssi_replace_punctuation(preg_quote($term, '/'));
394
+ $pr_term = preg_quote($term, '/');
395
+
396
+ $undecoded_excerpt = $excerpt;
397
+ $excerpt = html_entity_decode($excerpt);
398
+
399
  if ($word_boundaries) {
400
+ get_option('relevanssi_fuzzy') != 'none' ? $regex = "/($pr_term)(?!(^&+)?(;))/iu" : $regex = "/(\b$pr_term|$pr_term\b)(?!(^&+)?(;))/iu";
401
+ $excerpt = preg_replace($regex, $start_emp_token . '\\1' . $end_emp_token, $excerpt);
402
+ if (empty($excerpt)) $excerpt = preg_replace($regex, $start_emp_token . '\\1' . $end_emp_token, $undecoded_excerpt);
403
  }
404
  else {
405
  $excerpt = preg_replace("/($pr_term)(?!(^&+)?(;))/iu", $start_emp_token . '\\1' . $end_emp_token, $excerpt);
406
+ if (empty($excerpt)) $excerpt = preg_replace("/($pr_term)(?!(^&+)?(;))/iu", $start_emp_token . '\\1' . $end_emp_token, $undecoded_excerpt);
407
  }
408
 
409
  $preg_start = preg_quote($start_emp_token);
446
  return $excerpt;
447
  }
448
 
449
+
450
  function relevanssi_replace_punctuation($a) {
451
+ $a = preg_replace('/[[:punct:]]/u', '.', $a);
452
  return $a;
453
  }
454
 
lib/indexing.php CHANGED
@@ -54,42 +54,50 @@ function relevanssi_build_index($extend = false) {
54
  relevanssi_index_users();
55
  }
56
  }
57
-
58
- $q = "SELECT DISTINCT(post.ID)
59
- FROM $wpdb->posts parent, $wpdb->posts post WHERE
60
- (parent.post_status IN ($valid_status))
61
- AND (
62
- (post.post_status='inherit'
63
- AND post.post_parent=parent.ID)
64
- OR
65
- (parent.ID=post.ID)
66
- OR
67
  (post.post_status='inherit'
68
- AND post.post_parent=0)
69
- )
 
 
 
70
  $restriction";
 
71
  update_option('relevanssi_index', '');
72
  }
73
  else {
74
  // extending, so no truncate and skip the posts already in the index
75
  $limit = get_option('relevanssi_index_limit', 200);
76
- if ($limit > 0) {
77
  $size = $limit;
78
  $limit = " LIMIT $limit";
79
  }
80
- $q = "SELECT DISTINCT(post.ID)
81
- FROM $wpdb->posts parent, $wpdb->posts post WHERE
82
- (parent.post_status IN ($valid_status))
83
- AND (
84
- (post.post_status='inherit'
85
- AND post.post_parent=parent.ID)
86
- OR
87
- (parent.ID=post.ID)
88
- OR
 
 
 
89
  (post.post_status='inherit'
90
- AND post.post_parent=0)
91
- )
92
- AND post.ID NOT IN (SELECT DISTINCT(doc) FROM $relevanssi_table) $restriction $limit";
 
 
 
 
93
  }
94
 
95
  $custom_fields = relevanssi_get_custom_fields();
@@ -98,8 +106,9 @@ function relevanssi_build_index($extend = false) {
98
  $content = $wpdb->get_results($q);
99
 
100
  foreach ($content as $post) {
101
- $n += relevanssi_index_doc($post->ID, false, $custom_fields);
102
  // n calculates the number of insert queries
 
103
  }
104
 
105
  $wpdb->query("ANALYZE TABLE $relevanssi_table");
@@ -110,6 +119,10 @@ function relevanssi_build_index($extend = false) {
110
  . '</p></div>';
111
  update_option('relevanssi_indexed', 'done');
112
 
 
 
 
 
113
  if (function_exists('wp_suspend_cache_addition'))
114
  wp_suspend_cache_addition(false); // Thanks to Julien Mession
115
  }
@@ -187,13 +200,6 @@ function relevanssi_index_doc($indexpost, $remove_first = false, $custom_fields
187
  }
188
  }
189
 
190
- if (true == apply_filters('relevanssi_do_not_index', false, $post->ID)) {
191
- // filter says no
192
- if ($post_was_null) $post = null;
193
- if ($previous_post) $post = $previous_post;
194
- return;
195
- }
196
-
197
  $index_this_post = false;
198
 
199
  $post->indexing_content = true;
@@ -201,13 +207,19 @@ function relevanssi_index_doc($indexpost, $remove_first = false, $custom_fields
201
  if (!is_array($index_types)) $index_types = array();
202
  if (in_array($post->post_type, $index_types)) $index_this_post = true;
203
 
 
 
 
 
 
 
 
204
  if ($remove_first) {
205
  // we are updating a post, so remove the old stuff first
206
  relevanssi_remove_doc($post->ID, true);
207
  if (function_exists('relevanssi_remove_item')) {
208
  relevanssi_remove_item($post->ID, 'post');
209
  }
210
- relevanssi_purge_excerpt_cache($post->ID);
211
  }
212
 
213
  // This needs to be here, after the call to relevanssi_remove_doc(), because otherwise
@@ -222,6 +234,8 @@ function relevanssi_index_doc($indexpost, $remove_first = false, $custom_fields
222
 
223
  $n = 0;
224
 
 
 
225
  $min_word_length = get_option('relevanssi_min_word_length', 3);
226
  $insert_data = array();
227
 
@@ -302,7 +316,8 @@ function relevanssi_index_doc($indexpost, $remove_first = false, $custom_fields
302
 
303
  $index_titles = true;
304
  if (apply_filters('relevanssi_index_titles', $index_titles)) {
305
- $titles = relevanssi_tokenize(apply_filters('the_title', $post->post_title));
 
306
 
307
  if (count($titles) > 0) {
308
  foreach ($titles as $title => $count) {
@@ -346,7 +361,10 @@ function relevanssi_index_doc($indexpost, $remove_first = false, $custom_fields
346
  remove_shortcode('contact-form'); // Jetpack Contact Form causes an error message
347
  remove_shortcode('starrater'); // GD Star Rating rater shortcode causes problems
348
  remove_shortcode('responsive-flipbook'); // Responsive Flipbook causes problems
349
-
 
 
 
350
  $post_before_shortcode = $post;
351
  $contents = do_shortcode($contents);
352
  $post = $post_before_shortcode;
@@ -391,6 +409,8 @@ function relevanssi_index_doc($indexpost, $remove_first = false, $custom_fields
391
  $type = 'post';
392
  if ($post->post_type == 'attachment') $type = 'attachment';
393
 
 
 
394
  $values = array();
395
  foreach ($insert_data as $term => $data) {
396
  $content = 0;
@@ -503,6 +523,9 @@ function relevanssi_update_child_posts($new_status, $old_status, $post) {
503
  // and calls appropriate indexing function on child posts/attachments
504
  global $wpdb;
505
 
 
 
 
506
  $index_statuses = apply_filters('relevanssi_valid_status', array('publish', 'private', 'draft', 'pending', 'future'));
507
  if (($new_status == $old_status)
508
  || (in_array($new_status, $index_statuses) && in_array($old_status, $index_statuses))
@@ -552,7 +575,6 @@ function relevanssi_edit($post) {
552
 
553
  function relevanssi_delete($post) {
554
  relevanssi_remove_doc($post);
555
- relevanssi_purge_excerpt_cache($post);
556
  }
557
 
558
  function relevanssi_publish($post, $bypassglobalpost = false) {
@@ -671,10 +693,11 @@ function relevanssi_get_comments($postID) {
671
  $comments = $wpdb->get_results($sql);
672
  if (sizeof($comments) == 0) break;
673
  foreach($comments as $comment) {
674
- $comment_string .= apply_filters('relevanssi_comment_content_to_index', $comment->comment_author . ' ' . $comment->comment_content . ' ', $comment_ID);
675
  }
676
  $from += $to;
677
  }
 
678
  return $comment_string;
679
  }
680
 
54
  relevanssi_index_users();
55
  }
56
  }
57
+
58
+ $q = "SELECT post.ID
59
+ FROM $wpdb->posts post
60
+ LEFT JOIN $wpdb->posts parent ON (post.post_parent=parent.ID)
61
+ WHERE
62
+ (post.post_status IN ($valid_status)
63
+ OR
 
 
 
64
  (post.post_status='inherit'
65
+ AND(
66
+ (parent.ID is not null AND (parent.post_status IN ($valid_status)))
67
+ OR (post.post_parent=0)
68
+ )
69
+ ))
70
  $restriction";
71
+
72
  update_option('relevanssi_index', '');
73
  }
74
  else {
75
  // extending, so no truncate and skip the posts already in the index
76
  $limit = get_option('relevanssi_index_limit', 200);
77
+ if (is_numeric($limit) && $limit > 0) {
78
  $size = $limit;
79
  $limit = " LIMIT $limit";
80
  }
81
+ else {
82
+ $limit = "";
83
+ }
84
+ $q = "SELECT post.ID
85
+ FROM $wpdb->posts post
86
+ LEFT JOIN $wpdb->posts parent ON (post.post_parent=parent.ID)
87
+ LEFT JOIN $relevanssi_table r ON (post.ID=r.doc)
88
+ WHERE
89
+ r.doc is null
90
+ AND
91
+ (post.post_status IN ($valid_status)
92
+ OR
93
  (post.post_status='inherit'
94
+ AND(
95
+ (parent.ID is not null AND (parent.post_status IN ($valid_status)))
96
+ OR (post.post_parent=0)
97
+ )
98
+ )
99
+ )
100
+ $restriction $limit";
101
  }
102
 
103
  $custom_fields = relevanssi_get_custom_fields();
106
  $content = $wpdb->get_results($q);
107
 
108
  foreach ($content as $post) {
109
+ $n += relevanssi_index_doc($post->ID, false, $custom_fields, true);
110
  // n calculates the number of insert queries
111
+ // $bypassglobalpost set to true, because at this point global $post should be NULL, but in some cases it is not
112
  }
113
 
114
  $wpdb->query("ANALYZE TABLE $relevanssi_table");
119
  . '</p></div>';
120
  update_option('relevanssi_indexed', 'done');
121
 
122
+ // We always want to run this on init, if the index is finishd building.
123
+ $D = $wpdb->get_var("SELECT COUNT(DISTINCT(relevanssi.doc)) FROM $relevanssi_table AS relevanssi");
124
+ update_option( 'relevanssi_doc_count', $D);
125
+
126
  if (function_exists('wp_suspend_cache_addition'))
127
  wp_suspend_cache_addition(false); // Thanks to Julien Mession
128
  }
200
  }
201
  }
202
 
 
 
 
 
 
 
 
203
  $index_this_post = false;
204
 
205
  $post->indexing_content = true;
207
  if (!is_array($index_types)) $index_types = array();
208
  if (in_array($post->post_type, $index_types)) $index_this_post = true;
209
 
210
+ if (true == apply_filters('relevanssi_do_not_index', false, $post->ID)) {
211
+ // filter says no
212
+ if ($post_was_null) $post = null;
213
+ if ($previous_post) $post = $previous_post;
214
+ $index_this_post = false;
215
+ }
216
+
217
  if ($remove_first) {
218
  // we are updating a post, so remove the old stuff first
219
  relevanssi_remove_doc($post->ID, true);
220
  if (function_exists('relevanssi_remove_item')) {
221
  relevanssi_remove_item($post->ID, 'post');
222
  }
 
223
  }
224
 
225
  // This needs to be here, after the call to relevanssi_remove_doc(), because otherwise
234
 
235
  $n = 0;
236
 
237
+ $post = apply_filters('relevanssi_post_to_index', $post);
238
+
239
  $min_word_length = get_option('relevanssi_min_word_length', 3);
240
  $insert_data = array();
241
 
316
 
317
  $index_titles = true;
318
  if (apply_filters('relevanssi_index_titles', $index_titles)) {
319
+ $filtered_title = apply_filters('relevanssi_post_title_before_tokenize', $post->post_title);
320
+ $titles = relevanssi_tokenize(apply_filters('the_title', $filtered_title));
321
 
322
  if (count($titles) > 0) {
323
  foreach ($titles as $title => $count) {
361
  remove_shortcode('contact-form'); // Jetpack Contact Form causes an error message
362
  remove_shortcode('starrater'); // GD Star Rating rater shortcode causes problems
363
  remove_shortcode('responsive-flipbook'); // Responsive Flipbook causes problems
364
+ remove_shortcode('avatar_upload'); // WP User Avatar is incompatible
365
+ remove_shortcode('product_categories'); // A problematic WooCommerce shortcode
366
+ remove_shortcode('recent_products'); // A problematic WooCommerce shortcode
367
+
368
  $post_before_shortcode = $post;
369
  $contents = do_shortcode($contents);
370
  $post = $post_before_shortcode;
409
  $type = 'post';
410
  if ($post->post_type == 'attachment') $type = 'attachment';
411
 
412
+ $insert_data = apply_filters('relevanssi_indexing_data', $insert_data, $post);
413
+
414
  $values = array();
415
  foreach ($insert_data as $term => $data) {
416
  $content = 0;
523
  // and calls appropriate indexing function on child posts/attachments
524
  global $wpdb;
525
 
526
+ // Safety check, for WordPress Editorial Calendar incompatibility
527
+ if (!isset($post) || !isset($post->ID)) return;
528
+
529
  $index_statuses = apply_filters('relevanssi_valid_status', array('publish', 'private', 'draft', 'pending', 'future'));
530
  if (($new_status == $old_status)
531
  || (in_array($new_status, $index_statuses) && in_array($old_status, $index_statuses))
575
 
576
  function relevanssi_delete($post) {
577
  relevanssi_remove_doc($post);
 
578
  }
579
 
580
  function relevanssi_publish($post, $bypassglobalpost = false) {
693
  $comments = $wpdb->get_results($sql);
694
  if (sizeof($comments) == 0) break;
695
  foreach($comments as $comment) {
696
+ $comment_string .= apply_filters('relevanssi_comment_content_to_index', $comment->comment_author . ' ' . $comment->comment_content . ' ', $comment->comment_ID);
697
  }
698
  $from += $to;
699
  }
700
+
701
  return $comment_string;
702
  }
703
 
lib/init.php CHANGED
@@ -16,19 +16,20 @@ add_action('edit_attachment', 'relevanssi_edit');
16
  add_action('transition_post_status', 'relevanssi_update_child_posts',99,3);
17
  // END added by renaissancehack
18
  add_action('init', 'relevanssi_init');
19
- add_action('init', 'relevanssi_check_old_data', 99);
20
  add_filter('relevanssi_hits_filter', 'relevanssi_wpml_filter');
21
  add_filter('posts_request', 'relevanssi_prevent_default_request', 10, 2 );
22
  add_filter('relevanssi_remove_punctuation', 'relevanssi_remove_punct');
23
  add_filter('relevanssi_post_ok', 'relevanssi_default_post_ok', 9, 2);
24
  add_filter('relevanssi_query_filter', 'relevanssi_limit_filter');
25
  add_filter('query_vars', 'relevanssi_query_vars');
 
26
 
27
  global $relevanssi_variables;
28
  register_activation_hook($relevanssi_variables['file'], 'relevanssi_install');
29
 
30
  function relevanssi_init() {
31
- global $pagenow, $relevanssi_variables;
32
  $plugin_dir = dirname(plugin_basename($relevanssi_variables['file']));
33
  load_plugin_textdomain('relevanssi', false, $plugin_dir);
34
 
@@ -36,17 +37,23 @@ function relevanssi_init() {
36
  if (!get_option('relevanssi_indexed') && !$index) {
37
  function relevanssi_warning() {
38
  RELEVANSSI_PREMIUM ? $plugin = 'relevanssi-premium' : $plugin = 'relevanssi';
39
- echo "<div id='relevanssi-warning' class='updated fade'><p><strong>"
40
- . sprintf(__('Relevanssi needs attention: Remember to build the index (you can do it at <a href="%1$s">the
41
- settings page</a>), otherwise searching won\'t work.'), "options-general.php?page=" . $plugin . "/relevanssi.php")
42
  . "</strong></p></div>";
43
  }
44
- add_action('admin_notices', 'relevanssi_warning');
45
- }
 
 
 
 
 
 
 
46
 
47
  if (!function_exists('mb_internal_encoding')) {
48
  function relevanssi_mb_warning() {
49
- echo "<div id='relevanssi-warning' class='updated fade'><p><strong>"
50
  . "Multibyte string functions are not available. Relevanssi may not work well without them. "
51
  . "Please install (or ask your host to install) the mbstring extension."
52
  . "</strong></p></div>";
@@ -55,11 +62,6 @@ function relevanssi_init() {
55
  add_action('admin_notices', 'relevanssi_mb_warning');
56
  }
57
 
58
- if (!wp_next_scheduled('relevanssi_truncate_cache')) {
59
- wp_schedule_event(time(), 'daily', 'relevanssi_truncate_cache');
60
- add_action('relevanssi_truncate_cache', 'relevanssi_truncate_cache');
61
- }
62
-
63
  if (get_option('relevanssi_highlight_docs', 'off') != 'off') {
64
  add_filter('the_content', 'relevanssi_highlight_in_docs', 11);
65
  }
@@ -122,8 +124,6 @@ function relevanssi_create_database_tables($relevanssi_db_version) {
122
  $relevanssi_table = $wpdb->prefix . "relevanssi";
123
  $relevanssi_stopword_table = $wpdb->prefix . "relevanssi_stopwords";
124
  $relevanssi_log_table = $wpdb->prefix . "relevanssi_log";
125
- $relevanssi_cache = $wpdb->prefix . 'relevanssi_cache';
126
- $relevanssi_excerpt_cache = $wpdb->prefix . 'relevanssi_excerpt_cache';
127
 
128
  if(get_option('relevanssi_db_version') != $relevanssi_db_version) {
129
  if ($relevanssi_db_version == 1) {
@@ -199,27 +199,13 @@ function relevanssi_create_database_tables($relevanssi_db_version) {
199
  $sql = "CREATE TABLE " . $relevanssi_log_table . " (id bigint(9) NOT NULL AUTO_INCREMENT,
200
  query varchar(200) NOT NULL,
201
  hits mediumint(9) NOT NULL DEFAULT '0',
202
- time timestamp NOT NULL,
203
  user_id bigint(20) NOT NULL DEFAULT '0',
204
  ip varchar(40) NOT NULL DEFAULT '',
205
  UNIQUE KEY id (id)) $charset_collate;";
206
 
207
  dbDelta($sql);
208
 
209
- $sql = "CREATE TABLE " . $relevanssi_cache . " (param varchar(32) $charset_collate_bin_column NOT NULL,
210
- hits text NOT NULL,
211
- tstamp timestamp NOT NULL,
212
- UNIQUE KEY param (param)) $charset_collate;";
213
-
214
- dbDelta($sql);
215
-
216
- $sql = "CREATE TABLE " . $relevanssi_excerpt_cache . " (query varchar(100) $charset_collate_bin_column NOT NULL,
217
- post mediumint(9) NOT NULL,
218
- excerpt text NOT NULL,
219
- UNIQUE (query, post)) $charset_collate;";
220
-
221
- dbDelta($sql);
222
-
223
  if (RELEVANSSI_PREMIUM && get_option('relevanssi_db_version') < 12) {
224
  $charset_collate_bin_column = '';
225
  $charset_collate = '';
@@ -243,10 +229,6 @@ function relevanssi_create_database_tables($relevanssi_db_version) {
243
  $wpdb->query($sql);
244
  $sql = "ALTER TABLE $relevanssi_log_table ADD COLUMN ip varchar(40) NOT NULL DEFAULT ''";
245
  $wpdb->query($sql);
246
- $sql = "ALTER TABLE $relevanssi_cache MODIFY COLUMN param varchar(32) $charset_collate_bin_column NOT NULL";
247
- $wpdb->query($sql);
248
- $sql = "ALTER TABLE $relevanssi_excerpt_cache MODIFY COLUMN query(100) $charset_collate_bin_column NOT NULL";
249
- $wpdb->query($sql);
250
  }
251
 
252
  if (get_option('relevanssi_db_version') < 16) {
16
  add_action('transition_post_status', 'relevanssi_update_child_posts',99,3);
17
  // END added by renaissancehack
18
  add_action('init', 'relevanssi_init');
19
+ add_action('admin_head', 'relevanssi_check_old_data', 99);
20
  add_filter('relevanssi_hits_filter', 'relevanssi_wpml_filter');
21
  add_filter('posts_request', 'relevanssi_prevent_default_request', 10, 2 );
22
  add_filter('relevanssi_remove_punctuation', 'relevanssi_remove_punct');
23
  add_filter('relevanssi_post_ok', 'relevanssi_default_post_ok', 9, 2);
24
  add_filter('relevanssi_query_filter', 'relevanssi_limit_filter');
25
  add_filter('query_vars', 'relevanssi_query_vars');
26
+ add_filter('relevanssi_indexing_values', 'relevanssi_update_doc_count', 98, 2);
27
 
28
  global $relevanssi_variables;
29
  register_activation_hook($relevanssi_variables['file'], 'relevanssi_install');
30
 
31
  function relevanssi_init() {
32
+ global $pagenow, $relevanssi_variables, $wpdb;
33
  $plugin_dir = dirname(plugin_basename($relevanssi_variables['file']));
34
  load_plugin_textdomain('relevanssi', false, $plugin_dir);
35
 
37
  if (!get_option('relevanssi_indexed') && !$index) {
38
  function relevanssi_warning() {
39
  RELEVANSSI_PREMIUM ? $plugin = 'relevanssi-premium' : $plugin = 'relevanssi';
40
+ echo "<div id='relevanssi-warning' class='update-nag'><p><strong>"
41
+ . __('You do not have an index! Remember to build the index (click the "Build the index" button), otherwise searching won\'t work.')
 
42
  . "</strong></p></div>";
43
  }
44
+ if ( 'options-general.php' == $pagenow and isset( $_GET['page'] ) and plugin_basename($relevanssi_variables['file']) == $_GET['page'] ) {
45
+ add_action('admin_notices', 'relevanssi_warning');
46
+ } else {
47
+ // We always want to run this on init, if the index is finishd building.
48
+ $relevanssi_table = $relevanssi_variables['relevanssi_table'];
49
+ $D = $wpdb->get_var("SELECT COUNT(DISTINCT(relevanssi.doc)) FROM $relevanssi_table AS relevanssi");
50
+ update_option( 'relevanssi_doc_count', $D);
51
+ }
52
+ }
53
 
54
  if (!function_exists('mb_internal_encoding')) {
55
  function relevanssi_mb_warning() {
56
+ echo "<div id='relevanssi-warning' class='error'><p><strong>"
57
  . "Multibyte string functions are not available. Relevanssi may not work well without them. "
58
  . "Please install (or ask your host to install) the mbstring extension."
59
  . "</strong></p></div>";
62
  add_action('admin_notices', 'relevanssi_mb_warning');
63
  }
64
 
 
 
 
 
 
65
  if (get_option('relevanssi_highlight_docs', 'off') != 'off') {
66
  add_filter('the_content', 'relevanssi_highlight_in_docs', 11);
67
  }
124
  $relevanssi_table = $wpdb->prefix . "relevanssi";
125
  $relevanssi_stopword_table = $wpdb->prefix . "relevanssi_stopwords";
126
  $relevanssi_log_table = $wpdb->prefix . "relevanssi_log";
 
 
127
 
128
  if(get_option('relevanssi_db_version') != $relevanssi_db_version) {
129
  if ($relevanssi_db_version == 1) {
199
  $sql = "CREATE TABLE " . $relevanssi_log_table . " (id bigint(9) NOT NULL AUTO_INCREMENT,
200
  query varchar(200) NOT NULL,
201
  hits mediumint(9) NOT NULL DEFAULT '0',
202
+ time timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
203
  user_id bigint(20) NOT NULL DEFAULT '0',
204
  ip varchar(40) NOT NULL DEFAULT '',
205
  UNIQUE KEY id (id)) $charset_collate;";
206
 
207
  dbDelta($sql);
208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  if (RELEVANSSI_PREMIUM && get_option('relevanssi_db_version') < 12) {
210
  $charset_collate_bin_column = '';
211
  $charset_collate = '';
229
  $wpdb->query($sql);
230
  $sql = "ALTER TABLE $relevanssi_log_table ADD COLUMN ip varchar(40) NOT NULL DEFAULT ''";
231
  $wpdb->query($sql);
 
 
 
 
232
  }
233
 
234
  if (get_option('relevanssi_db_version') < 16) {
lib/interface.php CHANGED
@@ -63,12 +63,6 @@ function relevanssi_options() {
63
  check_admin_referer(plugin_basename($relevanssi_variables['file']), 'relevanssi_options');
64
  relevanssi_remove_all_stopwords();
65
  }
66
-
67
- if (isset($_REQUEST['truncate'])) {
68
- check_admin_referer(plugin_basename($relevanssi_variables['file']), 'relevanssi_options');
69
- $clear_all = true;
70
- relevanssi_truncate_cache($clear_all);
71
- }
72
  }
73
  relevanssi_options_form();
74
 
@@ -148,12 +142,6 @@ function update_relevanssi_options() {
148
  update_option('relevanssi_min_word_length', $value);
149
  }
150
 
151
- if (isset($_REQUEST['relevanssi_cache_seconds'])) {
152
- $value = intval($_REQUEST['relevanssi_cache_seconds']);
153
- if ($value == 0) $value = 86400;
154
- update_option('relevanssi_cache_seconds', $value);
155
- }
156
-
157
  if (!isset($_REQUEST['relevanssi_admin_search'])) {
158
  $_REQUEST['relevanssi_admin_search'] = "off";
159
  }
@@ -206,10 +194,6 @@ function update_relevanssi_options() {
206
  $_REQUEST['relevanssi_expand_shortcodes'] = "off";
207
  }
208
 
209
- if (!isset($_REQUEST['relevanssi_enable_cache'])) {
210
- $_REQUEST['relevanssi_enable_cache'] = "off";
211
- }
212
-
213
  if (!isset($_REQUEST['relevanssi_respect_exclude'])) {
214
  $_REQUEST['relevanssi_respect_exclude'] = "off";
215
  }
@@ -292,6 +276,7 @@ function update_relevanssi_options() {
292
  if (isset($_REQUEST['relevanssi_class'])) update_option('relevanssi_class', $_REQUEST['relevanssi_class']);
293
  if (isset($_REQUEST['relevanssi_cat'])) update_option('relevanssi_cat', $_REQUEST['relevanssi_cat']);
294
  if (isset($_REQUEST['relevanssi_excat'])) update_option('relevanssi_excat', $_REQUEST['relevanssi_excat']);
 
295
  if (isset($_REQUEST['relevanssi_index_fields'])) update_option('relevanssi_index_fields', $_REQUEST['relevanssi_index_fields']);
296
  if (isset($_REQUEST['relevanssi_expst'])) update_option('relevanssi_exclude_posts', $_REQUEST['relevanssi_expst']); //added by OdditY
297
  if (isset($_REQUEST['relevanssi_hilite_title'])) update_option('relevanssi_hilite_title', $_REQUEST['relevanssi_hilite_title']); //added by OdditY
@@ -305,7 +290,6 @@ function update_relevanssi_options() {
305
  if (isset($_REQUEST['relevanssi_index_limit'])) update_option('relevanssi_index_limit', $_REQUEST['relevanssi_index_limit']);
306
  if (isset($_REQUEST['relevanssi_disable_or_fallback'])) update_option('relevanssi_disable_or_fallback', $_REQUEST['relevanssi_disable_or_fallback']);
307
  if (isset($_REQUEST['relevanssi_respect_exclude'])) update_option('relevanssi_respect_exclude', $_REQUEST['relevanssi_respect_exclude']);
308
- if (isset($_REQUEST['relevanssi_enable_cache'])) update_option('relevanssi_enable_cache', $_REQUEST['relevanssi_enable_cache']);
309
  if (isset($_REQUEST['relevanssi_throttle'])) update_option('relevanssi_throttle', $_REQUEST['relevanssi_throttle']);
310
  if (isset($_REQUEST['relevanssi_throttle_limit'])) update_option('relevanssi_throttle_limit', $_REQUEST['relevanssi_throttle_limit']);
311
  if (isset($_REQUEST['relevanssi_wpml_only_current'])) update_option('relevanssi_wpml_only_current', $_REQUEST['relevanssi_wpml_only_current']);
@@ -351,7 +335,16 @@ function relevanssi_add_single_stopword($term) {
351
  global $wpdb, $relevanssi_variables;
352
  if ('' == $term) return;
353
 
 
 
 
 
 
 
 
 
354
  $q = $wpdb->prepare("INSERT INTO " . $relevanssi_variables['stopword_table'] . " (stopword) VALUES (%s)", $term);
 
355
  $success = $wpdb->query($q);
356
 
357
  if ($success) {
@@ -368,8 +361,7 @@ function relevanssi_add_single_stopword($term) {
368
  function relevanssi_remove_all_stopwords() {
369
  global $wpdb, $relevanssi_variables;
370
 
371
- $q = $wpdb->prepare("TRUNCATE " . $relevanssi_variables['stopword_table']);
372
- $success = $wpdb->query($q);
373
 
374
  printf(__("<div id='message' class='updated fade'><p>Stopwords removed! Remember to re-index.</p></div>", "relevanssi"), $term);
375
  }
@@ -554,7 +546,6 @@ function relevanssi_options_form() {
554
  $docs_count = $wpdb->get_var("SELECT COUNT(DISTINCT doc) FROM " . $relevanssi_variables['relevanssi_table']);
555
  $terms_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $relevanssi_variables['relevanssi_table']);
556
  $biggest_doc = $wpdb->get_var("SELECT doc FROM " . $relevanssi_variables['relevanssi_table'] . " ORDER BY doc DESC LIMIT 1");
557
- $cache_count = $wpdb->get_var("SELECT COUNT(tstamp) FROM " . $relevanssi_variables['relevanssi_cache']);
558
 
559
  $serialize_options = array();
560
 
@@ -680,6 +671,8 @@ function relevanssi_options_form() {
680
  $serialize_options['relevanssi_cat'] = $cat;
681
  $excat = get_option('relevanssi_excat');
682
  $serialize_options['relevanssi_excat'] = $excat;
 
 
683
 
684
  $fuzzy = get_option('relevanssi_fuzzy');
685
  $serialize_options['relevanssi_fuzzy'] = $fuzzy;
@@ -740,11 +733,6 @@ function relevanssi_options_form() {
740
  $respect_exclude = ('on' == get_option('relevanssi_respect_exclude') ? 'checked="checked"' : '');
741
  $serialize_options['relevanssi_respect_exclude'] = get_option('relevanssi_respect_exclude');
742
 
743
- $enable_cache = ('on' == get_option('relevanssi_enable_cache') ? 'checked="checked"' : '');
744
- $serialize_options['relevanssi_enable_cache'] = get_option('relevanssi_enable_cache');
745
- $cache_seconds = get_option('relevanssi_cache_seconds');
746
- $serialize_options['relevanssi_cache_seconds'] = $cache_seconds;
747
-
748
  $min_word_length = get_option('relevanssi_min_word_length');
749
  $serialize_options['relevanssi_min_word_length'] = $min_word_length;
750
 
@@ -810,6 +798,9 @@ function relevanssi_options_form() {
810
 
811
  $index_subscribers = ('on' == get_option('relevanssi_index_subscribers') ? 'checked="checked"' : '');
812
  $serialize_options['relevanssi_index_subscribers'] = get_option('relevanssi_index_subscribers');
 
 
 
813
 
814
  $index_taxonomies = ('on' == get_option('relevanssi_index_taxonomies') ? 'checked="checked"' : '');
815
  $serialize_options['relevanssi_index_taxonomies'] = get_option('relevanssi_index_taxonomies');
@@ -850,7 +841,6 @@ function relevanssi_options_form() {
850
  <a href="#excerpts"><?php _e("Custom excerpts", "relevanssi"); ?></a> |
851
  <a href="#highlighting"><?php _e("Highlighting search results", "relevanssi"); ?></a> |
852
  <a href="#indexing"><?php _e("Indexing options", "relevanssi"); ?></a> |
853
- <a href="#caching"><?php _e("Caching", "relevanssi"); ?></a> |
854
  <a href="#synonyms"><?php _e("Synonyms", "relevanssi"); ?></a> |
855
  <a href="#stopwords"><?php _e("Stopwords", "relevanssi"); ?></a> |
856
  <?php
@@ -865,9 +855,9 @@ function relevanssi_options_form() {
865
 
866
  <h3><?php _e('Quick tools', 'relevanssi') ?></h3>
867
  <p>
868
- <input type='submit' name='submit' value='<?php _e(esc_attr('Save options'), 'relevanssi'); ?>' style="background-color:#007f00; border-color:#5fbf00; border-style:solid; border-width:thick; padding: 5px; color: #fff;" />
869
- <input type="submit" name="index" value="<?php _e(esc_attr('Build the index'), 'relevanssi') ?>" style="background-color:#007f00; border-color:#5fbf00; border-style:solid; border-width:thick; padding: 5px; color: #fff;" />
870
- <input type="submit" name="index_extend" value="<?php _e(esc_attr('Continue indexing'), 'relevanssi') ?>" style="background-color:#e87000; border-color:#ffbb00; border-style:solid; border-width:thick; padding: 5px; color: #fff;" />, <?php _e('add', 'relevanssi'); ?> <input type="text" size="4" name="relevanssi_index_limit" value="<?php echo $index_limit ?>" /> <?php _e('documents.', 'relevanssi'); ?></p>
871
 
872
  <?php
873
  if (empty($index_post_types)) {
@@ -942,7 +932,7 @@ function relevanssi_options_form() {
942
 
943
  <label for='relevanssi_throttle_limit'><?php _e("Limit:", "relevanssi"); ?>
944
  <input type='text' size='4' name='relevanssi_throttle_limit' id='relevanssi_throttle_limit' value='<?php echo $throttle_limit ?>' /></label><br />
945
- <small><?php _e("For better performance, adjust the limit to a smaller number. Adjusting the limit to 100 - or even lower - should be safe for good results, and might bring a boost in search speed.", 'relevanssi'); ?></small>
946
 
947
  <br /><br />
948
 
@@ -1042,9 +1032,15 @@ function relevanssi_options_form() {
1042
 
1043
  <br /><br />
1044
 
1045
- <label for='relevanssi_excat'><?php _e('Exclude these categories and tags from search:', 'relevanssi'); ?>
1046
  <input type='text' name='relevanssi_excat' id='relevanssi_excat' size='20' value='<?php echo esc_attr($excat); ?>' /></label><br />
1047
- <small><?php _e("Enter a comma-separated list of category and tag IDs that are excluded from search results. You can exclude categories with the 'cat' input field by using negative values.", 'relevanssi'); ?></small>
 
 
 
 
 
 
1048
 
1049
  <br /><br />
1050
 
@@ -1178,7 +1174,7 @@ function relevanssi_options_form() {
1178
  <br />
1179
  <br />
1180
 
1181
- <input type='submit' name='submit' value='<?php _e(esc_attr('Save the options'), 'relevanssi'); ?>' class='button button-primary' />
1182
 
1183
  <h3 id="indexing"><?php _e('Indexing options', 'relevanssi'); ?></h3>
1184
 
@@ -1324,40 +1320,19 @@ EOH;
1324
 
1325
  <?php if (function_exists('relevanssi_form_index_taxonomies')) relevanssi_form_index_taxonomies($index_taxonomies, $index_terms); ?>
1326
 
1327
- <input type='submit' name='index' value='<?php _e(esc_attr("Save indexing options and build the index"), 'relevanssi'); ?>' class='button button-primary' />
1328
-
1329
- <input type='submit' name='index_extend' value='<?php _e(esc_attr("Continue indexing"), 'relevanssi'); ?>' class='button' />
1330
-
1331
- <h3 id="caching"><?php _e("Caching", "relevanssi"); ?></h3>
1332
 
1333
- <p><?php _e("Warning: In many cases caching is not useful, and in some cases can be even harmful. Do not
1334
- activate cache unless you have a good reason to do so.", 'relevanssi'); ?></p>
1335
-
1336
- <label for='relevanssi_enable_cache'><?php _e('Enable result and excerpt caching:', 'relevanssi'); ?>
1337
- <input type='checkbox' name='relevanssi_enable_cache' id='relevanssi_enable_cache' <?php echo $enable_cache ?> /></label><br />
1338
- <small><?php _e("If checked, Relevanssi will cache search results and post excerpts.", 'relevanssi'); ?></small>
1339
-
1340
- <br /><br />
1341
-
1342
- <label for='relevanssi_cache_seconds'><?php _e("Cache expire (in seconds):", "relevanssi"); ?>
1343
- <input type='text' name='relevanssi_cache_seconds' id='relevanssi_cache_seconds' size='30' value='<?php echo esc_attr($cache_seconds); ?>' /></label><br />
1344
- <small><?php _e("86400 = day", "relevanssi"); ?></small>
1345
-
1346
- <br /><br />
1347
-
1348
- <?php _e("Entries in the cache", 'relevanssi'); ?>: <?php echo $cache_count; ?>
1349
-
1350
- <br /><br />
1351
-
1352
- <input type='submit' name='truncate' id='truncate' value='<?php _e(esc_attr('Clear all caches'), 'relevanssi'); ?>' class='button' />
1353
 
1354
  <h3 id="synonyms"><?php _e("Synonyms", "relevanssi"); ?></h3>
1355
 
1356
- <p><textarea name='relevanssi_synonyms' id='relevanssi_synonyms' rows='9' cols='60'><?php echo $synonyms ?></textarea></p>
1357
 
1358
  <p><small><?php _e("Add synonyms here in 'key = value' format. When searching with the OR operator, any search of 'key' will be expanded to include 'value' as well. Using phrases is possible. The key-value pairs work in one direction only, but you can of course repeat the same pair reversed.", "relevanssi"); ?></small></p>
1359
 
1360
- <input type='submit' name='submit' value='<?php _e(esc_attr('Save the options'), 'relevanssi'); ?>' class='button' />
 
 
1361
 
1362
  <h3 id="stopwords"><?php _e("Stopwords", "relevanssi"); ?></h3>
1363
 
@@ -1381,7 +1356,7 @@ function relevanssi_show_stopwords() {
1381
  _e("<p>Enter a word here to add it to the list of stopwords. The word will automatically be removed from the index, so re-indexing is not necessary. You can enter many words at the same time, separate words with commas.</p>", 'relevanssi');
1382
 
1383
  ?><label for="addstopword"><p><?php _e("Stopword(s) to add: ", 'relevanssi'); ?><textarea name="addstopword" id="addstopword" rows="2" cols="40"></textarea>
1384
- <input type="submit" value="<?php _e(esc_attr("Add"), 'relevanssi'); ?>" class='button' /></p></label>
1385
  <?php
1386
 
1387
  _e("<p>Here's a list of stopwords in the database. Click a word to remove it from stopwords. Removing stopwords won't automatically return them to index, so you need to re-index all posts after removing stopwords to get those words back to index.", 'relevanssi');
@@ -1410,10 +1385,10 @@ function relevanssi_show_stopwords() {
1410
  echo "</ul>";
1411
 
1412
  ?>
1413
- <p><input type="submit" name="removeallstopwords" value="<?php _e(esc_attr('Remove all stopwords'), 'relevanssi'); ?>" class='button' /></p>
1414
  <?php
1415
 
1416
- $exportlist = implode(", ", $exportlist);
1417
 
1418
  ?>
1419
  <p><?php _e("Here's a list of stopwords you can use to export the stopwords to another blog.", "relevanssi"); ?></p>
63
  check_admin_referer(plugin_basename($relevanssi_variables['file']), 'relevanssi_options');
64
  relevanssi_remove_all_stopwords();
65
  }
 
 
 
 
 
 
66
  }
67
  relevanssi_options_form();
68
 
142
  update_option('relevanssi_min_word_length', $value);
143
  }
144
 
 
 
 
 
 
 
145
  if (!isset($_REQUEST['relevanssi_admin_search'])) {
146
  $_REQUEST['relevanssi_admin_search'] = "off";
147
  }
194
  $_REQUEST['relevanssi_expand_shortcodes'] = "off";
195
  }
196
 
 
 
 
 
197
  if (!isset($_REQUEST['relevanssi_respect_exclude'])) {
198
  $_REQUEST['relevanssi_respect_exclude'] = "off";
199
  }
276
  if (isset($_REQUEST['relevanssi_class'])) update_option('relevanssi_class', $_REQUEST['relevanssi_class']);
277
  if (isset($_REQUEST['relevanssi_cat'])) update_option('relevanssi_cat', $_REQUEST['relevanssi_cat']);
278
  if (isset($_REQUEST['relevanssi_excat'])) update_option('relevanssi_excat', $_REQUEST['relevanssi_excat']);
279
+ if (isset($_REQUEST['relevanssi_extag'])) update_option('relevanssi_extag', $_REQUEST['relevanssi_extag']);
280
  if (isset($_REQUEST['relevanssi_index_fields'])) update_option('relevanssi_index_fields', $_REQUEST['relevanssi_index_fields']);
281
  if (isset($_REQUEST['relevanssi_expst'])) update_option('relevanssi_exclude_posts', $_REQUEST['relevanssi_expst']); //added by OdditY
282
  if (isset($_REQUEST['relevanssi_hilite_title'])) update_option('relevanssi_hilite_title', $_REQUEST['relevanssi_hilite_title']); //added by OdditY
290
  if (isset($_REQUEST['relevanssi_index_limit'])) update_option('relevanssi_index_limit', $_REQUEST['relevanssi_index_limit']);
291
  if (isset($_REQUEST['relevanssi_disable_or_fallback'])) update_option('relevanssi_disable_or_fallback', $_REQUEST['relevanssi_disable_or_fallback']);
292
  if (isset($_REQUEST['relevanssi_respect_exclude'])) update_option('relevanssi_respect_exclude', $_REQUEST['relevanssi_respect_exclude']);
 
293
  if (isset($_REQUEST['relevanssi_throttle'])) update_option('relevanssi_throttle', $_REQUEST['relevanssi_throttle']);
294
  if (isset($_REQUEST['relevanssi_throttle_limit'])) update_option('relevanssi_throttle_limit', $_REQUEST['relevanssi_throttle_limit']);
295
  if (isset($_REQUEST['relevanssi_wpml_only_current'])) update_option('relevanssi_wpml_only_current', $_REQUEST['relevanssi_wpml_only_current']);
335
  global $wpdb, $relevanssi_variables;
336
  if ('' == $term) return;
337
 
338
+ if (method_exists($wpdb, 'esc_like')) {
339
+ $term = $wpdb->esc_like(esc_sql($term));
340
+ }
341
+ else {
342
+ // Compatibility for pre-4.0 WordPress
343
+ $term = like_escape(esc_sql($term));
344
+ }
345
+
346
  $q = $wpdb->prepare("INSERT INTO " . $relevanssi_variables['stopword_table'] . " (stopword) VALUES (%s)", $term);
347
+ // Clean: escaped.
348
  $success = $wpdb->query($q);
349
 
350
  if ($success) {
361
  function relevanssi_remove_all_stopwords() {
362
  global $wpdb, $relevanssi_variables;
363
 
364
+ $success = $wpdb->query("TRUNCATE " . $relevanssi_variables['stopword_table']);
 
365
 
366
  printf(__("<div id='message' class='updated fade'><p>Stopwords removed! Remember to re-index.</p></div>", "relevanssi"), $term);
367
  }
546
  $docs_count = $wpdb->get_var("SELECT COUNT(DISTINCT doc) FROM " . $relevanssi_variables['relevanssi_table']);
547
  $terms_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $relevanssi_variables['relevanssi_table']);
548
  $biggest_doc = $wpdb->get_var("SELECT doc FROM " . $relevanssi_variables['relevanssi_table'] . " ORDER BY doc DESC LIMIT 1");
 
549
 
550
  $serialize_options = array();
551
 
671
  $serialize_options['relevanssi_cat'] = $cat;
672
  $excat = get_option('relevanssi_excat');
673
  $serialize_options['relevanssi_excat'] = $excat;
674
+ $extag = get_option('relevanssi_extag');
675
+ $serialize_options['relevanssi_extag'] = $extag;
676
 
677
  $fuzzy = get_option('relevanssi_fuzzy');
678
  $serialize_options['relevanssi_fuzzy'] = $fuzzy;
733
  $respect_exclude = ('on' == get_option('relevanssi_respect_exclude') ? 'checked="checked"' : '');
734
  $serialize_options['relevanssi_respect_exclude'] = get_option('relevanssi_respect_exclude');
735
 
 
 
 
 
 
736
  $min_word_length = get_option('relevanssi_min_word_length');
737
  $serialize_options['relevanssi_min_word_length'] = $min_word_length;
738
 
798
 
799
  $index_subscribers = ('on' == get_option('relevanssi_index_subscribers') ? 'checked="checked"' : '');
800
  $serialize_options['relevanssi_index_subscribers'] = get_option('relevanssi_index_subscribers');
801
+
802
+ $index_synonyms = ('on' == get_option('relevanssi_index_synonyms') ? 'checked="checked"' : '');
803
+ $serialize_options['relevanssi_index_synonyms'] = get_option('relevanssi_index_synonyms');
804
 
805
  $index_taxonomies = ('on' == get_option('relevanssi_index_taxonomies') ? 'checked="checked"' : '');
806
  $serialize_options['relevanssi_index_taxonomies'] = get_option('relevanssi_index_taxonomies');
841
  <a href="#excerpts"><?php _e("Custom excerpts", "relevanssi"); ?></a> |
842
  <a href="#highlighting"><?php _e("Highlighting search results", "relevanssi"); ?></a> |
843
  <a href="#indexing"><?php _e("Indexing options", "relevanssi"); ?></a> |
 
844
  <a href="#synonyms"><?php _e("Synonyms", "relevanssi"); ?></a> |
845
  <a href="#stopwords"><?php _e("Stopwords", "relevanssi"); ?></a> |
846
  <?php
855
 
856
  <h3><?php _e('Quick tools', 'relevanssi') ?></h3>
857
  <p>
858
+ <input type='submit' name='submit' value='<?php esc_attr(_e('Save options', 'relevanssi')); ?>' class='button-primary' />
859
+ <input type="submit" name="index" value="<?php esc_attr(_e('Build the index', 'relevanssi')); ?>" class='button-primary' />
860
+ <input type="submit" name="index_extend" value="<?php esc_attr(_e('Continue indexing', 'relevanssi')); ?>" class='button-secondary' />, <?php _e('add', 'relevanssi'); ?> <input type="text" size="4" name="relevanssi_index_limit" value="<?php echo $index_limit ?>" /> <?php _e('documents.', 'relevanssi'); ?></p>
861
 
862
  <?php
863
  if (empty($index_post_types)) {
932
 
933
  <label for='relevanssi_throttle_limit'><?php _e("Limit:", "relevanssi"); ?>
934
  <input type='text' size='4' name='relevanssi_throttle_limit' id='relevanssi_throttle_limit' value='<?php echo $throttle_limit ?>' /></label><br />
935
+ <small><?php printf(__("For better performance, adjust the limit to a smaller number. Adjusting the limit to 100 or 200 should be safe for good results, and might bring a boost in search speed. DO NOT use this feature to limit the number of search results on search results pages, as that will lead to problems. For adjusting the number of search results displayed, see <a href='%s'>this knowledge base entry</a>.", 'relevanssi'), 'http://www.relevanssi.com/knowledge-base/posts-per-page/'); ?></small>
936
 
937
  <br /><br />
938
 
1032
 
1033
  <br /><br />
1034
 
1035
+ <label for='relevanssi_excat'><?php _e('Exclude these categories from search:', 'relevanssi'); ?>
1036
  <input type='text' name='relevanssi_excat' id='relevanssi_excat' size='20' value='<?php echo esc_attr($excat); ?>' /></label><br />
1037
+ <small><?php _e("Enter a comma-separated list of category IDs that are excluded from search results.", 'relevanssi'); ?></small>
1038
+
1039
+ <br /><br />
1040
+
1041
+ <label for='relevanssi_extag'><?php _e('Exclude these tags from search:', 'relevanssi'); ?>
1042
+ <input type='text' name='relevanssi_extag' id='relevanssi_extag' size='20' value='<?php echo esc_attr($extag); ?>' /></label><br />
1043
+ <small><?php _e("Enter a comma-separated list of tag IDs that are excluded from search results.", 'relevanssi'); ?></small>
1044
 
1045
  <br /><br />
1046
 
1174
  <br />
1175
  <br />
1176
 
1177
+ <input type='submit' name='submit' value='<?php esc_attr(_e('Save the options', 'relevanssi')); ?>' class='button button-primary' />
1178
 
1179
  <h3 id="indexing"><?php _e('Indexing options', 'relevanssi'); ?></h3>
1180
 
1320
 
1321
  <?php if (function_exists('relevanssi_form_index_taxonomies')) relevanssi_form_index_taxonomies($index_taxonomies, $index_terms); ?>
1322
 
1323
+ <input type='submit' name='index' value='<?php esc_attr(_e("Save indexing options, erase index and rebuild the index", 'relevanssi')); ?>' class='button button-primary' />
 
 
 
 
1324
 
1325
+ <input type='submit' name='index_extend' value='<?php esc_attr(_e("Continue indexing", 'relevanssi')); ?>' class='button' />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1326
 
1327
  <h3 id="synonyms"><?php _e("Synonyms", "relevanssi"); ?></h3>
1328
 
1329
+ <p><textarea name='relevanssi_synonyms' id='relevanssi_synonyms' rows='9' cols='60'><?php echo htmlspecialchars($synonyms); ?></textarea></p>
1330
 
1331
  <p><small><?php _e("Add synonyms here in 'key = value' format. When searching with the OR operator, any search of 'key' will be expanded to include 'value' as well. Using phrases is possible. The key-value pairs work in one direction only, but you can of course repeat the same pair reversed.", "relevanssi"); ?></small></p>
1332
 
1333
+ <?php if (function_exists('relevanssi_form_index_synonyms')) relevanssi_form_index_synonyms($index_synonyms); ?>
1334
+
1335
+ <input type='submit' name='submit' value='<?php esc_attr(_e('Save the options', 'relevanssi')); ?>' class='button' />
1336
 
1337
  <h3 id="stopwords"><?php _e("Stopwords", "relevanssi"); ?></h3>
1338
 
1356
  _e("<p>Enter a word here to add it to the list of stopwords. The word will automatically be removed from the index, so re-indexing is not necessary. You can enter many words at the same time, separate words with commas.</p>", 'relevanssi');
1357
 
1358
  ?><label for="addstopword"><p><?php _e("Stopword(s) to add: ", 'relevanssi'); ?><textarea name="addstopword" id="addstopword" rows="2" cols="40"></textarea>
1359
+ <input type="submit" value="<?php esc_attr(_e("Add", 'relevanssi')); ?>" class='button' /></p></label>
1360
  <?php
1361
 
1362
  _e("<p>Here's a list of stopwords in the database. Click a word to remove it from stopwords. Removing stopwords won't automatically return them to index, so you need to re-index all posts after removing stopwords to get those words back to index.", 'relevanssi');
1385
  echo "</ul>";
1386
 
1387
  ?>
1388
+ <p><input type="submit" name="removeallstopwords" value="<?php esc_attr(_e('Remove all stopwords', 'relevanssi')); ?>" class='button' /></p>
1389
  <?php
1390
 
1391
+ $exportlist = htmlspecialchars(implode(", ", $exportlist));
1392
 
1393
  ?>
1394
  <p><?php _e("Here's a list of stopwords you can use to export the stopwords to another blog.", "relevanssi"); ?></p>
lib/search.php CHANGED
@@ -46,93 +46,89 @@ function relevanssi_query($posts, $query = false) {
46
  }
47
 
48
  // This is my own magic working.
49
- function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query = array(), $meta_query = array(), $expost = NULL, $post_type = NULL, $operator = "AND", $search_blogs = NULL, $author = NULL, $orderby = NULL, $order = NULL) {
50
  global $wpdb, $relevanssi_variables;
51
  $relevanssi_table = $relevanssi_variables['relevanssi_table'];
52
-
53
- $values_to_filter = array(
54
- 'q' => $q,
55
- 'tax_query' => $tax_query,
56
- 'relation' => $relation,
57
- 'post_query' => $post_query,
58
- 'meta_query' => $meta_query,
59
- 'expost' => $expost,
60
- 'post_type' => $post_type,
61
- 'operator' => $operator,
62
- 'search_blogs' => $search_blogs,
63
- 'author' => $author,
64
- 'orderby' => $orderby,
65
- 'order' => $order,
66
- );
67
- $filtered_values = apply_filters( 'relevanssi_search_filters', $values_to_filter );
68
- $q = $filtered_values['q'];
69
- $tax_query = $filtered_values['tax_query'];
70
- $post_query = $filtered_values['post_query'];
71
- $meta_query = $filtered_values['meta_query'];
72
- $relation = $filtered_values['relation'];
73
- $expost = $filtered_values['expost'];
74
- $post_type = $filtered_values['post_type'];
75
- $operator = $filtered_values['operator'];
76
- $search_blogs = $filtered_values['search_blogs'];
77
- $author = $filtered_values['author'];
78
- $orderby = $filtered_values['orderby'];
79
- $order = $filtered_values['order'];
80
-
81
  $hits = array();
82
 
83
- $o_tax_query = $tax_query;
84
- $o_relation = $relation;
85
- $o_post_query = $post_query;
86
- $o_meta_query = $meta_query;
87
- $o_expost = $expost;
88
- $o_post_type = $post_type;
89
- $o_author = $author;
90
- $o_operator = $operator;
91
- $o_search_blogs = $search_blogs;
92
- $o_orderby = $orderby;
93
- $o_order = $order;
94
-
95
  $query_restrictions = "";
96
- if (!isset($relation)) $relation = "or";
97
- $relation = strtolower($relation);
98
  $term_tax_id = array();
99
  $term_tax_ids = array();
100
  $not_term_tax_ids = array();
101
  $and_term_tax_ids = array();
 
102
  if (is_array($tax_query)) {
103
  foreach ($tax_query as $row) {
104
- if ($row['field'] == 'id' || $row['field'] == 'term_id') {
105
- $id = $row['terms'];
106
- $term_id = $id;
107
- if (is_array($id)) {
108
- $id = implode(',', $id);
109
- }
110
- $term_tax_id = $wpdb->get_col(
111
- "SELECT tt.term_taxonomy_id
112
- FROM $wpdb->terms AS t, $wpdb->term_taxonomy AS tt
113
- WHERE tt.term_id = t.term_id AND tt.taxonomy = '" . $row['taxonomy'] . "' AND t.term_id IN ($id)");
114
- }
115
  if ($row['field'] == 'slug') {
116
  $slug = $row['terms'];
 
 
117
  if (is_array($slug)) {
118
  $slugs = array();
119
  $term_id = array();
120
  foreach ($slug as $t_slug) {
121
  $term = get_term_by('slug', $t_slug, $row['taxonomy']);
122
- $term_id[] = $term->term_id;
123
- $slugs[] = "'$t_slug'";
 
 
 
 
 
 
124
  }
125
- $slug = implode(',', $slugs);
126
  }
127
  else {
128
  $term = get_term_by('slug', $slug, $row['taxonomy']);
129
- $term_id = $term->term_id;
130
- $slug = "'$slug'";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  }
132
- $term_tax_id = $wpdb->get_col(
133
- "SELECT tt.term_taxonomy_id
134
- FROM $wpdb->terms AS t, $wpdb->term_taxonomy AS tt
135
- WHERE tt.term_id = t.term_id AND tt.taxonomy = '" . $row['taxonomy'] . "' AND t.slug IN ($slug)");
136
  }
137
 
138
  if (!isset($row['include_children']) || $row['include_children'] == true) {
@@ -156,7 +152,7 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
156
  $tq_operator = 'IN';
157
  if (isset($row['operator'])) $tq_operator = strtoupper($row['operator']);
158
  if ($tq_operator != 'IN' && $tq_operator != 'NOT IN' && $tq_operator != 'AND') $tq_operator = 'IN';
159
- if ($relation == 'and') {
160
  if ($tq_operator == 'AND') {
161
  $query_restrictions .= " AND relevanssi.doc IN (
162
  SELECT ID FROM $wpdb->posts WHERE 1=1
@@ -166,10 +162,12 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
166
  WHERE tr.term_taxonomy_id IN ($term_tax_id)
167
  AND tr.object_id = $wpdb->posts.ID ) = $n
168
  )";
 
169
  }
170
  else {
171
  $query_restrictions .= " AND relevanssi.doc $tq_operator (SELECT DISTINCT(tr.object_id) FROM $wpdb->term_relationships AS tr
172
  WHERE tr.term_taxonomy_id IN ($term_tax_id))";
 
173
  }
174
  }
175
  else {
@@ -183,46 +181,62 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
183
  $wp_query->is_category = false;
184
  }
185
  }
186
- if ($relation == 'or') {
187
  $term_tax_ids = array_unique($term_tax_ids);
188
  if (count($term_tax_ids) > 0) {
189
  $term_tax_ids = implode(',', $term_tax_ids);
190
  $query_restrictions .= " AND relevanssi.doc IN (SELECT DISTINCT(tr.object_id) FROM $wpdb->term_relationships AS tr
191
  WHERE tr.term_taxonomy_id IN ($term_tax_ids))";
 
192
  }
193
  if (count($not_term_tax_ids) > 0) {
194
  $not_term_tax_ids = implode(',', $not_term_tax_ids);
195
  $query_restrictions .= " AND relevanssi.doc NOT IN (SELECT DISTINCT(tr.object_id) FROM $wpdb->term_relationships AS tr
196
  WHERE tr.term_taxonomy_id IN ($not_term_tax_ids))";
 
197
  }
198
  if (count($and_term_tax_ids) > 0) {
199
  $and_term_tax_ids = implode(',', $and_term_tax_ids);
200
  $n = count(explode(',', $and_term_tax_ids));
201
  $query_restrictions .= " AND relevanssi.doc IN (
202
- SELECT ID FROM $wpdb->posts AS posts WHERE 1=1
203
  AND (
204
  SELECT COUNT(1)
205
  FROM $wpdb->term_relationships AS tr
206
  WHERE tr.term_taxonomy_id IN ($and_term_tax_ids)
207
  AND tr.object_id = $wpdb->posts.ID ) = $n
208
  )";
 
209
  }
210
  }
211
  }
212
 
213
  if (is_array($post_query)) {
214
  if (!empty($post_query['in'])) {
215
- $posts = implode(',', $post_query['in']);
216
- $query_restrictions .= " AND relevanssi.doc IN ($posts)";
 
 
 
 
 
217
  }
218
  if (!empty($post_query['not in'])) {
219
- $posts = implode(',', $post_query['not in']);
220
- $query_restrictions .= " AND relevanssi.doc NOT IN ($posts)";
 
 
 
 
 
221
  }
222
  }
223
 
224
  if (is_array($meta_query)) {
225
  isset($meta_query['relation']) ? $meta_relation = strtoupper($meta_query['relation']) : $meta_relation = strtoupper(apply_filters('relevanssi_default_meta_query_relation', 'AND'));
 
 
 
226
  $meta_query_restrictions = "";
227
  foreach ($meta_query as $array_key => $meta) {
228
  if ($array_key === 'relation') {
@@ -230,7 +244,7 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
230
  }
231
 
232
  if (!empty($meta['key'])) {
233
- $key = "postmeta.meta_key = '" . $meta['key'] . "'";
234
  }
235
  else {
236
  $key = '';
@@ -240,7 +254,14 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
240
 
241
  if (isset($meta['type'])) {
242
  if (strtoupper($meta['type']) == 'NUMERIC') $meta['type'] = "SIGNED";
243
- $meta_value = "CAST(postmeta.meta_value AS " . $meta['type'] . ")";
 
 
 
 
 
 
 
244
  }
245
  else {
246
  $meta_value = 'postmeta.meta_value';
@@ -250,23 +271,29 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
250
  if (!is_array($meta['value'])) continue;
251
  if (count($meta['value']) < 2) continue;
252
  $compare == 'BETWEEN' ? $compare = "IN" : $compare = "NOT IN";
253
- $low_value = $meta['value'][0];
254
- $high_value = $meta['value'][1];
 
 
 
255
  !empty($key) ? $and = " AND " : $and = "";
256
  $meta_query_restrictions .= " $meta_relation relevanssi.doc $compare (
257
  SELECT DISTINCT(postmeta.post_id) FROM $wpdb->postmeta AS postmeta
258
  WHERE $key $and $meta_value BETWEEN $low_value AND $high_value)";
 
259
  }
260
  else if ($compare == 'EXISTS' || $compare == 'NOT EXISTS') {
261
  $compare == 'EXISTS' ? $compare = "IN" : $compare = "NOT IN";
262
  $meta_query_restrictions .= " $meta_relation relevanssi.doc $compare (
263
  SELECT DISTINCT(postmeta.post_id) FROM $wpdb->postmeta AS postmeta
264
  WHERE $key)";
 
265
  }
266
  else if ($compare == 'IN' || $compare == 'NOT IN') {
267
  if (!is_array($meta['value'])) continue;
268
  $values = array();
269
  foreach ($meta['value'] as $value) {
 
270
  $values[] = "'$value'";
271
  }
272
  $values = implode(',', $values);
@@ -274,9 +301,30 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
274
  $meta_query_restrictions .= " $meta_relation relevanssi.doc IN (
275
  SELECT DISTINCT(postmeta.post_id) FROM $wpdb->postmeta AS postmeta
276
  WHERE $key $and $meta_value $compare ($values))";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  }
278
  else {
279
- isset($meta['value']) ? $value = " $meta_value " . $meta['compare'] . " '" . $meta['value'] . "' " : $value = '';
280
  (!empty($key) && !empty($value)) ? $and = " AND " : $and = "";
281
  if (empty($key) && empty($and) && empty($value)) {
282
  // do nothing
@@ -285,6 +333,7 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
285
  $meta_query_restrictions .= " $meta_relation relevanssi.doc IN (
286
  SELECT DISTINCT(postmeta.post_id) FROM $wpdb->postmeta AS postmeta
287
  WHERE $key $and $value)";
 
288
  }
289
  }
290
  }
@@ -296,6 +345,14 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
296
  $query_restrictions .= $meta_query_restrictions;
297
  }
298
 
 
 
 
 
 
 
 
 
299
  if (!$post_type && get_option('relevanssi_respect_exclude') == 'on') {
300
  if (function_exists('get_post_types')) {
301
  $pt_1 = get_post_types(array('exclude_from_search' => '0'));
@@ -307,29 +364,44 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
307
  if ($post_type) {
308
  if ($post_type == -1) $post_type = null; // Facetious sets post_type to -1 if not selected
309
  if (!is_array($post_type)) {
310
- $post_types = explode(',', $post_type);
311
  }
312
  else {
313
- $post_types = $post_type;
314
  }
 
 
315
 
316
- $post_type = count($post_types) ? implode( ',', array_fill(1, count($post_types), "'%s'")) : 'NULL';
 
 
 
 
 
 
 
 
317
  }
318
 
319
  //Added by OdditY:
320
  //Exclude Post_IDs (Pages) for non-admin search ->
321
  $postex = '';
322
- if ($expost) {
323
  if ($expost != "") {
324
  $aexpids = explode(",",$expost);
325
  foreach ($aexpids as $exid){
326
  $exid = esc_sql(trim($exid, ' -'));
327
- $postex .= " AND relevanssi.doc !='$exid'";
 
328
  }
329
  }
330
  }
331
  // <- OdditY End
332
 
 
 
 
 
333
  $remove_stopwords = true;
334
  $phrases = relevanssi_recognize_phrases($q);
335
 
@@ -362,7 +434,13 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
362
  }
363
  }
364
 
365
- $D = $wpdb->get_var("SELECT COUNT(DISTINCT(relevanssi.doc)) FROM $relevanssi_table AS relevanssi");
 
 
 
 
 
 
366
 
367
  $total_hits = 0;
368
 
@@ -376,18 +454,16 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
376
 
377
  $fuzzy = get_option('relevanssi_fuzzy');
378
 
379
- if ($expost) { //added by OdditY
380
- $query_restrictions .= $postex;
381
- }
382
-
383
  if (function_exists('relevanssi_negatives_positives')) {
384
  $query_restrictions .= relevanssi_negatives_positives($negative_terms, $positive_terms, $relevanssi_table);
 
385
  }
386
 
387
  if (!empty($author)) {
388
  $author_in = array();
389
  $author_not_in = array();
390
  foreach ($author as $id) {
 
391
  if ($id > 0) {
392
  $author_in[] = $id;
393
  }
@@ -399,23 +475,33 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
399
  $authors = implode(',', $author_in);
400
  $query_restrictions .= " AND relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM $wpdb->posts AS posts
401
  WHERE posts.post_author IN ($authors))";
 
402
  }
403
  if (count($author_not_in) > 0) {
404
  $authors = implode(',', $author_not_in);
405
  $query_restrictions .= " AND relevanssi.doc NOT IN (SELECT DISTINCT(posts.ID) FROM $wpdb->posts AS posts
406
  WHERE posts.post_author IN ($authors))";
 
407
  }
408
  }
409
 
410
  if ($post_type) {
411
  // the -1 is there to get user profiles and category pages
412
- $query_restrictions .= $wpdb->prepare(" AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM $wpdb->posts AS posts
413
- WHERE posts.post_type IN ($post_type))) OR (doc = -1))",
414
- $post_types);
 
 
 
 
 
 
 
415
  }
416
 
417
  if ($phrases) {
418
- $query_restrictions .= " AND relevanssi.doc IN ($phrases)";
 
419
  }
420
 
421
  if (isset($_REQUEST['by_date'])) {
@@ -447,6 +533,7 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
447
  if (is_numeric($n)) {
448
  $query_restrictions .= " AND relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM $wpdb->posts AS posts
449
  WHERE posts.post_date > DATE_SUB(NOW(), INTERVAL $n $unit))";
 
450
  }
451
  }
452
 
@@ -482,7 +569,19 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
482
  foreach ($terms as $term) {
483
  $term = trim($term); // numeric search terms will start with a space
484
  if (strlen($term) < $min_length) continue;
485
- $term = esc_sql(like_escape($term));
 
 
 
 
 
 
 
 
 
 
 
 
486
  $term_cond = str_replace('#term#', $term, $o_term_cond);
487
 
488
  !empty($post_type_weights['post_tag']) ? $tag = $post_type_weights['post_tag'] : $tag = $relevanssi_variables['post_type_weight_defaults']['post_tag'];
@@ -490,6 +589,8 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
490
 
491
  $query = "SELECT relevanssi.*, relevanssi.title * $title_boost + relevanssi.content + relevanssi.comment * $comment_boost + relevanssi.tag * $tag + relevanssi.link * $link_boost + relevanssi.author + relevanssi.category * $cat + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf
492
  FROM $relevanssi_table AS relevanssi $query_join WHERE $term_cond $query_restrictions";
 
 
493
  $query = apply_filters('relevanssi_query_filter', $query);
494
 
495
  $matches = $wpdb->get_results($query);
@@ -501,8 +602,14 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
501
  $no_matches = false;
502
  if (count($include_these_posts) > 0) {
503
  $post_ids_to_add = implode(',', array_keys($include_these_posts));
 
 
 
 
 
504
  $query = "SELECT relevanssi.*, relevanssi.title * $title_boost + relevanssi.content + relevanssi.comment * $comment_boost + relevanssi.tag * $tag + relevanssi.link * $link_boost + relevanssi.author + relevanssi.category * $cat + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf
505
- FROM $relevanssi_table AS relevanssi WHERE relevanssi.doc IN ($post_ids_to_add) AND $term_cond";
 
506
  $matches_to_add = $wpdb->get_results($query);
507
  $matches = array_merge($matches, $matches_to_add);
508
  }
@@ -514,6 +621,7 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
514
  $total_hits += count($matches);
515
 
516
  $query = "SELECT COUNT(DISTINCT(relevanssi.doc)) FROM $relevanssi_table AS relevanssi $query_join WHERE $term_cond $query_restrictions";
 
517
  $query = apply_filters('relevanssi_df_query_filter', $query);
518
 
519
  $df = $wpdb->get_var($query);
@@ -521,6 +629,7 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
521
  if ($df < 1 && "sometimes" == $fuzzy) {
522
  $query = "SELECT COUNT(DISTINCT(relevanssi.doc)) FROM $relevanssi_table AS relevanssi $query_join
523
  WHERE (relevanssi.term LIKE '$term%' OR relevanssi.term_reverse LIKE CONCAT(REVERSE('$term), %')) $query_restrictions";
 
524
  $query = apply_filters('relevanssi_df_query_filter', $query);
525
  $df = $wpdb->get_var($query);
526
  }
@@ -531,9 +640,8 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
531
  if ('user' == $match->type) {
532
  $match->doc = 'u_' . $match->item;
533
  }
534
-
535
- if ('taxonomy' == $match->type) {
536
- $match->doc = 't_' . $match->item;
537
  }
538
 
539
  if (isset($match->taxonomy_detail)) {
@@ -586,11 +694,11 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
586
  $match->weight = $match->weight * $recency_bonus['bonus'];
587
  }
588
 
589
- $body_matches[$match->doc] = $match->content;
590
- $title_matches[$match->doc] = $match->title;
591
- $link_matches[$match->doc] = $match->link;
592
- $tag_matches[$match->doc] = $match->tag;
593
- $comment_matches[$match->doc] = $match->comment;
594
 
595
  isset($relevanssi_post_types[$match->doc]) ? $type = $relevanssi_post_types[$match->doc] : $type = null;
596
  if (!empty($post_type_weights[$type])) {
@@ -656,7 +764,7 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
656
  // doc didn't match all terms, so it's discarded
657
  continue;
658
  }
659
-
660
  $hits[intval($i)] = relevanssi_get_post($doc);
661
  $hits[intval($i)]->relevance_score = round($weight, 2);
662
  $i++;
@@ -665,10 +773,10 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
665
 
666
  if (count($hits) < 1) {
667
  if ($operator == "AND" AND get_option('relevanssi_disable_or_fallback') != 'on') {
668
- $return = relevanssi_search($q, $o_tax_query, $o_relation,
669
- $o_post_query, $o_meta_query,
670
- $o_expost, $o_post_type,
671
- "OR", $o_search_blogs, $o_author);
672
  extract($return);
673
  }
674
  }
@@ -683,6 +791,9 @@ function relevanssi_search($q, $tax_query = NULL, $relation = NULL, $post_query
683
  $order_accepted_values = array('asc', 'desc');
684
  if (!in_array($order, $order_accepted_values)) $order = 'desc';
685
 
 
 
 
686
  if ($orderby != 'relevance')
687
  relevanssi_object_sort($hits, $orderby, $order);
688
 
@@ -706,9 +817,6 @@ function relevanssi_do_query(&$query) {
706
  else
707
  $q = trim(stripslashes(strtolower($query->query_vars["s"])));
708
 
709
- $cache = get_option('relevanssi_enable_cache');
710
- $cache == 'on' ? $cache = true : $cache = false;
711
-
712
  if (isset($query->query_vars['searchblogs'])) {
713
  $search_blogs = $query->query_vars['searchblogs'];
714
 
@@ -830,6 +938,10 @@ function relevanssi_do_query(&$query) {
830
  if (!empty($query->query_vars['tag_slug__and'])) {
831
  $tax_query[] = array('taxonomy' => 'post_tag', 'field' => 'slug', 'terms' => $query->query_vars['tag_slug__and'], 'operator' => 'AND');
832
  }
 
 
 
 
833
 
834
  if (isset($query->query_vars["taxonomy"])) {
835
  if (function_exists('relevanssi_process_taxonomies')) {
@@ -853,6 +965,12 @@ function relevanssi_do_query(&$query) {
853
  }
854
 
855
  $post_query = array();
 
 
 
 
 
 
856
  if (!empty($query->query_vars['post__in'])) {
857
  $post_query = array('in' => $query->query_vars['post__in']);
858
  }
@@ -880,7 +998,15 @@ function relevanssi_do_query(&$query) {
880
  $meta_query[] = array('key' => $query->query_vars["meta_key"], 'value' => $value, 'compare' => $compare);
881
  }
882
 
883
-
 
 
 
 
 
 
 
 
884
  $search_blogs = false;
885
  if (isset($query->query_vars["search_blogs"])) {
886
  $search_blogs = $query->query_vars["search_blogs"];
@@ -895,13 +1021,19 @@ function relevanssi_do_query(&$query) {
895
  }
896
 
897
  if ($post_type == -1) $post_type = false;
898
-
899
- $expids = get_option("relevanssi_exclude_posts");
 
 
 
 
 
900
 
901
  if (is_admin()) {
902
  // in admin search, search everything
903
  $excat = null;
904
- $expids = null;
 
905
  }
906
 
907
  $operator = "";
@@ -921,29 +1053,23 @@ function relevanssi_do_query(&$query) {
921
  $q = relevanssi_add_synonyms($q);
922
  }
923
 
924
- if ($cache) {
925
- $params = md5(serialize(array($q, $tax_query, $tax_query_relation, $post_query, $meta_query, $expids, $post_type, $operator, $search_blogs, $author, $orderby, $order)));
926
- $return = relevanssi_fetch_hits($params);
927
- if (!$return) {
928
- $return = relevanssi_search($q, $tax_query, $tax_query_relation, $post_query, $meta_query, $expids, $post_type, $operator, $search_blogs, $author, $orderby, $order);
929
- $return_ser = serialize($return);
930
- relevanssi_store_hits($params, $return_ser);
931
- }
932
- }
933
- else {
934
- $return = relevanssi_search($q,
935
- $tax_query,
936
- $tax_query_relation,
937
- $post_query,
938
- $meta_query,
939
- $expids,
940
- $post_type,
941
- $operator,
942
- $search_blogs,
943
- $author,
944
- $orderby,
945
- $order);
946
- }
947
  }
948
 
949
  isset($return['hits']) ? $hits = $return['hits'] : $hits = array();
@@ -1010,35 +1136,27 @@ function relevanssi_do_query(&$query) {
1010
  //Added by OdditY - Highlight Result Title too ->
1011
  if("on" == get_option('relevanssi_hilite_title')){
1012
  if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
1013
- $post->post_title = strip_tags(qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($post->post_title));
1014
  }
1015
  else {
1016
- $post->post_title = strip_tags($post->post_title);
1017
  }
1018
  $highlight = get_option('relevanssi_highlight');
1019
  if ("none" != $highlight) {
1020
  if (!is_admin()) {
1021
- $post->post_title = relevanssi_highlight_terms($post->post_title, $q);
1022
  }
1023
  }
1024
  }
1025
- // OdditY end <-
1026
 
1027
  if ('on' == $make_excerpts) {
1028
- if ($cache) {
1029
- $post->post_excerpt = relevanssi_fetch_excerpt($post->ID, $q);
1030
- if ($post->post_excerpt == null) {
1031
- $post->post_excerpt = relevanssi_do_excerpt($post, $q);
1032
- relevanssi_store_excerpt($post->ID, $q, $post->post_excerpt);
1033
- }
1034
- }
1035
- else {
1036
- $post->post_excerpt = relevanssi_do_excerpt($post, $q);
1037
- }
1038
 
1039
- if ('on' == get_option('relevanssi_show_matches')) {
1040
- $post->post_excerpt .= relevanssi_show_matches($return, $post->ID);
1041
- }
1042
  }
1043
 
1044
  if (isset($return['scores'][$post->ID])) $post->relevance_score = round($return['scores'][$post->ID], 2);
46
  }
47
 
48
  // This is my own magic working.
49
+ function relevanssi_search($args) {
50
  global $wpdb, $relevanssi_variables;
51
  $relevanssi_table = $relevanssi_variables['relevanssi_table'];
52
+
53
+ $filtered_args = apply_filters( 'relevanssi_search_filters', $args );
54
+ extract($filtered_args);
55
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  $hits = array();
57
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  $query_restrictions = "";
59
+ if (!isset($tax_query_relation)) $tax_query_relation = "or";
60
+ $tax_query_relation = strtolower($tax_query_relation);
61
  $term_tax_id = array();
62
  $term_tax_ids = array();
63
  $not_term_tax_ids = array();
64
  $and_term_tax_ids = array();
65
+
66
  if (is_array($tax_query)) {
67
  foreach ($tax_query as $row) {
 
 
 
 
 
 
 
 
 
 
 
68
  if ($row['field'] == 'slug') {
69
  $slug = $row['terms'];
70
+ $numeric_slugs = array();
71
+ $slug_in = null;
72
  if (is_array($slug)) {
73
  $slugs = array();
74
  $term_id = array();
75
  foreach ($slug as $t_slug) {
76
  $term = get_term_by('slug', $t_slug, $row['taxonomy']);
77
+ if (!$term && is_numeric($t_slug)) {
78
+ $numeric_slugs[] = "'$t_slug'";
79
+ }
80
+ else {
81
+ $t_slug = sanitize_title($t_slug);
82
+ $term_id[] = $term->term_id;
83
+ $slugs[] = "'$t_slug'";
84
+ }
85
  }
86
+ if (!empty($slugs)) $slug_in = implode(',', $slugs);
87
  }
88
  else {
89
  $term = get_term_by('slug', $slug, $row['taxonomy']);
90
+ if (!$term && is_numeric($slug)) {
91
+ $numeric_slugs[] = $slug;
92
+ }
93
+ else {
94
+ $term_id = $term->term_id;
95
+ $slug_in = "'$slug'";
96
+ }
97
+ }
98
+ if (!empty($slug_in)) {
99
+ $row_taxonomy = sanitize_title($row['taxonomy']);
100
+ $tt_q = "SELECT tt.term_taxonomy_id
101
+ FROM $wpdb->term_taxonomy AS tt
102
+ LEFT JOIN $wpdb->terms AS t ON (tt.term_id=t.term_id)
103
+ WHERE tt.taxonomy = '$row_taxonomy' AND t.slug IN ($slug_in)";
104
+ // Clean: $row_taxonomy is sanitized, each slug in $slug_in is sanitized
105
+ $term_tax_id = $wpdb->get_col($tt_q);
106
+ }
107
+ if (!empty($numeric_slugs)) $row['field'] = 'id';
108
+ }
109
+ if ($row['field'] == 'id' || $row['field'] == 'term_id') {
110
+ $id = $row['terms'];
111
+ $term_id = $id;
112
+ if (is_array($id)) {
113
+ $numeric_values = array();
114
+ foreach ($id as $t_id) {
115
+ if (is_numeric($t_id)) $numeric_values[] = $t_id;
116
+ }
117
+ $id = implode(',', $numeric_values);
118
+ }
119
+ $row_taxonomy = sanitize_title($row['taxonomy']);
120
+ $tt_q = "SELECT tt.term_taxonomy_id
121
+ FROM $wpdb->term_taxonomy AS tt
122
+ LEFT JOIN $wpdb->terms AS t ON (tt.term_id=t.term_id)
123
+ WHERE tt.taxonomy = '$row_taxonomy' AND t.term_id IN ($id)";
124
+ // Clean: $row_taxonomy is sanitized, $id is checked to be numeric
125
+ $id_term_tax_id = $wpdb->get_col($tt_q);
126
+ if (!empty($term_tax_id) && is_array($term_tax_id)) {
127
+ $term_tax_id = array_unique(array_merge($term_tax_id, $id_term_tax_id));
128
+ }
129
+ else {
130
+ $term_tax_id = $id_term_tax_id;
131
  }
 
 
 
 
132
  }
133
 
134
  if (!isset($row['include_children']) || $row['include_children'] == true) {
152
  $tq_operator = 'IN';
153
  if (isset($row['operator'])) $tq_operator = strtoupper($row['operator']);
154
  if ($tq_operator != 'IN' && $tq_operator != 'NOT IN' && $tq_operator != 'AND') $tq_operator = 'IN';
155
+ if ($tax_query_relation == 'and') {
156
  if ($tq_operator == 'AND') {
157
  $query_restrictions .= " AND relevanssi.doc IN (
158
  SELECT ID FROM $wpdb->posts WHERE 1=1
162
  WHERE tr.term_taxonomy_id IN ($term_tax_id)
163
  AND tr.object_id = $wpdb->posts.ID ) = $n
164
  )";
165
+ // Clean: $term_tax_id and $n are Relevanssi-generated
166
  }
167
  else {
168
  $query_restrictions .= " AND relevanssi.doc $tq_operator (SELECT DISTINCT(tr.object_id) FROM $wpdb->term_relationships AS tr
169
  WHERE tr.term_taxonomy_id IN ($term_tax_id))";
170
+ // Clean: all variables are Relevanssi-generated
171
  }
172
  }
173
  else {
181
  $wp_query->is_category = false;
182
  }
183
  }
184
+ if ($tax_query_relation == 'or') {
185
  $term_tax_ids = array_unique($term_tax_ids);
186
  if (count($term_tax_ids) > 0) {
187
  $term_tax_ids = implode(',', $term_tax_ids);
188
  $query_restrictions .= " AND relevanssi.doc IN (SELECT DISTINCT(tr.object_id) FROM $wpdb->term_relationships AS tr
189
  WHERE tr.term_taxonomy_id IN ($term_tax_ids))";
190
+ // Clean: all variables are Relevanssi-generated
191
  }
192
  if (count($not_term_tax_ids) > 0) {
193
  $not_term_tax_ids = implode(',', $not_term_tax_ids);
194
  $query_restrictions .= " AND relevanssi.doc NOT IN (SELECT DISTINCT(tr.object_id) FROM $wpdb->term_relationships AS tr
195
  WHERE tr.term_taxonomy_id IN ($not_term_tax_ids))";
196
+ // Clean: all variables are Relevanssi-generated
197
  }
198
  if (count($and_term_tax_ids) > 0) {
199
  $and_term_tax_ids = implode(',', $and_term_tax_ids);
200
  $n = count(explode(',', $and_term_tax_ids));
201
  $query_restrictions .= " AND relevanssi.doc IN (
202
+ SELECT ID FROM $wpdb->posts WHERE 1=1
203
  AND (
204
  SELECT COUNT(1)
205
  FROM $wpdb->term_relationships AS tr
206
  WHERE tr.term_taxonomy_id IN ($and_term_tax_ids)
207
  AND tr.object_id = $wpdb->posts.ID ) = $n
208
  )";
209
+ // Clean: all variables are Relevanssi-generated
210
  }
211
  }
212
  }
213
 
214
  if (is_array($post_query)) {
215
  if (!empty($post_query['in'])) {
216
+ $valid_values = array();
217
+ foreach($post_query['in'] as $post_in_id) {
218
+ if (is_numeric($post_in_id)) $valid_values[] = $post_in_id;
219
+ }
220
+ $posts = implode(',', $valid_values);
221
+ if (!empty($posts)) $query_restrictions .= " AND relevanssi.doc IN ($posts)";
222
+ // Clean: $posts is checked to be integers
223
  }
224
  if (!empty($post_query['not in'])) {
225
+ $valid_values = array();
226
+ foreach($post_query['not in'] as $post_not_in_id) {
227
+ if (is_numeric($post_not_in_id)) $valid_values[] = $post_not_in_id;
228
+ }
229
+ $posts = implode(',', $valid_values);
230
+ if (!empty($posts)) $query_restrictions .= " AND relevanssi.doc NOT IN ($posts)";
231
+ // Clean: $posts is checked to be integers
232
  }
233
  }
234
 
235
  if (is_array($meta_query)) {
236
  isset($meta_query['relation']) ? $meta_relation = strtoupper($meta_query['relation']) : $meta_relation = strtoupper(apply_filters('relevanssi_default_meta_query_relation', 'AND'));
237
+ if ($meta_relation != 'AND' && $meta_relation != 'OR') $meta_relation = "AND";
238
+ // legal values: AND and OR
239
+
240
  $meta_query_restrictions = "";
241
  foreach ($meta_query as $array_key => $meta) {
242
  if ($array_key === 'relation') {
244
  }
245
 
246
  if (!empty($meta['key'])) {
247
+ $key = "postmeta.meta_key = '" . esc_sql($meta['key']) . "'";
248
  }
249
  else {
250
  $key = '';
254
 
255
  if (isset($meta['type'])) {
256
  if (strtoupper($meta['type']) == 'NUMERIC') $meta['type'] = "SIGNED";
257
+ if (!in_array(strtoupper($meta['type']), array('NUMERIC', 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED'))) {
258
+ // illegal value
259
+ $meta_value = 'postmeta.meta_value';
260
+ }
261
+ else {
262
+ // legal value
263
+ $meta_value = "CAST(postmeta.meta_value AS " . $meta['type'] . ")";
264
+ }
265
  }
266
  else {
267
  $meta_value = 'postmeta.meta_value';
271
  if (!is_array($meta['value'])) continue;
272
  if (count($meta['value']) < 2) continue;
273
  $compare == 'BETWEEN' ? $compare = "IN" : $compare = "NOT IN";
274
+ $low_value = esc_sql($meta['value'][0]);
275
+ $high_value = esc_sql($meta['value'][1]);
276
+ // No need to check that low is lower than high, because the meta query
277
+ // doesn't work, if the values are wrong.
278
+
279
  !empty($key) ? $and = " AND " : $and = "";
280
  $meta_query_restrictions .= " $meta_relation relevanssi.doc $compare (
281
  SELECT DISTINCT(postmeta.post_id) FROM $wpdb->postmeta AS postmeta
282
  WHERE $key $and $meta_value BETWEEN $low_value AND $high_value)";
283
+ // Clean: values either Relevanssi-generated or escaped
284
  }
285
  else if ($compare == 'EXISTS' || $compare == 'NOT EXISTS') {
286
  $compare == 'EXISTS' ? $compare = "IN" : $compare = "NOT IN";
287
  $meta_query_restrictions .= " $meta_relation relevanssi.doc $compare (
288
  SELECT DISTINCT(postmeta.post_id) FROM $wpdb->postmeta AS postmeta
289
  WHERE $key)";
290
+ // Clean: values either Relevanssi-generated or escaped
291
  }
292
  else if ($compare == 'IN' || $compare == 'NOT IN') {
293
  if (!is_array($meta['value'])) continue;
294
  $values = array();
295
  foreach ($meta['value'] as $value) {
296
+ $value = esc_sql($value);
297
  $values[] = "'$value'";
298
  }
299
  $values = implode(',', $values);
301
  $meta_query_restrictions .= " $meta_relation relevanssi.doc IN (
302
  SELECT DISTINCT(postmeta.post_id) FROM $wpdb->postmeta AS postmeta
303
  WHERE $key $and $meta_value $compare ($values))";
304
+ // Clean: values either Relevanssi-generated or escaped
305
+ }
306
+ else if ($compare == 'LIKE') {
307
+ if (method_exists($wpdb, 'esc_like')) {
308
+ $escaped_value = $wpdb->esc_like($meta['value']);
309
+ }
310
+ else {
311
+ // Compatibility for pre-4.0 WordPress
312
+ $escaped_value = like_escape($meta['value']);
313
+ }
314
+ isset($meta['value']) ? $value = " " . esc_sql($meta_value) . " " . $meta['compare'] . " '%" . $escaped_value . "%' " : $value = '';
315
+ (!empty($key) && !empty($value)) ? $and = " AND " : $and = "";
316
+ if (empty($key) && empty($and) && empty($value)) {
317
+ // do nothing
318
+ }
319
+ else {
320
+ $meta_query_restrictions .= " $meta_relation relevanssi.doc IN (
321
+ SELECT DISTINCT(postmeta.post_id) FROM $wpdb->postmeta AS postmeta
322
+ WHERE $key $and $value)";
323
+ // Clean: values either Relevanssi-generated or escaped
324
+ }
325
  }
326
  else {
327
+ isset($meta['value']) ? $value = " " . esc_sql($meta_value) . " " . $meta['compare'] . " '" . esc_sql($meta['value']) . "' " : $value = '';
328
  (!empty($key) && !empty($value)) ? $and = " AND " : $and = "";
329
  if (empty($key) && empty($and) && empty($value)) {
330
  // do nothing
333
  $meta_query_restrictions .= " $meta_relation relevanssi.doc IN (
334
  SELECT DISTINCT(postmeta.post_id) FROM $wpdb->postmeta AS postmeta
335
  WHERE $key $and $value)";
336
+ // Clean: values either Relevanssi-generated or escaped
337
  }
338
  }
339
  }
345
  $query_restrictions .= $meta_query_restrictions;
346
  }
347
 
348
+ if (!empty($date_query)) {
349
+ if (is_object($date_query) && method_exists($date_query, 'get_sql')) {
350
+ $sql = $date_query->get_sql(); // AND ( the query itself )
351
+ $query_restrictions .= " AND relevanssi.doc IN ( SELECT DISTINCT(ID) FROM $wpdb->posts WHERE 1 $sql )";
352
+ // Clean: $sql generated by $date_query->get_sql() query
353
+ }
354
+ }
355
+
356
  if (!$post_type && get_option('relevanssi_respect_exclude') == 'on') {
357
  if (function_exists('get_post_types')) {
358
  $pt_1 = get_post_types(array('exclude_from_search' => '0'));
364
  if ($post_type) {
365
  if ($post_type == -1) $post_type = null; // Facetious sets post_type to -1 if not selected
366
  if (!is_array($post_type)) {
367
+ $post_types = esc_sql(explode(',', $post_type));
368
  }
369
  else {
370
+ $post_types = esc_sql($post_type);
371
  }
372
+ $post_type = count($post_types) ? "'" . implode( "', '", $post_types) . "'" : 'NULL';
373
+ }
374
 
375
+ if ($post_status) {
376
+ if (!is_array($post_status)) {
377
+ $post_statuses = esc_sql(explode(',', $post_status));
378
+ }
379
+ else {
380
+ $post_statuses = esc_sql($post_status);
381
+ }
382
+
383
+ $post_status = count($post_statuses) ? "'" . implode( "', '", $post_statuses) . "'" : 'NULL';
384
  }
385
 
386
  //Added by OdditY:
387
  //Exclude Post_IDs (Pages) for non-admin search ->
388
  $postex = '';
389
+ if (!empty($expost)) {
390
  if ($expost != "") {
391
  $aexpids = explode(",",$expost);
392
  foreach ($aexpids as $exid){
393
  $exid = esc_sql(trim($exid, ' -'));
394
+ $postex .= " AND relevanssi.doc != '$exid'";
395
+ // Clean: escaped
396
  }
397
  }
398
  }
399
  // <- OdditY End
400
 
401
+ if ($expost) { //added by OdditY
402
+ $query_restrictions .= $postex;
403
+ }
404
+
405
  $remove_stopwords = true;
406
  $phrases = relevanssi_recognize_phrases($q);
407
 
434
  }
435
  }
436
 
437
+ // Go get the count from the options table, but keep running the full query if it's not available
438
+ $D = get_option('relevanssi_doc_count');
439
+ if (!$D || $D < 1) {
440
+ $D = $wpdb->get_var("SELECT COUNT(DISTINCT(relevanssi.doc)) FROM $relevanssi_table AS relevanssi");
441
+ // Clean: no external inputs
442
+ update_option('relevanssi_doc_count', $D);
443
+ }
444
 
445
  $total_hits = 0;
446
 
454
 
455
  $fuzzy = get_option('relevanssi_fuzzy');
456
 
 
 
 
 
457
  if (function_exists('relevanssi_negatives_positives')) {
458
  $query_restrictions .= relevanssi_negatives_positives($negative_terms, $positive_terms, $relevanssi_table);
459
+ // Clean: escaped in the function
460
  }
461
 
462
  if (!empty($author)) {
463
  $author_in = array();
464
  $author_not_in = array();
465
  foreach ($author as $id) {
466
+ if (!is_numeric($id)) continue;
467
  if ($id > 0) {
468
  $author_in[] = $id;
469
  }
475
  $authors = implode(',', $author_in);
476
  $query_restrictions .= " AND relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM $wpdb->posts AS posts
477
  WHERE posts.post_author IN ($authors))";
478
+ // Clean: $authors is always just numbers
479
  }
480
  if (count($author_not_in) > 0) {
481
  $authors = implode(',', $author_not_in);
482
  $query_restrictions .= " AND relevanssi.doc NOT IN (SELECT DISTINCT(posts.ID) FROM $wpdb->posts AS posts
483
  WHERE posts.post_author IN ($authors))";
484
+ // Clean: $authors is always just numbers
485
  }
486
  }
487
 
488
  if ($post_type) {
489
  // the -1 is there to get user profiles and category pages
490
+ $query_restrictions .= " AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM $wpdb->posts AS posts
491
+ WHERE posts.post_type IN ($post_type))) OR (doc = -1))";
492
+ // Clean: $post_type is escaped
493
+ }
494
+
495
+ if ($post_status) {
496
+ // the -1 is there to get user profiles and category pages
497
+ $query_restrictions .= " AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM $wpdb->posts AS posts
498
+ WHERE posts.post_status IN ($post_status))) OR (doc = -1))";
499
+ // Clean: $post_status is escaped
500
  }
501
 
502
  if ($phrases) {
503
+ $query_restrictions .= " $phrases";
504
+ // Clean: $phrases is escaped earlier
505
  }
506
 
507
  if (isset($_REQUEST['by_date'])) {
533
  if (is_numeric($n)) {
534
  $query_restrictions .= " AND relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM $wpdb->posts AS posts
535
  WHERE posts.post_date > DATE_SUB(NOW(), INTERVAL $n $unit))";
536
+ // Clean: $n is always numeric, $unit is Relevanssi-generated
537
  }
538
  }
539
 
569
  foreach ($terms as $term) {
570
  $term = trim($term); // numeric search terms will start with a space
571
  if (strlen($term) < $min_length) continue;
572
+ $term = esc_sql($term);
573
+
574
+ if (strpos($o_term_cond, 'LIKE') !== false) {
575
+ // only like_escape() if necessary, otherwise _ in search terms will not work
576
+ if (method_exists($wpdb, 'esc_like')) {
577
+ $term = $wpdb->esc_like($term);
578
+ }
579
+ else {
580
+ // Compatibility for pre-4.0 WordPress
581
+ $term = like_escape($term);
582
+ }
583
+ }
584
+
585
  $term_cond = str_replace('#term#', $term, $o_term_cond);
586
 
587
  !empty($post_type_weights['post_tag']) ? $tag = $post_type_weights['post_tag'] : $tag = $relevanssi_variables['post_type_weight_defaults']['post_tag'];
589
 
590
  $query = "SELECT relevanssi.*, relevanssi.title * $title_boost + relevanssi.content + relevanssi.comment * $comment_boost + relevanssi.tag * $tag + relevanssi.link * $link_boost + relevanssi.author + relevanssi.category * $cat + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf
591
  FROM $relevanssi_table AS relevanssi $query_join WHERE $term_cond $query_restrictions";
592
+ // Clean: $query_restrictions is escaped, $term_cond is escaped
593
+
594
  $query = apply_filters('relevanssi_query_filter', $query);
595
 
596
  $matches = $wpdb->get_results($query);
602
  $no_matches = false;
603
  if (count($include_these_posts) > 0) {
604
  $post_ids_to_add = implode(',', array_keys($include_these_posts));
605
+ $existing_ids = array();
606
+ foreach ($matches as $match) {
607
+ $existing_ids[] = $match->doc;
608
+ }
609
+ $existing_ids = implode(',', $existing_ids);
610
  $query = "SELECT relevanssi.*, relevanssi.title * $title_boost + relevanssi.content + relevanssi.comment * $comment_boost + relevanssi.tag * $tag + relevanssi.link * $link_boost + relevanssi.author + relevanssi.category * $cat + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf
611
+ FROM $relevanssi_table AS relevanssi WHERE relevanssi.doc IN ($post_ids_to_add) AND relevanssi.doc NOT IN ($existing_ids) AND $term_cond";
612
+ // Clean: no unescaped user inputs
613
  $matches_to_add = $wpdb->get_results($query);
614
  $matches = array_merge($matches, $matches_to_add);
615
  }
621
  $total_hits += count($matches);
622
 
623
  $query = "SELECT COUNT(DISTINCT(relevanssi.doc)) FROM $relevanssi_table AS relevanssi $query_join WHERE $term_cond $query_restrictions";
624
+ // Clean: $query_restrictions is escaped, $term_cond is escaped
625
  $query = apply_filters('relevanssi_df_query_filter', $query);
626
 
627
  $df = $wpdb->get_var($query);
629
  if ($df < 1 && "sometimes" == $fuzzy) {
630
  $query = "SELECT COUNT(DISTINCT(relevanssi.doc)) FROM $relevanssi_table AS relevanssi $query_join
631
  WHERE (relevanssi.term LIKE '$term%' OR relevanssi.term_reverse LIKE CONCAT(REVERSE('$term), %')) $query_restrictions";
632
+ // Clean: $query_restrictions is escaped, $term is escaped
633
  $query = apply_filters('relevanssi_df_query_filter', $query);
634
  $df = $wpdb->get_var($query);
635
  }
640
  if ('user' == $match->type) {
641
  $match->doc = 'u_' . $match->item;
642
  }
643
+ else if (!in_array($match->type, array('post', 'attachment'))) {
644
+ $match->doc = '**' . $match->type . '**' . $match->item;
 
645
  }
646
 
647
  if (isset($match->taxonomy_detail)) {
694
  $match->weight = $match->weight * $recency_bonus['bonus'];
695
  }
696
 
697
+ isset($body_matches[$match->doc]) ? $body_matches[$match->doc] += $match->content : $body_matches[$match->doc] = $match->content;
698
+ isset($title_matches[$match->doc]) ? $title_matches[$match->doc] += $match->title : $title_matches[$match->doc] = $match->title;
699
+ isset($link_matches[$match->doc]) ? $link_matches[$match->doc] += $match->link : $link_matches[$match->doc] = $match->link;
700
+ isset($tag_matches[$match->doc]) ? $tag_matches[$match->doc] += $match->tag : $tag_matches[$match->doc] = $match->tag;
701
+ isset($comment_matches[$match->doc]) ? $comment_matches[$match->doc] += $match->comment : $comment_matches[$match->doc] = $match->comment;
702
 
703
  isset($relevanssi_post_types[$match->doc]) ? $type = $relevanssi_post_types[$match->doc] : $type = null;
704
  if (!empty($post_type_weights[$type])) {
764
  // doc didn't match all terms, so it's discarded
765
  continue;
766
  }
767
+
768
  $hits[intval($i)] = relevanssi_get_post($doc);
769
  $hits[intval($i)]->relevance_score = round($weight, 2);
770
  $i++;
773
 
774
  if (count($hits) < 1) {
775
  if ($operator == "AND" AND get_option('relevanssi_disable_or_fallback') != 'on') {
776
+ $or_args = $args;
777
+ $or_args['operator'] = "OR";
778
+ $or_args['q'] = relevanssi_add_synonyms($q);
779
+ $return = relevanssi_search($or_args);
780
  extract($return);
781
  }
782
  }
791
  $order_accepted_values = array('asc', 'desc');
792
  if (!in_array($order, $order_accepted_values)) $order = 'desc';
793
 
794
+ $orderby = apply_filters('relevanssi_orderby', $orderby);
795
+ $order = apply_filters('relevanssi_order', $order);
796
+
797
  if ($orderby != 'relevance')
798
  relevanssi_object_sort($hits, $orderby, $order);
799
 
817
  else
818
  $q = trim(stripslashes(strtolower($query->query_vars["s"])));
819
 
 
 
 
820
  if (isset($query->query_vars['searchblogs'])) {
821
  $search_blogs = $query->query_vars['searchblogs'];
822
 
938
  if (!empty($query->query_vars['tag_slug__and'])) {
939
  $tax_query[] = array('taxonomy' => 'post_tag', 'field' => 'slug', 'terms' => $query->query_vars['tag_slug__and'], 'operator' => 'AND');
940
  }
941
+ $extag = get_option('relevanssi_extag');
942
+ if (isset($extag) && $extag != 0) {
943
+ $tax_query[] = array('taxonomy' => 'post_tag', 'field' => 'id', 'terms' => $extag, 'operator' => 'NOT IN');
944
+ }
945
 
946
  if (isset($query->query_vars["taxonomy"])) {
947
  if (function_exists('relevanssi_process_taxonomies')) {
965
  }
966
 
967
  $post_query = array();
968
+ if (!empty($query->query_vars['p'])) {
969
+ $post_query = array('in' => array($query->query_vars['p']));
970
+ }
971
+ if (!empty($query->query_vars['page_id'])) {
972
+ $post_query = array('in' => array($query->query_vars['page_id']));
973
+ }
974
  if (!empty($query->query_vars['post__in'])) {
975
  $post_query = array('in' => $query->query_vars['post__in']);
976
  }
998
  $meta_query[] = array('key' => $query->query_vars["meta_key"], 'value' => $value, 'compare' => $compare);
999
  }
1000
 
1001
+ $date_query = false;
1002
+ if (!empty($query->date_query)) {
1003
+ if (is_object($query->date_query) && get_class($query->date_query) == 'WP_Date_Query') { // there is no is_WP_Date_Query_Object() function
1004
+ $date_query = $query->date_query;
1005
+ } else {
1006
+ $date_query = new WP_Date_Query($query->date_query);
1007
+ }
1008
+ }
1009
+
1010
  $search_blogs = false;
1011
  if (isset($query->query_vars["search_blogs"])) {
1012
  $search_blogs = $query->query_vars["search_blogs"];
1021
  }
1022
 
1023
  if ($post_type == -1) $post_type = false;
1024
+
1025
+ $post_status = false;
1026
+ if (isset($query->query_vars["post_status"]) && $query->query_vars["post_status"] != 'any') {
1027
+ $post_status = $query->query_vars["post_status"];
1028
+ }
1029
+
1030
+ $expost = get_option("relevanssi_exclude_posts");
1031
 
1032
  if (is_admin()) {
1033
  // in admin search, search everything
1034
  $excat = null;
1035
+ $extag = null;
1036
+ $expost = null;
1037
  }
1038
 
1039
  $operator = "";
1053
  $q = relevanssi_add_synonyms($q);
1054
  }
1055
 
1056
+ $search_params = array(
1057
+ 'q' => $q,
1058
+ 'tax_query' => $tax_query,
1059
+ 'tax_query_relation' => $tax_query_relation,
1060
+ 'post_query' => $post_query,
1061
+ 'meta_query' => $meta_query,
1062
+ 'date_query' => $date_query,
1063
+ 'expost' => $expost,
1064
+ 'post_type' => $post_type,
1065
+ 'post_status' => $post_status,
1066
+ 'operator' => $operator,
1067
+ 'search_blogs' => $search_blogs,
1068
+ 'author' => $author,
1069
+ 'orderby' => $orderby,
1070
+ 'order' => $order);
1071
+
1072
+ $return = relevanssi_search($search_params);
 
 
 
 
 
 
1073
  }
1074
 
1075
  isset($return['hits']) ? $hits = $return['hits'] : $hits = array();
1136
  //Added by OdditY - Highlight Result Title too ->
1137
  if("on" == get_option('relevanssi_hilite_title')){
1138
  if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
1139
+ $post->post_highlighted_title = strip_tags(qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($post->post_title));
1140
  }
1141
  else {
1142
+ $post->post_highlighted_title = strip_tags($post->post_title);
1143
  }
1144
  $highlight = get_option('relevanssi_highlight');
1145
  if ("none" != $highlight) {
1146
  if (!is_admin()) {
1147
+ $post->post_highlighted_title = relevanssi_highlight_terms($post->post_highlighted_title, $q);
1148
  }
1149
  }
1150
  }
1151
+ // OdditY end <-
1152
 
1153
  if ('on' == $make_excerpts) {
1154
+ $post->original_excerpt = $post->post_excerpt;
1155
+ $post->post_excerpt = relevanssi_do_excerpt($post, $q);
1156
+ }
 
 
 
 
 
 
 
1157
 
1158
+ if ('on' == get_option('relevanssi_show_matches')) {
1159
+ $post->post_excerpt .= relevanssi_show_matches($return, $post->ID);
 
1160
  }
1161
 
1162
  if (isset($return['scores'][$post->ID])) $post->relevance_score = round($return['scores'][$post->ID], 2);
lib/stopwords.php CHANGED
@@ -4,12 +4,11 @@
4
  function relevanssi_populate_stopwords() {
5
  global $wpdb, $relevanssi_variables;
6
 
7
- if (WPLANG == '') {
8
- $lang = "en_GB";
9
- }
10
- else {
11
  $lang = WPLANG;
12
  }
 
13
 
14
  if (file_exists($relevanssi_variables['plugin_dir'] . 'stopwords/stopwords.' . $lang)) {
15
  include($relevanssi_variables['plugin_dir'] . 'stopwords/stopwords.' . $lang);
4
  function relevanssi_populate_stopwords() {
5
  global $wpdb, $relevanssi_variables;
6
 
7
+ $lang = get_option('WPLANG');
8
+ if (empty($lang) && WPLANG != '') {
 
 
9
  $lang = WPLANG;
10
  }
11
+ if (empty($lang)) $lang = "en_GB";
12
 
13
  if (file_exists($relevanssi_variables['plugin_dir'] . 'stopwords/stopwords.' . $lang)) {
14
  include($relevanssi_variables['plugin_dir'] . 'stopwords/stopwords.' . $lang);
lib/uninstall.php CHANGED
@@ -10,8 +10,6 @@ function relevanssi_clear_database_tables() {
10
  $relevanssi_table = $wpdb->prefix . "relevanssi";
11
  $stopword_table = $wpdb->prefix . "relevanssi_stopwords";
12
  $log_table = $wpdb->prefix . "relevanssi_log";
13
- $relevanssi_cache = $wpdb->prefix . 'relevanssi_cache';
14
- $relevanssi_excerpt_cache = $wpdb->prefix . 'relevanssi_excerpt_cache';
15
 
16
  if($wpdb->get_var("SHOW TABLES LIKE '$stopword_table'") == $stopword_table) {
17
  $sql = "DROP TABLE $stopword_table";
@@ -28,16 +26,6 @@ function relevanssi_clear_database_tables() {
28
  $wpdb->query($sql);
29
  }
30
 
31
- if($wpdb->get_var("SHOW TABLES LIKE '$relevanssi_cache'") == $relevanssi_cache) {
32
- $sql = "DROP TABLE $relevanssi_cache";
33
- $wpdb->query($sql);
34
- }
35
-
36
- if($wpdb->get_var("SHOW TABLES LIKE '$relevanssi_excerpt_cache'") == $relevanssi_excerpt_cache) {
37
- $sql = "DROP TABLE $relevanssi_excerpt_cache";
38
- $wpdb->query($sql);
39
- }
40
-
41
  echo '<div id="message" class="updated fade"><p>' . __("Data wiped clean, you can now delete the plugin.", "relevanssi") . '</p></div>';
42
  }
43
 
10
  $relevanssi_table = $wpdb->prefix . "relevanssi";
11
  $stopword_table = $wpdb->prefix . "relevanssi_stopwords";
12
  $log_table = $wpdb->prefix . "relevanssi_log";
 
 
13
 
14
  if($wpdb->get_var("SHOW TABLES LIKE '$stopword_table'") == $stopword_table) {
15
  $sql = "DROP TABLE $stopword_table";
26
  $wpdb->query($sql);
27
  }
28
 
 
 
 
 
 
 
 
 
 
 
29
  echo '<div id="message" class="updated fade"><p>' . __("Data wiped clean, you can now delete the plugin.", "relevanssi") . '</p></div>';
30
  }
31
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: msaari
3
  Donate link: http://www.relevanssi.com/buy-premium/
4
  Tags: search, relevance, better search
5
  Requires at least: 3.3
6
- Tested up to: 3.8-alpha
7
- Stable tag: 3.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -16,8 +16,9 @@ Relevanssi replaces the standard WordPress search with a better search engine, w
16
  and configurable options. You'll get better results, better presentation of results - your users
17
  will thank you.
18
 
19
- This is the free version of Relevanssi. There's also Relevanssi Premium, which has added features.
20
- For more information about Premium, see [Relevanssi.com](http://www.relevanssi.com/).
 
21
 
22
  = Key features =
23
  * Search results sorted in the order of relevance, not by date.
@@ -92,6 +93,10 @@ without a deactivation, for some reason.
92
  None necessary! Relevanssi uses the standard search form and doesn't usually need any changes in
93
  the search results template.
94
 
 
 
 
 
95
  = How to index =
96
  Check the options to make sure they're to your liking, then click "Save indexing options and
97
  build the index". If everything's fine, you'll see the Relevanssi options screen again with a
@@ -140,9 +145,6 @@ Relevanssi doesn't work with plugins that rely on standard WP search. Those plug
140
  access the MySQL queries, for example. That won't do with Relevanssi. [Search Light](http://wordpress.org/extend/plugins/search-light/),
141
  for example, won't work with Relevanssi.
142
 
143
- [ThreeWP Ajax Search](http://wordpress.org/extend/plugins/threewp-ajax-search/) is
144
- an AJAX instant search plugin that works with Relevanssi.
145
-
146
  Some plugins cause problems when indexing documents. These are generally plugins that use shortcodes
147
  to do something somewhat complicated. One such plugin is [MapPress Easy Google Maps](http://wordpress.org/extend/plugins/mappress-google-maps-for-wordpress/).
148
  When indexing, you'll get a white screen. To fix the problem, disable either the offending plugin
@@ -159,6 +161,10 @@ If you the results don't change after installing and activating Relevanssi, the
159
  reason is that you have a call to `query_posts()` on your search results template. This confuses
160
  Relevanssi. Try removing the query_posts call and see what happens.
161
 
 
 
 
 
162
  = Where are the user search logs? =
163
  See the top of the admin menu. There's 'User searches'. There. If the logs are empty, please note
164
  showing the results needs at least MySQL 5.
@@ -233,12 +239,6 @@ or no results at all, depending on case.
233
 
234
  Thanks to Charles St-Pierre for the idea.
235
 
236
- = Caching =
237
- Relevanssi has an included cache feature that'll store search results and
238
- post excerpts in the database for reuse. It's something of an experimental
239
- feature right now, but should work and if there are lots of repeat queries,
240
- it'll give some actual boost in performance.
241
-
242
  = Displaying the relevance score =
243
  Relevanssi stores the relevance score it uses to sort results in the $post variable. Just add
244
  something like
@@ -377,10 +377,6 @@ removing those words helps to make the index smaller and searching faster.
377
  == Known issues and To-do's ==
378
  * 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.
379
  * 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().
380
- * Known issue: Custom post types and private posts is problematic - I'm using default 'read_private_*s' capability, which might not always work.
381
- * Known issue: There are reported problems with custom posts combined with custom taxonomies, the taxonomy restriction doesn't necessarily work.
382
- * Known issue: Phrase matching is only done to post content; phrases don't match to category titles and other content.
383
- * Known issue: User searches page requires MySQL 5.
384
 
385
  == Thanks ==
386
  * Cristian Damm for tag indexing, comment indexing, post/page exclusion and general helpfulness.
@@ -390,6 +386,82 @@ removing those words helps to make the index smaller and searching faster.
390
 
391
  == Changelog ==
392
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393
  = 3.2 =
394
  * Fixed a bug in the TablePress support.
395
  * Titles are put through the_title filter before indexing.
@@ -989,6 +1061,36 @@ removing those words helps to make the index smaller and searching faster.
989
 
990
  == Upgrade notice ==
991
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
992
  = 3.2 =
993
  * New filters, better search efficiency, new features, small bug fixes.
994
 
@@ -996,4 +1098,4 @@ removing those words helps to make the index smaller and searching faster.
996
  * WordPress 3.7 compatibility, couple of minor bug fixes.
997
 
998
  = 3.1.8 =
999
- Recommended for users of WPML and BBpress. Category exclusions and restrictions are also fixed.
3
  Donate link: http://www.relevanssi.com/buy-premium/
4
  Tags: search, relevance, better search
5
  Requires at least: 3.3
6
+ Tested up to: 4.1
7
+ Stable tag: 3.3.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
16
  and configurable options. You'll get better results, better presentation of results - your users
17
  will thank you.
18
 
19
+ This is the free version of Relevanssi. There's also Relevanssi Premium, which has added features,
20
+ including Multisite support. This free version does not work properly on Multisite. For more
21
+ information about Premium, see [Relevanssi.com](http://www.relevanssi.com/).
22
 
23
  = Key features =
24
  * Search results sorted in the order of relevance, not by date.
93
  None necessary! Relevanssi uses the standard search form and doesn't usually need any changes in
94
  the search results template.
95
 
96
+ If the search does not bring any results, your theme probably has a query_posts() call in the
97
+ search results template. That throws Relevanssi off. For more information, see [The most
98
+ important Relevanssi debugging trick](http://www.relevanssi.com/knowledge-base/query_posts/).
99
+
100
  = How to index =
101
  Check the options to make sure they're to your liking, then click "Save indexing options and
102
  build the index". If everything's fine, you'll see the Relevanssi options screen again with a
145
  access the MySQL queries, for example. That won't do with Relevanssi. [Search Light](http://wordpress.org/extend/plugins/search-light/),
146
  for example, won't work with Relevanssi.
147
 
 
 
 
148
  Some plugins cause problems when indexing documents. These are generally plugins that use shortcodes
149
  to do something somewhat complicated. One such plugin is [MapPress Easy Google Maps](http://wordpress.org/extend/plugins/mappress-google-maps-for-wordpress/).
150
  When indexing, you'll get a white screen. To fix the problem, disable either the offending plugin
161
  reason is that you have a call to `query_posts()` on your search results template. This confuses
162
  Relevanssi. Try removing the query_posts call and see what happens.
163
 
164
+ = Searching for words with ampersands or hyphens doesn't work =
165
+ Please read [Words with punctuation can't be found](http://www.relevanssi.com/knowledge-base/words-ampersands-cant-found/).
166
+ This is a Relevanssi feature, but you can circumvent it with a simple filter function.
167
+
168
  = Where are the user search logs? =
169
  See the top of the admin menu. There's 'User searches'. There. If the logs are empty, please note
170
  showing the results needs at least MySQL 5.
239
 
240
  Thanks to Charles St-Pierre for the idea.
241
 
 
 
 
 
 
 
242
  = Displaying the relevance score =
243
  Relevanssi stores the relevance score it uses to sort results in the $post variable. Just add
244
  something like
377
  == Known issues and To-do's ==
378
  * 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.
379
  * 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().
 
 
 
 
380
 
381
  == Thanks ==
382
  * Cristian Damm for tag indexing, comment indexing, post/page exclusion and general helpfulness.
386
 
387
  == Changelog ==
388
 
389
+ = 3.3.8 =
390
+ * Fixed a bug that caused the results to change depending of the order of words in a multi-word search query.
391
+ * Added `product_categories` and `recent_products` from WooCommerce to the list of blocked shortcodes.
392
+ * There are improvements in excerpt-building and highlighting, especially when fuzzy search is enabled.
393
+ * Fixed a possible (if quite unlikely) XSS vulnerability.
394
+ * Improved search performance (thanks to MikeNGarrett).
395
+ * 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.
396
+
397
+ = 3.3.7.1 =
398
+ * Fixed bbPress compatibility.
399
+
400
+ = 3.3.7 =
401
+ * Fixed bbPress compatibility.
402
+
403
+ = 3.3.6 =
404
+ * Relevanssi handles taxonomy terms in search better. The change requires a reindexing.
405
+ * 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.
406
+ * Tax query relation setting didn't work properly. It is now fixed.
407
+ * Word-based excerpt building sometimes created too short excerpts. That is now fixed.
408
+ * Synonyms are now highlighted.
409
+ * Phrase matching had issues where searching for a too common phrase crashed the search. That has been fixed.
410
+ * LIKE operator didn't work properly in meta_queries.
411
+ * Problems with Avatar Upload plugin are fixed.
412
+ * Offset errors with mb_stripos() shouldn't happen anymore.
413
+ * A small problem in taxonomy search MySQL fixed, also a small problem with AND operator in tax_queries.
414
+ * New filter: `relevanssi_post_to_index` lets you access the post object before the post is indexed.
415
+ * New filter: `relevanssi_orderby` lets you modify the $orderby value before Relevanssi sorts posts.
416
+ * New filter: `relevanssi_order` lets you modify the $order value before Relevanssi sorts posts.
417
+ * New filter: `relevanssi_post_title_before_tokenize` lets you modify post titles before indexing.
418
+ * New filter: `relevanssi_private_cap` lets you adjust the capability setting for private posts in custom post types.
419
+ * Deprecated use of `like_escape` has been fixed.
420
+
421
+ = 3.3.5 =
422
+ * Fixed a bug where excluding posts would cause the search to fail.
423
+ * Fixed a bug causing duplicate search results in WPML searches.
424
+ * Increased plugin safety against hackers.
425
+ * There was a bug in `relevanssi_comment_content_to_index` filter.
426
+ * Some people had problems with the log entry timestamps. Fixed that.
427
+ * New filter: `relevanssi_prevent_default_request` gives you more control over where Relevanssi prevents the default query from running.
428
+ * New filter: `relevanssi_private_cap` lets you set the correct capability for finding private posts in custom post types.
429
+ * The option to exclude categories and tags from search only worked for categories, not tags. Tags have been separated to a different option.
430
+
431
+ = 3.3.4 =
432
+ * Couple of bug fixes.
433
+
434
+ = 3.3.3 =
435
+ * OR fallback had problems.
436
+ * Indexing sub pages didn't work.
437
+ * Relevanssi now automatically treats 'ß' as 'ss'. If your site has 'ß' in text, reindexing the database is a good idea.
438
+ * Query variable `post_status` is now supported.
439
+
440
+ = 3.3.2 =
441
+ * Fixed a warning on search results page.
442
+
443
+ = 3.3.1 =
444
+ * Fixed bugs related to the removal of the cache feature.
445
+
446
+ = 3.3 =
447
+ * 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.
448
+ * Allowing HTML tags in excerpts could lead to those tags being left open. Relevanssi will now try to close open HTML tags in excerpts.
449
+ * Allowed tags were not controlled in comments. They are now.
450
+ * Highlighting in documents didn't always work; it should be more reliable now.
451
+ * Non-integer values are removed from `post__in` and `post__not_in` before processing them.
452
+ * Query variables `p` and `page_id` are now supported.
453
+ * Relevanssi now understands `date_query` variables as well.
454
+ * The original post excerpt is stored in $post->original_excerpt.
455
+ * Taxonomy search works better with term id parameters (for example from `wp_category_dropdown`).
456
+ * Errors about $wpdb->prepare() missing an argument removed.
457
+ * New functions: `relevanssi_the_title()` and `relevanssi_get_the_title()` can be used to display highlighted titles in search results.
458
+ * 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.
459
+ * Polylang and WPML support was adjusted to perform better in edge cases.
460
+ * Indexing is faster, thanks to some improved code from Tom Novelli.
461
+ * MySQL injection attack vulnerability removed.
462
+ * The cache feature is now removed. Relevanssi should automatically drop the cache tables.
463
+ * New filter: `relevanssi_indexing_data` lets you modify the data before it's indexed.
464
+
465
  = 3.2 =
466
  * Fixed a bug in the TablePress support.
467
  * Titles are put through the_title filter before indexing.
1061
 
1062
  == Upgrade notice ==
1063
 
1064
+ = 3.3.8 =
1065
+ * Bug fixes, fix for a possible XSS vulnerability, improved performance.
1066
+
1067
+ = 3.3.7.1 =
1068
+ * Improved bbPress compatibility.
1069
+
1070
+ = 3.3.7 =
1071
+ * Fixed bbPress compatibility.
1072
+
1073
+ = 3.3.6 =
1074
+ * Many new features, small bug fixes and WP 4.0 compatibility.
1075
+
1076
+ = 3.3.5 =
1077
+ * Bug fixes and security updates.
1078
+
1079
+ = 3.3.4 =
1080
+ * Bug fixes.
1081
+
1082
+ = 3.3.3 =
1083
+ * OR fallback and indexing sub pages fixed.
1084
+
1085
+ = 3.3.2 =
1086
+ * Fixes a warning on search page.
1087
+
1088
+ = 3.3.1 =
1089
+ * Removing the cache feature wasn't complete, which caused problems. Those should be fixed now.
1090
+
1091
+ = 3.3 =
1092
+ * Critical MySQL injection vulnerability fixed, better excerpts and highlights, bug fixes. This version removes the cache feature.
1093
+
1094
  = 3.2 =
1095
  * New filters, better search efficiency, new features, small bug fixes.
1096
 
1098
  * WordPress 3.7 compatibility, couple of minor bug fixes.
1099
 
1100
  = 3.1.8 =
1101
+ Recommended for users of WPML and BBpress. Category exclusions and restrictions are also fixed.
relevanssi-fr_FR.mo CHANGED
Binary file
relevanssi-fr_FR.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Relevanssi v1.4\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2013-12-10 18:14+0100\n"
6
- "PO-Revision-Date: 2013-12-10 18:19+0100\n"
7
  "Last-Translator: Li-An <lian00@gmail.com>\n"
8
  "Language-Team: \n"
9
  "Language: fr_FR\n"
@@ -15,43 +15,30 @@ msgstr ""
15
  "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
16
  "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
17
  "X-Textdomain-Support: yes\n"
18
- "X-Generator: Poedit 1.6.2\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
21
- # @ relevanssi
22
- #: relevanssi.php:297
23
- msgid "Tag weight:"
24
- msgstr "Poids des mots-clef:"
25
-
26
- # @ relevanssi
27
- #: relevanssi.php:312
28
- msgid "Category weight:"
29
- msgstr "Poids des catégories:"
30
-
31
  # @ default
32
  #: lib/excerpts-highlights.php:11
33
  msgid "There is no excerpt because this is a protected post."
34
  msgstr "Il n'y a aucun extrait car ce billet est protégé."
35
 
36
  # @ relevanssi
37
- #: lib/indexing.php:109
38
  msgid "Indexing complete!"
39
  msgstr "Indexation complète !"
40
 
41
  # @ default
42
- #: lib/init.php:40
43
- #, php-format
44
  msgid ""
45
- "Relevanssi needs attention: Remember to build the index (you can do it at <a "
46
- "href=\"%1$s\">the\n"
47
- "\t\t\t settings page</a>), otherwise searching won't work."
48
  msgstr ""
49
- "Relevassi nécessite de l'attention: n'oubliez pas de construire l'index (you "
50
- "pouvez le faire sur <a href=\"%1$s\">la\n"
51
- "\t\t\t page de réglages</a>), sinon la recherche ne fonctionnera pas."
52
 
53
  # @ relevanssi
54
- #: lib/init.php:84 lib/init.php:85
55
  msgid "User searches"
56
  msgstr "Recherches par les utilisateurs"
57
 
@@ -66,17 +53,17 @@ msgid "Relevanssi Search Options"
66
  msgstr "Options de recherche de Relevanssi"
67
 
68
  # @ relevanssi
69
- #: lib/interface.php:86
70
  msgid "User Searches"
71
  msgstr "Recherches par les utilisateurs"
72
 
73
  # @ relevanssi
74
- #: lib/interface.php:88
75
  msgid "Relevanssi User Searches"
76
  msgstr "Recherches Relevanssi par les utilisateurs"
77
 
78
  # @ relevanssi
79
- #: lib/interface.php:335
80
  #, php-format
81
  msgid ""
82
  "<div id='message' class='updated fade'><p>Successfully added %d/%d terms to "
@@ -86,7 +73,7 @@ msgstr ""
86
  "stopwords!</p></div>"
87
 
88
  # @ relevanssi
89
- #: lib/interface.php:342
90
  #, php-format
91
  msgid ""
92
  "<div id='message' class='updated fade'><p>Term '%s' added to stopwords!</p></"
@@ -96,7 +83,7 @@ msgstr ""
96
  "p></div>"
97
 
98
  # @ relevanssi
99
- #: lib/interface.php:345
100
  #, php-format
101
  msgid ""
102
  "<div id='message' class='updated fade'><p>Couldn't add term '%s' to "
@@ -106,7 +93,7 @@ msgstr ""
106
  "stopwords!</p></div>"
107
 
108
  # @ relevanssi
109
- #: lib/interface.php:374
110
  msgid ""
111
  "<div id='message' class='updated fade'><p>Stopwords removed! Remember to re-"
112
  "index.</p></div>"
@@ -115,7 +102,7 @@ msgstr ""
115
  "de réindexer.</p></div>"
116
 
117
  # @ relevanssi
118
- #: lib/interface.php:384
119
  #, php-format
120
  msgid ""
121
  "<div id='message' class='updated fade'><p>Term '%s' removed from stopwords! "
@@ -125,7 +112,7 @@ msgstr ""
125
  "Réindexer pour le récupérer dans l'index.</p></div>"
126
 
127
  # @ relevanssi
128
- #: lib/interface.php:387
129
  #, php-format
130
  msgid ""
131
  "<div id='message' class='updated fade'><p>Couldn't remove term '%s' from "
@@ -135,12 +122,12 @@ msgstr ""
135
  "stopwords !</p></div>"
136
 
137
  # @ relevanssi
138
- #: lib/interface.php:398
139
  msgid "25 most common words in the index"
140
  msgstr "Les 25 mots des plus fréquents de l'index"
141
 
142
  # @ relevanssi
143
- #: lib/interface.php:400
144
  msgid ""
145
  "These words are excellent stopword material. A word that appears in most of "
146
  "the posts in the database is quite pointless when searching. This is also an "
@@ -157,24 +144,24 @@ msgstr ""
157
  "retiré de l'index aussi est-il inutile de reconstruire l'index."
158
 
159
  # @ relevanssi
160
- #: lib/interface.php:426
161
  msgid "Add to stopwords"
162
  msgstr "Ajouter aux stopwords."
163
 
164
- #: lib/interface.php:437
165
  msgid "Total Searches"
166
  msgstr "Nombre de recherches total"
167
 
168
- #: lib/interface.php:440
169
  msgid "Totals"
170
  msgstr "Totaux"
171
 
172
- #: lib/interface.php:445
173
  msgid "Common Queries"
174
  msgstr "Requêtes en commun"
175
 
176
  # @ relevanssi
177
- #: lib/interface.php:447
178
  msgid ""
179
  "Here you can see the 20 most common user search queries, how many times "
180
  "those \n"
@@ -186,130 +173,140 @@ msgstr ""
186
  "pour ces requêtes."
187
 
188
  # @ relevanssi
189
- #: lib/interface.php:453 lib/interface.php:469 lib/interface.php:501
190
  msgid "Today and yesterday"
191
  msgstr "Aujourd'hui et hier"
192
 
193
  # @ relevanssi
194
- #: lib/interface.php:457 lib/interface.php:473 lib/interface.php:502
195
  msgid "Last 7 days"
196
  msgstr "Sept derniers jours"
197
 
198
  # @ relevanssi
199
- #: lib/interface.php:461 lib/interface.php:477 lib/interface.php:503
200
  msgid "Last 30 days"
201
  msgstr "Trente derniers jours"
202
 
203
  # @ relevanssi
204
- #: lib/interface.php:466
205
  msgid "Unsuccessful Queries"
206
  msgstr "Requêtes sans résultat"
207
 
208
- #: lib/interface.php:484
209
  msgid "Reset Logs"
210
  msgstr "Remettre à zéro les logs"
211
 
212
- #: lib/interface.php:487
213
  #, php-format
214
  msgid "To reset the logs, type \"reset\" into the box here %s and click %s"
215
  msgstr ""
216
  "Pour remettre à zéro les logs, tapez \"reset\" dans le champ ici %s et "
217
  "cliquez %s"
218
 
219
- #: lib/interface.php:504
220
  msgid "Forever"
221
  msgstr "Pour toujours"
222
 
223
- #: lib/interface.php:506
224
  msgid "When"
225
  msgstr "Quand"
226
 
227
  # @ relevanssi
228
- #: lib/interface.php:506
229
  msgid "Searches"
230
  msgstr "Recherches"
231
 
232
- #: lib/interface.php:536
233
  msgid "Query"
234
  msgstr "Requête"
235
 
236
- #: lib/interface.php:536
237
  msgid "Hits"
238
  msgstr "Hits"
239
 
240
  # @ relevanssi
241
- #: lib/interface.php:846 lib/interface.php:887
242
  msgid "Basic options"
243
  msgstr "Options basiques"
244
 
245
- #: lib/interface.php:847 lib/interface.php:953
246
  msgid "Weights"
247
  msgstr "Poids"
248
 
249
  # @ relevanssi
250
- #: lib/interface.php:848 lib/interface.php:1008
251
  msgid "Logs"
252
  msgstr "Logs"
253
 
254
  # @ relevanssi
255
- #: lib/interface.php:849 lib/interface.php:1037
256
  msgid "Exclusions and restrictions"
257
  msgstr "Exclusions et restrictions"
258
 
259
  # @ relevanssi
260
- #: lib/interface.php:850
261
  msgid "Custom excerpts"
262
  msgstr "Extraits personnalisés"
263
 
264
  # @ relevanssi
265
- #: lib/interface.php:851
266
  msgid "Highlighting search results"
267
  msgstr "Mise en évidence des résultats de recherche"
268
 
269
  # @ relevanssi
270
- #: lib/interface.php:852 lib/interface.php:1183
271
  msgid "Indexing options"
272
  msgstr "Options d'indexation"
273
 
274
  # @ relevanssi
275
- #: lib/interface.php:853 lib/interface.php:1331
276
- msgid "Caching"
277
- msgstr "Mise en cache"
278
-
279
- # @ relevanssi
280
- #: lib/interface.php:854 lib/interface.php:1354
281
  msgid "Synonyms"
282
  msgstr "Synonymes"
283
 
284
  # @ relevanssi
285
- #: lib/interface.php:855 lib/interface.php:1362
286
  msgid "Stopwords"
287
  msgstr "Stopwords"
288
 
289
- #: lib/interface.php:858
290
  msgid "Import/export options"
291
  msgstr "Import/export des options"
292
 
293
- #: lib/interface.php:861
294
  msgid "Buy Relevanssi Premium"
295
  msgstr "Achetez Relevanssi Premium"
296
 
297
  # @ relevanssi
298
- #: lib/interface.php:866
299
  msgid "Quick tools"
300
  msgstr "Outils rapides"
301
 
302
  # @ relevanssi
303
- #: lib/interface.php:870
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  msgid "add"
305
  msgstr "ajouter"
306
 
307
  # @ relevanssi
308
- #: lib/interface.php:870
309
  msgid "documents."
310
  msgstr "documents."
311
 
312
- #: lib/interface.php:874
313
  msgid ""
314
  "WARNING: You've chosen no post types to index. Nothing will be indexed. <a "
315
  "href='#indexing'>Choose some post types to index</a>."
@@ -318,7 +315,7 @@ msgstr ""
318
  "indexé.<a href='#indexing'>Choisissez les types de billet à indexer</a>."
319
 
320
  # @ relevanssi
321
- #: lib/interface.php:878
322
  msgid ""
323
  "Use 'Build the index' to build the index with current <a "
324
  "href='#indexing'>indexing options</a>. If you can't finish indexing with one "
@@ -336,54 +333,54 @@ msgstr ""
336
  "de documents actuellement pris en compte dans l'indexation."
337
 
338
  # @ relevanssi
339
- #: lib/interface.php:880
340
  msgid "State of the Index"
341
  msgstr "État de l'index"
342
 
343
  # @ relevanssi
344
- #: lib/interface.php:882
345
  msgid "Documents in the index"
346
  msgstr "Documents dans l'index"
347
 
348
  # @ relevanssi
349
- #: lib/interface.php:883
350
  msgid "Terms in the index"
351
  msgstr "Termes dans l'index"
352
 
353
  # @ relevanssi
354
- #: lib/interface.php:884
355
  msgid "Highest post ID indexed"
356
  msgstr "ID de billet le plus élevé indexé"
357
 
358
  # @ relevanssi
359
- #: lib/interface.php:893
360
  msgid "Use search for admin:"
361
  msgstr "Utiliser la recherche pour l'administration:"
362
 
363
  # @ relevanssi
364
- #: lib/interface.php:895
365
  msgid "If checked, Relevanssi will be used for searches in the admin interface"
366
  msgstr ""
367
  "Si coché, Relevanssi sera utilisé pour les recherches dans l'interface "
368
  "d'administration"
369
 
370
  # @ relevanssi
371
- #: lib/interface.php:899
372
  msgid "Default operator for the search?"
373
  msgstr "Opérateur logique par défaut pour la recherche ?"
374
 
375
  # @ relevanssi
376
- #: lib/interface.php:901
377
  msgid "AND - require all terms"
378
  msgstr "ET - nécessite tous les termes"
379
 
380
  # @ relevanssi
381
- #: lib/interface.php:902
382
  msgid "OR - any term present is enough"
383
  msgstr "OU - n'importe lequel des termes présents est suffisant"
384
 
385
  # @ relevanssi
386
- #: lib/interface.php:904
387
  msgid ""
388
  "If you choose AND and the search finds no matches, it will automatically do "
389
  "an OR search."
@@ -392,12 +389,12 @@ msgstr ""
392
  "lancée automatiquement."
393
 
394
  # @ relevanssi
395
- #: lib/interface.php:908
396
  msgid "Disable OR fallback:"
397
  msgstr "Désactiver le passage à OU:"
398
 
399
  # @ relevanssi
400
- #: lib/interface.php:910
401
  msgid ""
402
  "If you don't want Relevanssi to fall back to OR search when AND search gets "
403
  "no hits, check this option. For most cases, leave this one unchecked."
@@ -407,21 +404,21 @@ msgstr ""
407
  "plupart des cas, laissez la décochée."
408
 
409
  # @ relevanssi
410
- #: lib/interface.php:914
411
  msgid "Default order for results:"
412
  msgstr "Ordre par défaut pour les résultats:"
413
 
414
  # @ relevanssi
415
- #: lib/interface.php:916
416
  msgid "Relevance (highly recommended)"
417
  msgstr "Pertinence (hautement recommandé)"
418
 
419
  # @ relevanssi
420
- #: lib/interface.php:917
421
  msgid "Post date"
422
  msgstr "Date de billet"
423
 
424
- #: lib/interface.php:919
425
  msgid ""
426
  "If you want date-based results, see the recent post bonus in the Weights "
427
  "section."
@@ -430,27 +427,27 @@ msgstr ""
430
  "bonus pour billet dans la section Poids."
431
 
432
  # @ relevanssi
433
- #: lib/interface.php:923
434
  msgid "When to use fuzzy matching?"
435
  msgstr "Quand utiliser la correspondance approximative ?"
436
 
437
  # @ relevanssi
438
- #: lib/interface.php:925
439
  msgid "When straight search gets no hits"
440
  msgstr "Quand la recherche directe ne donne pas de résultat"
441
 
442
  # @ relevanssi
443
- #: lib/interface.php:926
444
  msgid "Always"
445
  msgstr "Toujours"
446
 
447
  # @ relevanssi
448
- #: lib/interface.php:927
449
  msgid "Don't use fuzzy search"
450
  msgstr "Ne pas utiliser l'approximation"
451
 
452
  # @ relevanssi
453
- #: lib/interface.php:929
454
  msgid ""
455
  "Straight search matches just the term. Fuzzy search matches everything that "
456
  "begins or ends with the search term."
@@ -459,11 +456,11 @@ msgstr ""
459
  "prend en compte tout ce qui commence ou finit par le terme recherché."
460
 
461
  # @ relevanssi
462
- #: lib/interface.php:937
463
  msgid "Limit searches:"
464
  msgstr "Limiter les recherches:"
465
 
466
- #: lib/interface.php:939
467
  msgid ""
468
  "If this option is checked, Relevanssi will limit search results to at most "
469
  "500 results per term. This will improve performance, but may cause some "
@@ -480,22 +477,30 @@ msgstr ""
480
  "par date.</strong> Le tri peut être amené à mettre de côté des billets "
481
  "récents pour favoriser des billets plus pertinents."
482
 
483
- #: lib/interface.php:943
484
  msgid "Limit:"
485
  msgstr "Limite:"
486
 
487
- #: lib/interface.php:945
 
488
  msgid ""
489
  "For better performance, adjust the limit to a smaller number. Adjusting the "
490
- "limit to 100 - or even lower - should be safe for good results, and might "
491
- "bring a boost in search speed."
 
 
 
492
  msgstr ""
493
  "Pour de meilleures performances, ajustez la limite à un nombre plus petit. "
494
- "Ajuster la limite à 100 - et même en dessous - ne pose pas de problèmes pour "
495
- "de bons résultats et est susceptible de booster la vitesse de recherche."
 
 
 
 
496
 
497
  # @ relevanssi
498
- #: lib/interface.php:955
499
  msgid ""
500
  "These values affect the weights of the documents. These are all multipliers, "
501
  "so 1 means no change in weight, less than 1 means less weight, and more than "
@@ -512,41 +517,41 @@ msgstr ""
512
  "les mêmes mots partout ailleurs. Si le poids du titre vaut 0, les mots dans "
513
  "le titre n'affecteront pas les résultats de recherche."
514
 
515
- #: lib/interface.php:960
516
  msgid "Element"
517
  msgstr "Élément"
518
 
519
- #: lib/interface.php:961
520
  msgid "Weight"
521
  msgstr "Poids"
522
 
523
  # @ relevanssi
524
- #: lib/interface.php:962
525
  msgid "Default weight"
526
  msgstr "Poids par défaut"
527
 
528
  # @ relevanssi
529
- #: lib/interface.php:967
530
  msgid "Post titles"
531
  msgstr "Titres de billet"
532
 
533
  # @ relevanssi
534
- #: lib/interface.php:979
535
  msgid "Comment text"
536
  msgstr "Text de commentaire"
537
 
538
  # @ relevanssi
539
- #: lib/interface.php:1000
540
  msgid "WPML/Polylang compatibility"
541
  msgstr "Compatibilité WPML/Polylang"
542
 
543
  # @ relevanssi
544
- #: lib/interface.php:1002
545
  msgid "Limit results to current language:"
546
  msgstr "Limiter les résultats au langage suivant:"
547
 
548
  # @ relevanssi
549
- #: lib/interface.php:1004
550
  msgid ""
551
  "If this option is checked, Relevanssi will only return results in the "
552
  "current active language. Otherwise results will include posts in every "
@@ -557,12 +562,12 @@ msgstr ""
557
  "billets dans tous les langages."
558
 
559
  # @ relevanssi
560
- #: lib/interface.php:1010
561
  msgid "Keep a log of user queries:"
562
  msgstr "Conserver une liste des recherches des visiteurs:"
563
 
564
  # @ relevanssi
565
- #: lib/interface.php:1012
566
  msgid ""
567
  "If checked, Relevanssi will log user queries. The log appears in 'User "
568
  "searches' on the Dashboard admin menu."
@@ -571,24 +576,24 @@ msgstr ""
571
  "Les stats apparaissent dans 'Recherches d'utilisateur' dans le menu du "
572
  "tableau de bord de l'administration."
573
 
574
- #: lib/interface.php:1016
575
  msgid "Log the user's IP with the queries:"
576
  msgstr "Enregistrer l'adresse IP de l'utilisateur avec ses requêtes:"
577
 
578
  # @ relevanssi
579
- #: lib/interface.php:1018
580
  msgid "If checked, Relevanssi will log user's IP-Adress with the queries."
581
  msgstr ""
582
  "Si coché, Relevanssi enregistrera les adresses IP des utilisateurs avec "
583
  "leurs requêtes."
584
 
585
  # @ relevanssi
586
- #: lib/interface.php:1022
587
  msgid "Don't log queries from these users:"
588
  msgstr "Ne conservez pas les statistiques de recherche de ces utilisateurs:"
589
 
590
  # @ relevanssi
591
- #: lib/interface.php:1024
592
  msgid ""
593
  "Comma-separated list of numeric user IDs or user login names that will not "
594
  "be logged."
@@ -597,7 +602,7 @@ msgstr ""
597
  "seront pas pris en compte."
598
 
599
  # @ relevanssi
600
- #: lib/interface.php:1028
601
  msgid ""
602
  "If you enable logs, you can see what your users are searching for. You can "
603
  "prevent your own searches from getting in the logs with the omit feature."
@@ -607,7 +612,7 @@ msgstr ""
607
  "réglage d'exemption."
608
 
609
  # @ relevanssi
610
- #: lib/interface.php:1031
611
  msgid ""
612
  "If you enable logs, you can see what your users are searching for. Logs are "
613
  "also needed to use the 'Did you mean?' feature. You can prevent your own "
@@ -619,12 +624,12 @@ msgstr ""
619
  "avec la fonction d'exception."
620
 
621
  # @ relevanssi
622
- #: lib/interface.php:1039
623
  msgid "Restrict search to these categories and tags:"
624
  msgstr "Restreindre la recherche à ces catégories et tags:"
625
 
626
  # @ relevanssi
627
- #: lib/interface.php:1041
628
  msgid ""
629
  "Enter a comma-separated list of category and tag IDs to restrict search to "
630
  "those categories or tags. You can also use <code>&lt;input type='hidden' "
@@ -638,28 +643,38 @@ msgstr ""
638
  "sur ce réglage."
639
 
640
  # @ relevanssi
641
- #: lib/interface.php:1045
642
- msgid "Exclude these categories and tags from search:"
643
- msgstr "Exclure ces catégories et tags de la recherche:"
644
 
645
  # @ relevanssi
646
- #: lib/interface.php:1047
647
  msgid ""
648
- "Enter a comma-separated list of category and tag IDs that are excluded from "
649
- "search results. You can exclude categories with the 'cat' input field by "
650
- "using negative values."
651
  msgstr ""
652
- "Entrez une liste d'ID de catégories et mots-clef à exclure des résultats de "
653
- "recherche. Vous pouvez exclure des catégories avec le champ d'insertion "
654
- "'cat' en usant de valeurs négatives."
655
 
656
  # @ relevanssi
657
- #: lib/interface.php:1051
 
 
 
 
 
 
 
 
 
 
 
 
 
658
  msgid "Exclude these posts/pages from search:"
659
  msgstr "Exclure ces billets/pages de la recherche:"
660
 
661
  # @ relevanssi
662
- #: lib/interface.php:1055
663
  msgid ""
664
  "Enter a comma-separated list of post/page IDs that are excluded from search "
665
  "results. This only works here, you can't use the input field option "
@@ -673,7 +688,7 @@ msgstr ""
673
  "d'éditions des billets/pages pour retirer des billetx de l'index."
674
 
675
  # @ relevanssi
676
- #: lib/interface.php:1058
677
  msgid ""
678
  "Enter a comma-separated list of post/page IDs that are excluded from search "
679
  "results. This only works here, you can't use the input field option "
@@ -685,12 +700,12 @@ msgstr ""
685
  "dans ce cas). "
686
 
687
  # @ relevanssi
688
- #: lib/interface.php:1064
689
  msgid "Respect exclude_from_search for custom post types:"
690
  msgstr "Respecter exclude_from_search pour les types de billets personnalisés:"
691
 
692
  # @ relevanssi
693
- #: lib/interface.php:1066
694
  msgid ""
695
  "If checked, Relevanssi won't display posts of custom post types that have "
696
  "'exclude_from_search' set to true. If not checked, Relevanssi will display "
@@ -701,17 +716,17 @@ msgstr ""
701
  "coché, Relevanssi affichera tout ce qui est indexé."
702
 
703
  # @ relevanssi
704
- #: lib/interface.php:1068
705
  msgid "Custom excerpts/snippets"
706
  msgstr "Personnaliser extraits/snippets"
707
 
708
  # @ relevanssi
709
- #: lib/interface.php:1070
710
  msgid "Create custom search result snippets:"
711
  msgstr "Créer des snippets personalisés de résultats de recherche:"
712
 
713
  # @ relevanssi
714
- #: lib/interface.php:1072
715
  msgid ""
716
  "If checked, Relevanssi will create excerpts that contain the search term "
717
  "hits. To make them work, make sure your search result template uses "
@@ -722,7 +737,7 @@ msgstr ""
722
  "de thème de résultat de recherche utilise the_excerpt() pour afficher les "
723
  "extraits de billet."
724
 
725
- #: lib/interface.php:1074
726
  msgid ""
727
  "Note: Building custom excerpts can be slow. If you are not actually using "
728
  "the excerpts, make sure you disable the option."
@@ -731,30 +746,30 @@ msgstr ""
731
  "n'utilisez pas les extraits, soyez certain de désactiver cette option."
732
 
733
  # @ relevanssi
734
- #: lib/interface.php:1076
735
  msgid "Length of the snippet:"
736
  msgstr "Longueur du snippet:"
737
 
738
  # @ relevanssi
739
- #: lib/interface.php:1079
740
  msgid "characters"
741
  msgstr "lettres"
742
 
743
  # @ relevanssi
744
- #: lib/interface.php:1080
745
  msgid "words"
746
  msgstr "mots"
747
 
748
  # @ relevanssi
749
- #: lib/interface.php:1082
750
  msgid "This must be an integer."
751
  msgstr "Ceci doit être un nombre entier."
752
 
753
- #: lib/interface.php:1086
754
  msgid "Allowable tags in excerpts:"
755
  msgstr "Mots-clefs autorisés dans les extraits:"
756
 
757
- #: lib/interface.php:1089
758
  msgid ""
759
  "List all tags you want to allow in excerpts, without any whitespace. For "
760
  "example: '&lt;p&gt;&lt;a&gt;&lt;strong&gt;'."
@@ -763,12 +778,12 @@ msgstr ""
763
  "aucun espace. Par exemple: '&lt;p&gt;&lt;a&gt;&lt;strong&gt;'."
764
 
765
  # @ relevanssi
766
- #: lib/interface.php:1093
767
  msgid "Show breakdown of search hits in excerpts:"
768
  msgstr "Montrer la répartition des résultats de recherche dans les extraits:"
769
 
770
  # @ relevanssi
771
- #: lib/interface.php:1095
772
  msgid ""
773
  "Check this to show more information on where the search hits were made. "
774
  "Requires custom snippets to work."
@@ -778,12 +793,12 @@ msgstr ""
778
  "pour fonctionner."
779
 
780
  # @ relevanssi
781
- #: lib/interface.php:1099
782
  msgid "The breakdown format:"
783
  msgstr "Mise en forme des répartitions:"
784
 
785
  # @ relevanssi
786
- #: lib/interface.php:1101
787
  msgid ""
788
  "Use %body%, %title%, %tags% and %comments% to display the number of hits (in "
789
  "different parts of the post), %total% for total hits, %score% to display the "
@@ -797,68 +812,68 @@ msgstr ""
797
  "chacun des termes recherché. Interdit d'utiliser des guillemets (\")!"
798
 
799
  # @ relevanssi
800
- #: lib/interface.php:1103
801
  msgid "Search hit highlighting"
802
  msgstr "Surbrillance des résultats de recherche"
803
 
804
  # @ relevanssi
805
- #: lib/interface.php:1105
806
  msgid "First, choose the type of highlighting used:"
807
  msgstr "En premier, veuillez choisir le type de surbrillance utilisée:"
808
 
809
  # @ relevanssi
810
- #: lib/interface.php:1108
811
  msgid "Highlight query terms in search results:"
812
  msgstr ""
813
  "Mettre en surbrillance les termes de recherche dans les résultats de "
814
  "recherche:"
815
 
816
  # @ relevanssi
817
- #: lib/interface.php:1110
818
  msgid "No highlighting"
819
  msgstr "Pas de mise en surbrillance"
820
 
821
  # @ relevanssi
822
- #: lib/interface.php:1114
823
  msgid "Text color"
824
  msgstr "Couleur du texte"
825
 
826
  # @ relevanssi
827
- #: lib/interface.php:1115
828
  msgid "Background color"
829
  msgstr "Couleur du fond"
830
 
831
  # @ relevanssi
832
- #: lib/interface.php:1116
833
  msgid "CSS Style"
834
  msgstr "Style CSS"
835
 
836
  # @ relevanssi
837
- #: lib/interface.php:1117
838
  msgid "CSS Class"
839
  msgstr "Classe CSS"
840
 
841
  # @ relevanssi
842
- #: lib/interface.php:1119
843
  msgid "Highlighting isn't available unless you use custom snippets"
844
  msgstr ""
845
  "La mise en surbrillance n'est pas disponible tant que vous n'avez pas activé "
846
  "l'utilisation de snippets personnalisés."
847
 
848
  # @ relevanssi
849
- #: lib/interface.php:1123
850
  msgid "Highlight query terms in result titles too:"
851
  msgstr "Mettre en surbrillance les mots recherchés dans le titre également:"
852
 
853
  # @ relevanssi
854
- #: lib/interface.php:1129
855
  msgid "Highlight query terms in documents from local searches:"
856
  msgstr ""
857
  "Mettre en évidence les termes de la requête dans les documents pour les "
858
  "recherches locales:"
859
 
860
  # @ relevanssi
861
- #: lib/interface.php:1131
862
  msgid ""
863
  "Highlights hits when user opens the post from search results. This is based "
864
  "on HTTP referrer, so if that's blocked, there'll be no highlights."
@@ -868,12 +883,12 @@ msgstr ""
868
  "cas de blocage, il y aura pas de surlignage."
869
 
870
  # @ relevanssi
871
- #: lib/interface.php:1137
872
  msgid "Highlight query terms in comments:"
873
  msgstr "Surligner les termes recherchés dans les commentaires:"
874
 
875
  # @ relevanssi
876
- #: lib/interface.php:1139
877
  msgid ""
878
  "Highlights hits in comments when user opens the post from search results."
879
  msgstr ""
@@ -881,12 +896,12 @@ msgstr ""
881
  "ouvre le billet à partir des résultats de recherche."
882
 
883
  # @ relevanssi
884
- #: lib/interface.php:1143
885
  msgid "Uncheck this if you use non-ASCII characters:"
886
  msgstr "Décochez ceci si vous utilisez des caractères non-ASCII:"
887
 
888
  # @ relevanssi
889
- #: lib/interface.php:1145
890
  msgid ""
891
  "If you use non-ASCII characters (like Cyrillic alphabet) and the highlights "
892
  "don't work, uncheck this option to make highlights work."
@@ -896,32 +911,32 @@ msgstr ""
896
  "fonctionner le surlignage."
897
 
898
  # @ relevanssi
899
- #: lib/interface.php:1150
900
  msgid "Then adjust the settings for your chosen type:"
901
  msgstr "Ensuite ajustez les réglages du type choisi:"
902
 
903
  # @ relevanssi
904
- #: lib/interface.php:1154
905
  msgid "Text color for highlights:"
906
  msgstr "Couleur du texte pour la surbrillance:"
907
 
908
  # @ relevanssi
909
- #: lib/interface.php:1156 lib/interface.php:1162
910
  msgid "Use HTML color codes (#rgb or #rrggbb)"
911
  msgstr "Utiliser les codes de couleurs HTML (#rgb ou #rrggbb)"
912
 
913
  # @ relevanssi
914
- #: lib/interface.php:1160
915
  msgid "Background color for highlights:"
916
  msgstr "Couleur du fond pour la surbrillance:"
917
 
918
  # @ relevanssi
919
- #: lib/interface.php:1166
920
  msgid "CSS style for highlights:"
921
  msgstr "Style CSS pour la surbrillance:"
922
 
923
  # @ relevanssi
924
- #: lib/interface.php:1168
925
  msgid ""
926
  "You can use any CSS styling here, style will be inserted with a &lt;span&gt;"
927
  msgstr ""
@@ -929,12 +944,12 @@ msgstr ""
929
  "&lt;span&gt;"
930
 
931
  # @ relevanssi
932
- #: lib/interface.php:1172
933
  msgid "CSS class for highlights:"
934
  msgstr "Classe CSS pour la surbrillance:"
935
 
936
  # @ relevanssi
937
- #: lib/interface.php:1174
938
  msgid ""
939
  "Name a class here, search results will be wrapped in a &lt;span&gt; with the "
940
  "class"
@@ -943,46 +958,51 @@ msgstr ""
943
  "avec cette classe"
944
 
945
  # @ relevanssi
946
- #: lib/interface.php:1185
 
 
 
 
 
947
  msgid "Choose post types to index:"
948
  msgstr "Veuillez choisir les types de billets personnalisés à indexer:"
949
 
950
- #: lib/interface.php:1190
951
  msgid "Type"
952
  msgstr "Type"
953
 
954
- #: lib/interface.php:1191 lib/interface.php:1237
955
  msgid "Index"
956
  msgstr "Index"
957
 
958
- #: lib/interface.php:1192 lib/interface.php:1238
959
  msgid "Public?"
960
  msgstr "Publique ?"
961
 
962
- #: lib/interface.php:1209 lib/interface.php:1252
963
  #, php-format
964
  msgid "%s"
965
  msgstr "%s"
966
 
967
- #: lib/interface.php:1210 lib/interface.php:1253
968
  msgid "yes"
969
  msgstr "oui"
970
 
971
  # @ relevanssi
972
- #: lib/interface.php:1210 lib/interface.php:1253
973
  msgid "no"
974
  msgstr "non"
975
 
976
  # @ relevanssi
977
- #: lib/interface.php:1231
978
  msgid "Choose taxonomies to index:"
979
  msgstr "Veuillez choisir les taxonomie à indexer:"
980
 
981
- #: lib/interface.php:1236
982
  msgid "Taxonomy"
983
  msgstr "Taxonomie"
984
 
985
- #: lib/interface.php:1273
986
  msgid ""
987
  "If you check a taxonomy here, the terms for that taxonomy are indexed with "
988
  "the posts. If you for example choose \"post_tag\", searching for tags will "
@@ -994,22 +1014,22 @@ msgstr ""
994
  "mot-clef."
995
 
996
  # @ relevanssi
997
- #: lib/interface.php:1277
998
  msgid "Minimum word length to index"
999
  msgstr "Longueur minimum des mots à indexer"
1000
 
1001
  # @ relevanssi
1002
- #: lib/interface.php:1279
1003
  msgid "Words shorter than this number will not be indexed."
1004
  msgstr "Les mots plus courts que ce nombre ne seront pas indexés."
1005
 
1006
  # @ relevanssi
1007
- #: lib/interface.php:1285
1008
  msgid "Expand shortcodes in post content:"
1009
  msgstr "Traduire les shortcodes dans le contenu des billets:"
1010
 
1011
  # @ relevanssi
1012
- #: lib/interface.php:1287
1013
  msgid ""
1014
  "If checked, Relevanssi will expand shortcodes in post content before "
1015
  "indexing. Otherwise shortcodes will be stripped. If you use shortcodes to "
@@ -1024,12 +1044,12 @@ msgstr ""
1024
  "shortcode au moment de l'indexation."
1025
 
1026
  # @ relevanssi
1027
- #: lib/interface.php:1293
1028
  msgid "Index and search your posts' authors:"
1029
  msgstr "Indexer et rechercher les auteurs des billets:"
1030
 
1031
  # @ relevanssi
1032
- #: lib/interface.php:1295
1033
  msgid ""
1034
  "If checked, Relevanssi will also index and search the authors of your posts. "
1035
  "Author display name will be indexed. Remember to rebuild the index if you "
@@ -1040,12 +1060,12 @@ msgstr ""
1040
  "reconstruire l'index si vous modifiez cette option !"
1041
 
1042
  # @ relevanssi
1043
- #: lib/interface.php:1299
1044
  msgid "Index and search post excerpts:"
1045
  msgstr "Indexer et rechercher dans les extraits de billets:"
1046
 
1047
  # @ relevanssi
1048
- #: lib/interface.php:1301
1049
  msgid ""
1050
  "If checked, Relevanssi will also index and search the excerpts of your posts."
1051
  "Remember to rebuild the index if you change this option!"
@@ -1054,27 +1074,27 @@ msgstr ""
1054
  "N'oubliez pas de reconstruire l'index si vous modifiez cette option !"
1055
 
1056
  # @ relevanssi
1057
- #: lib/interface.php:1305
1058
  msgid "Index and search these comments:"
1059
  msgstr "Indexer et rechercher ces commentaires:"
1060
 
1061
  # @ relevanssi
1062
- #: lib/interface.php:1307
1063
  msgid "none"
1064
  msgstr "aucun"
1065
 
1066
  # @ relevanssi
1067
- #: lib/interface.php:1308
1068
  msgid "normal"
1069
  msgstr "normal"
1070
 
1071
  # @ relevanssi
1072
- #: lib/interface.php:1309
1073
  msgid "all"
1074
  msgstr "tout"
1075
 
1076
  # @ relevanssi
1077
- #: lib/interface.php:1311
1078
  msgid ""
1079
  "Relevanssi will index and search ALL (all comments including track- &amp; "
1080
  "pingbacks and custom comment types), NONE (no comments) or NORMAL (manually "
@@ -1087,11 +1107,11 @@ msgstr ""
1087
  "<br />N'oubliez pas de reconstruire l'index si vous modifiez cette option !"
1088
 
1089
  # @ relevanssi
1090
- #: lib/interface.php:1315
1091
  msgid "Custom fields to index:"
1092
  msgstr "Champs personnalisés à indexer:"
1093
 
1094
- #: lib/interface.php:1317
1095
  msgid ""
1096
  "A comma-separated list of custom fields to include in the index. Set to "
1097
  "'visible' to index all visible custom fields and to 'all' to index all "
@@ -1102,46 +1122,13 @@ msgstr ""
1102
  "visibles et 'tout' pour indexer tous les champs personnalisés même ceux "
1103
  "commençant par le caractère '_' ."
1104
 
1105
- # @ relevanssi
1106
- #: lib/interface.php:1333
1107
- msgid ""
1108
- "Warning: In many cases caching is not useful, and in some cases can be even "
1109
- "harmful. Do not\n"
1110
- "\tactivate cache unless you have a good reason to do so."
1111
- msgstr ""
1112
- "Attention: dans de nombreux cas, le cache n'est pas utile et dans certains "
1113
- "cas il peut même causer du tort. Ne pas\n"
1114
- "\n"
1115
- "\\\tactiver le cache à moins que vous n'ayez une bonne raison."
1116
-
1117
- # @ relevanssi
1118
- #: lib/interface.php:1336
1119
- msgid "Enable result and excerpt caching:"
1120
- msgstr "Autoriser la mise en cache des résultats et d'extraits:"
1121
-
1122
- # @ relevanssi
1123
- #: lib/interface.php:1338
1124
- msgid "If checked, Relevanssi will cache search results and post excerpts."
1125
  msgstr ""
1126
- "Si coché, Relevanssi mettra en cache les résultats et extraits de billets."
1127
-
1128
- # @ relevanssi
1129
- #: lib/interface.php:1342
1130
- msgid "Cache expire (in seconds):"
1131
- msgstr "Expiration du coche (en secondes):"
1132
-
1133
- # @ relevanssi
1134
- #: lib/interface.php:1344
1135
- msgid "86400 = day"
1136
- msgstr "86400 = jour"
1137
-
1138
- # @ relevanssi
1139
- #: lib/interface.php:1348
1140
- msgid "Entries in the cache"
1141
- msgstr "Entrées dans le cache"
1142
 
1143
  # @ relevanssi
1144
- #: lib/interface.php:1358
1145
  msgid ""
1146
  "Add synonyms here in 'key = value' format. When searching with the OR "
1147
  "operator, any search of 'key' will be expanded to include 'value' as well. "
@@ -1155,7 +1142,7 @@ msgstr ""
1155
  "répéter la même clef à l'envers."
1156
 
1157
  # @ relevanssi
1158
- #: lib/interface.php:1381
1159
  msgid ""
1160
  "<p>Enter a word here to add it to the list of stopwords. The word will "
1161
  "automatically be removed from the index, so re-indexing is not necessary. "
@@ -1167,12 +1154,17 @@ msgstr ""
1167
  "une virgule.</p>"
1168
 
1169
  # @ relevanssi
1170
- #: lib/interface.php:1383
1171
  msgid "Stopword(s) to add: "
1172
  msgstr "Stopword(s) à ajouter: "
1173
 
1174
  # @ relevanssi
1175
- #: lib/interface.php:1387
 
 
 
 
 
1176
  msgid ""
1177
  "<p>Here's a list of stopwords in the database. Click a word to remove it "
1178
  "from stopwords. Removing stopwords won't automatically return them to index, "
@@ -1185,7 +1177,12 @@ msgstr ""
1185
  "les billet après retrait de stopwords pour les réinjecter dans l'index."
1186
 
1187
  # @ relevanssi
1188
- #: lib/interface.php:1419
 
 
 
 
 
1189
  msgid ""
1190
  "Here's a list of stopwords you can use to export the stopwords to another "
1191
  "blog."
@@ -1196,6 +1193,62 @@ msgstr ""
1196
  "les billet après retrait de stopwords pour les réinjecter dans l'index."
1197
 
1198
  # @ relevanssi
1199
- #: lib/uninstall.php:41
1200
  msgid "Data wiped clean, you can now delete the plugin."
1201
  msgstr "Données effacées, vous pouvez maintenant supprimer le plugin."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  msgstr ""
3
  "Project-Id-Version: Relevanssi v1.4\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2014-12-16 22:33+0100\n"
6
+ "PO-Revision-Date: 2014-12-16 22:34+0100\n"
7
  "Last-Translator: Li-An <lian00@gmail.com>\n"
8
  "Language-Team: \n"
9
  "Language: fr_FR\n"
15
  "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
16
  "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
17
  "X-Textdomain-Support: yes\n"
18
+ "X-Generator: Poedit 1.7.1\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
 
 
 
 
 
 
 
 
 
 
 
21
  # @ default
22
  #: lib/excerpts-highlights.php:11
23
  msgid "There is no excerpt because this is a protected post."
24
  msgstr "Il n'y a aucun extrait car ce billet est protégé."
25
 
26
  # @ relevanssi
27
+ #: lib/indexing.php:118
28
  msgid "Indexing complete!"
29
  msgstr "Indexation complète !"
30
 
31
  # @ default
32
+ #: lib/init.php:41
 
33
  msgid ""
34
+ "You do not have an index! Remember to build the index (click the \"Build the "
35
+ "index\" button), otherwise searching won't work."
 
36
  msgstr ""
37
+ "Vous n'avez pas d'index! N'oubliez pas de construire l'index (cliquez sur le "
38
+ "bouton \"Construire l'index\" sinon la recherche ne fonctionnera pas."
 
39
 
40
  # @ relevanssi
41
+ #: lib/init.php:86 lib/init.php:87
42
  msgid "User searches"
43
  msgstr "Recherches par les utilisateurs"
44
 
53
  msgstr "Options de recherche de Relevanssi"
54
 
55
  # @ relevanssi
56
+ #: lib/interface.php:80
57
  msgid "User Searches"
58
  msgstr "Recherches par les utilisateurs"
59
 
60
  # @ relevanssi
61
+ #: lib/interface.php:82
62
  msgid "Relevanssi User Searches"
63
  msgstr "Recherches Relevanssi par les utilisateurs"
64
 
65
  # @ relevanssi
66
+ #: lib/interface.php:319
67
  #, php-format
68
  msgid ""
69
  "<div id='message' class='updated fade'><p>Successfully added %d/%d terms to "
73
  "stopwords!</p></div>"
74
 
75
  # @ relevanssi
76
+ #: lib/interface.php:326
77
  #, php-format
78
  msgid ""
79
  "<div id='message' class='updated fade'><p>Term '%s' added to stopwords!</p></"
83
  "p></div>"
84
 
85
  # @ relevanssi
86
+ #: lib/interface.php:329
87
  #, php-format
88
  msgid ""
89
  "<div id='message' class='updated fade'><p>Couldn't add term '%s' to "
93
  "stopwords!</p></div>"
94
 
95
  # @ relevanssi
96
+ #: lib/interface.php:366
97
  msgid ""
98
  "<div id='message' class='updated fade'><p>Stopwords removed! Remember to re-"
99
  "index.</p></div>"
102
  "de réindexer.</p></div>"
103
 
104
  # @ relevanssi
105
+ #: lib/interface.php:376
106
  #, php-format
107
  msgid ""
108
  "<div id='message' class='updated fade'><p>Term '%s' removed from stopwords! "
112
  "Réindexer pour le récupérer dans l'index.</p></div>"
113
 
114
  # @ relevanssi
115
+ #: lib/interface.php:379
116
  #, php-format
117
  msgid ""
118
  "<div id='message' class='updated fade'><p>Couldn't remove term '%s' from "
122
  "stopwords !</p></div>"
123
 
124
  # @ relevanssi
125
+ #: lib/interface.php:390
126
  msgid "25 most common words in the index"
127
  msgstr "Les 25 mots des plus fréquents de l'index"
128
 
129
  # @ relevanssi
130
+ #: lib/interface.php:392
131
  msgid ""
132
  "These words are excellent stopword material. A word that appears in most of "
133
  "the posts in the database is quite pointless when searching. This is also an "
144
  "retiré de l'index aussi est-il inutile de reconstruire l'index."
145
 
146
  # @ relevanssi
147
+ #: lib/interface.php:418
148
  msgid "Add to stopwords"
149
  msgstr "Ajouter aux stopwords."
150
 
151
+ #: lib/interface.php:429
152
  msgid "Total Searches"
153
  msgstr "Nombre de recherches total"
154
 
155
+ #: lib/interface.php:432
156
  msgid "Totals"
157
  msgstr "Totaux"
158
 
159
+ #: lib/interface.php:437
160
  msgid "Common Queries"
161
  msgstr "Requêtes en commun"
162
 
163
  # @ relevanssi
164
+ #: lib/interface.php:439
165
  msgid ""
166
  "Here you can see the 20 most common user search queries, how many times "
167
  "those \n"
173
  "pour ces requêtes."
174
 
175
  # @ relevanssi
176
+ #: lib/interface.php:445 lib/interface.php:461 lib/interface.php:493
177
  msgid "Today and yesterday"
178
  msgstr "Aujourd'hui et hier"
179
 
180
  # @ relevanssi
181
+ #: lib/interface.php:449 lib/interface.php:465 lib/interface.php:494
182
  msgid "Last 7 days"
183
  msgstr "Sept derniers jours"
184
 
185
  # @ relevanssi
186
+ #: lib/interface.php:453 lib/interface.php:469 lib/interface.php:495
187
  msgid "Last 30 days"
188
  msgstr "Trente derniers jours"
189
 
190
  # @ relevanssi
191
+ #: lib/interface.php:458
192
  msgid "Unsuccessful Queries"
193
  msgstr "Requêtes sans résultat"
194
 
195
+ #: lib/interface.php:476
196
  msgid "Reset Logs"
197
  msgstr "Remettre à zéro les logs"
198
 
199
+ #: lib/interface.php:479
200
  #, php-format
201
  msgid "To reset the logs, type \"reset\" into the box here %s and click %s"
202
  msgstr ""
203
  "Pour remettre à zéro les logs, tapez \"reset\" dans le champ ici %s et "
204
  "cliquez %s"
205
 
206
+ #: lib/interface.php:496
207
  msgid "Forever"
208
  msgstr "Pour toujours"
209
 
210
+ #: lib/interface.php:498
211
  msgid "When"
212
  msgstr "Quand"
213
 
214
  # @ relevanssi
215
+ #: lib/interface.php:498
216
  msgid "Searches"
217
  msgstr "Recherches"
218
 
219
+ #: lib/interface.php:528
220
  msgid "Query"
221
  msgstr "Requête"
222
 
223
+ #: lib/interface.php:528
224
  msgid "Hits"
225
  msgstr "Hits"
226
 
227
  # @ relevanssi
228
+ #: lib/interface.php:837 lib/interface.php:877
229
  msgid "Basic options"
230
  msgstr "Options basiques"
231
 
232
+ #: lib/interface.php:838 lib/interface.php:943
233
  msgid "Weights"
234
  msgstr "Poids"
235
 
236
  # @ relevanssi
237
+ #: lib/interface.php:839 lib/interface.php:998
238
  msgid "Logs"
239
  msgstr "Logs"
240
 
241
  # @ relevanssi
242
+ #: lib/interface.php:840 lib/interface.php:1027
243
  msgid "Exclusions and restrictions"
244
  msgstr "Exclusions et restrictions"
245
 
246
  # @ relevanssi
247
+ #: lib/interface.php:841
248
  msgid "Custom excerpts"
249
  msgstr "Extraits personnalisés"
250
 
251
  # @ relevanssi
252
+ #: lib/interface.php:842
253
  msgid "Highlighting search results"
254
  msgstr "Mise en évidence des résultats de recherche"
255
 
256
  # @ relevanssi
257
+ #: lib/interface.php:843 lib/interface.php:1179
258
  msgid "Indexing options"
259
  msgstr "Options d'indexation"
260
 
261
  # @ relevanssi
262
+ #: lib/interface.php:844 lib/interface.php:1327
 
 
 
 
 
263
  msgid "Synonyms"
264
  msgstr "Synonymes"
265
 
266
  # @ relevanssi
267
+ #: lib/interface.php:845 lib/interface.php:1337
268
  msgid "Stopwords"
269
  msgstr "Stopwords"
270
 
271
+ #: lib/interface.php:848
272
  msgid "Import/export options"
273
  msgstr "Import/export des options"
274
 
275
+ #: lib/interface.php:851
276
  msgid "Buy Relevanssi Premium"
277
  msgstr "Achetez Relevanssi Premium"
278
 
279
  # @ relevanssi
280
+ #: lib/interface.php:856
281
  msgid "Quick tools"
282
  msgstr "Outils rapides"
283
 
284
  # @ relevanssi
285
+ #: lib/interface.php:858
286
+ msgid "Save options"
287
+ msgstr "Sauvegarder les options"
288
+
289
+ # @ relevanssi
290
+ #: lib/interface.php:859
291
+ msgid "Build the index"
292
+ msgstr "Construire l'index"
293
+
294
+ # @ relevanssi
295
+ #: lib/interface.php:860 lib/interface.php:1325
296
+ msgid "Continue indexing"
297
+ msgstr "Continuer l'indexation"
298
+
299
+ # @ relevanssi
300
+ #: lib/interface.php:860
301
  msgid "add"
302
  msgstr "ajouter"
303
 
304
  # @ relevanssi
305
+ #: lib/interface.php:860
306
  msgid "documents."
307
  msgstr "documents."
308
 
309
+ #: lib/interface.php:864
310
  msgid ""
311
  "WARNING: You've chosen no post types to index. Nothing will be indexed. <a "
312
  "href='#indexing'>Choose some post types to index</a>."
315
  "indexé.<a href='#indexing'>Choisissez les types de billet à indexer</a>."
316
 
317
  # @ relevanssi
318
+ #: lib/interface.php:868
319
  msgid ""
320
  "Use 'Build the index' to build the index with current <a "
321
  "href='#indexing'>indexing options</a>. If you can't finish indexing with one "
333
  "de documents actuellement pris en compte dans l'indexation."
334
 
335
  # @ relevanssi
336
+ #: lib/interface.php:870
337
  msgid "State of the Index"
338
  msgstr "État de l'index"
339
 
340
  # @ relevanssi
341
+ #: lib/interface.php:872
342
  msgid "Documents in the index"
343
  msgstr "Documents dans l'index"
344
 
345
  # @ relevanssi
346
+ #: lib/interface.php:873
347
  msgid "Terms in the index"
348
  msgstr "Termes dans l'index"
349
 
350
  # @ relevanssi
351
+ #: lib/interface.php:874
352
  msgid "Highest post ID indexed"
353
  msgstr "ID de billet le plus élevé indexé"
354
 
355
  # @ relevanssi
356
+ #: lib/interface.php:883
357
  msgid "Use search for admin:"
358
  msgstr "Utiliser la recherche pour l'administration:"
359
 
360
  # @ relevanssi
361
+ #: lib/interface.php:885
362
  msgid "If checked, Relevanssi will be used for searches in the admin interface"
363
  msgstr ""
364
  "Si coché, Relevanssi sera utilisé pour les recherches dans l'interface "
365
  "d'administration"
366
 
367
  # @ relevanssi
368
+ #: lib/interface.php:889
369
  msgid "Default operator for the search?"
370
  msgstr "Opérateur logique par défaut pour la recherche ?"
371
 
372
  # @ relevanssi
373
+ #: lib/interface.php:891
374
  msgid "AND - require all terms"
375
  msgstr "ET - nécessite tous les termes"
376
 
377
  # @ relevanssi
378
+ #: lib/interface.php:892
379
  msgid "OR - any term present is enough"
380
  msgstr "OU - n'importe lequel des termes présents est suffisant"
381
 
382
  # @ relevanssi
383
+ #: lib/interface.php:894
384
  msgid ""
385
  "If you choose AND and the search finds no matches, it will automatically do "
386
  "an OR search."
389
  "lancée automatiquement."
390
 
391
  # @ relevanssi
392
+ #: lib/interface.php:898
393
  msgid "Disable OR fallback:"
394
  msgstr "Désactiver le passage à OU:"
395
 
396
  # @ relevanssi
397
+ #: lib/interface.php:900
398
  msgid ""
399
  "If you don't want Relevanssi to fall back to OR search when AND search gets "
400
  "no hits, check this option. For most cases, leave this one unchecked."
404
  "plupart des cas, laissez la décochée."
405
 
406
  # @ relevanssi
407
+ #: lib/interface.php:904
408
  msgid "Default order for results:"
409
  msgstr "Ordre par défaut pour les résultats:"
410
 
411
  # @ relevanssi
412
+ #: lib/interface.php:906
413
  msgid "Relevance (highly recommended)"
414
  msgstr "Pertinence (hautement recommandé)"
415
 
416
  # @ relevanssi
417
+ #: lib/interface.php:907
418
  msgid "Post date"
419
  msgstr "Date de billet"
420
 
421
+ #: lib/interface.php:909
422
  msgid ""
423
  "If you want date-based results, see the recent post bonus in the Weights "
424
  "section."
427
  "bonus pour billet dans la section Poids."
428
 
429
  # @ relevanssi
430
+ #: lib/interface.php:913
431
  msgid "When to use fuzzy matching?"
432
  msgstr "Quand utiliser la correspondance approximative ?"
433
 
434
  # @ relevanssi
435
+ #: lib/interface.php:915
436
  msgid "When straight search gets no hits"
437
  msgstr "Quand la recherche directe ne donne pas de résultat"
438
 
439
  # @ relevanssi
440
+ #: lib/interface.php:916
441
  msgid "Always"
442
  msgstr "Toujours"
443
 
444
  # @ relevanssi
445
+ #: lib/interface.php:917
446
  msgid "Don't use fuzzy search"
447
  msgstr "Ne pas utiliser l'approximation"
448
 
449
  # @ relevanssi
450
+ #: lib/interface.php:919
451
  msgid ""
452
  "Straight search matches just the term. Fuzzy search matches everything that "
453
  "begins or ends with the search term."
456
  "prend en compte tout ce qui commence ou finit par le terme recherché."
457
 
458
  # @ relevanssi
459
+ #: lib/interface.php:927
460
  msgid "Limit searches:"
461
  msgstr "Limiter les recherches:"
462
 
463
+ #: lib/interface.php:929
464
  msgid ""
465
  "If this option is checked, Relevanssi will limit search results to at most "
466
  "500 results per term. This will improve performance, but may cause some "
477
  "par date.</strong> Le tri peut être amené à mettre de côté des billets "
478
  "récents pour favoriser des billets plus pertinents."
479
 
480
+ #: lib/interface.php:933
481
  msgid "Limit:"
482
  msgstr "Limite:"
483
 
484
+ #: lib/interface.php:935
485
+ #, php-format
486
  msgid ""
487
  "For better performance, adjust the limit to a smaller number. Adjusting the "
488
+ "limit to 100 or 200 should be safe for good results, and might bring a boost "
489
+ "in search speed. DO NOT use this feature to limit the number of search "
490
+ "results on search results pages, as that will lead to problems. For "
491
+ "adjusting the number of search results displayed, see <a href='%s'>this "
492
+ "knowledge base entry</a>."
493
  msgstr ""
494
  "Pour de meilleures performances, ajustez la limite à un nombre plus petit. "
495
+ "Ajuster la limite à 100 ou 200 devrait être sans danger pour de bons "
496
+ "résultats et pourrait apporter un boost dans la vitesse de recherche. NE PAS "
497
+ "utiliser cette fonction pour limiter le nombre de résultats de recherche sur "
498
+ "les pages de résultat, ce qui pourrait conduire à des problèmes. Pour "
499
+ "ajuster le nombre de résultats de recherche affichés, veuillez lire <a "
500
+ "href='%s'>cette entrée de la base de connaissance</a>."
501
 
502
  # @ relevanssi
503
+ #: lib/interface.php:945
504
  msgid ""
505
  "These values affect the weights of the documents. These are all multipliers, "
506
  "so 1 means no change in weight, less than 1 means less weight, and more than "
517
  "les mêmes mots partout ailleurs. Si le poids du titre vaut 0, les mots dans "
518
  "le titre n'affecteront pas les résultats de recherche."
519
 
520
+ #: lib/interface.php:950
521
  msgid "Element"
522
  msgstr "Élément"
523
 
524
+ #: lib/interface.php:951
525
  msgid "Weight"
526
  msgstr "Poids"
527
 
528
  # @ relevanssi
529
+ #: lib/interface.php:952
530
  msgid "Default weight"
531
  msgstr "Poids par défaut"
532
 
533
  # @ relevanssi
534
+ #: lib/interface.php:957
535
  msgid "Post titles"
536
  msgstr "Titres de billet"
537
 
538
  # @ relevanssi
539
+ #: lib/interface.php:969
540
  msgid "Comment text"
541
  msgstr "Text de commentaire"
542
 
543
  # @ relevanssi
544
+ #: lib/interface.php:990
545
  msgid "WPML/Polylang compatibility"
546
  msgstr "Compatibilité WPML/Polylang"
547
 
548
  # @ relevanssi
549
+ #: lib/interface.php:992
550
  msgid "Limit results to current language:"
551
  msgstr "Limiter les résultats au langage suivant:"
552
 
553
  # @ relevanssi
554
+ #: lib/interface.php:994
555
  msgid ""
556
  "If this option is checked, Relevanssi will only return results in the "
557
  "current active language. Otherwise results will include posts in every "
562
  "billets dans tous les langages."
563
 
564
  # @ relevanssi
565
+ #: lib/interface.php:1000
566
  msgid "Keep a log of user queries:"
567
  msgstr "Conserver une liste des recherches des visiteurs:"
568
 
569
  # @ relevanssi
570
+ #: lib/interface.php:1002
571
  msgid ""
572
  "If checked, Relevanssi will log user queries. The log appears in 'User "
573
  "searches' on the Dashboard admin menu."
576
  "Les stats apparaissent dans 'Recherches d'utilisateur' dans le menu du "
577
  "tableau de bord de l'administration."
578
 
579
+ #: lib/interface.php:1006
580
  msgid "Log the user's IP with the queries:"
581
  msgstr "Enregistrer l'adresse IP de l'utilisateur avec ses requêtes:"
582
 
583
  # @ relevanssi
584
+ #: lib/interface.php:1008
585
  msgid "If checked, Relevanssi will log user's IP-Adress with the queries."
586
  msgstr ""
587
  "Si coché, Relevanssi enregistrera les adresses IP des utilisateurs avec "
588
  "leurs requêtes."
589
 
590
  # @ relevanssi
591
+ #: lib/interface.php:1012
592
  msgid "Don't log queries from these users:"
593
  msgstr "Ne conservez pas les statistiques de recherche de ces utilisateurs:"
594
 
595
  # @ relevanssi
596
+ #: lib/interface.php:1014
597
  msgid ""
598
  "Comma-separated list of numeric user IDs or user login names that will not "
599
  "be logged."
602
  "seront pas pris en compte."
603
 
604
  # @ relevanssi
605
+ #: lib/interface.php:1018
606
  msgid ""
607
  "If you enable logs, you can see what your users are searching for. You can "
608
  "prevent your own searches from getting in the logs with the omit feature."
612
  "réglage d'exemption."
613
 
614
  # @ relevanssi
615
+ #: lib/interface.php:1021
616
  msgid ""
617
  "If you enable logs, you can see what your users are searching for. Logs are "
618
  "also needed to use the 'Did you mean?' feature. You can prevent your own "
624
  "avec la fonction d'exception."
625
 
626
  # @ relevanssi
627
+ #: lib/interface.php:1029
628
  msgid "Restrict search to these categories and tags:"
629
  msgstr "Restreindre la recherche à ces catégories et tags:"
630
 
631
  # @ relevanssi
632
+ #: lib/interface.php:1031
633
  msgid ""
634
  "Enter a comma-separated list of category and tag IDs to restrict search to "
635
  "those categories or tags. You can also use <code>&lt;input type='hidden' "
643
  "sur ce réglage."
644
 
645
  # @ relevanssi
646
+ #: lib/interface.php:1035
647
+ msgid "Exclude these categories from search:"
648
+ msgstr "Exclure ces catégories de la recherche:"
649
 
650
  # @ relevanssi
651
+ #: lib/interface.php:1037
652
  msgid ""
653
+ "Enter a comma-separated list of category IDs that are excluded from search "
654
+ "results."
 
655
  msgstr ""
656
+ "Entrez une liste d'ID de catégories à exclure des résultats de recherche."
 
 
657
 
658
  # @ relevanssi
659
+ #: lib/interface.php:1041
660
+ msgid "Exclude these tags from search:"
661
+ msgstr "Exclure ces mots-clef de la recherche:"
662
+
663
+ # @ relevanssi
664
+ #: lib/interface.php:1043
665
+ msgid ""
666
+ "Enter a comma-separated list of tag IDs that are excluded from search "
667
+ "results."
668
+ msgstr ""
669
+ "Entrez une liste d'ID de mots-clef à exclure des résultats de recherche."
670
+
671
+ # @ relevanssi
672
+ #: lib/interface.php:1047
673
  msgid "Exclude these posts/pages from search:"
674
  msgstr "Exclure ces billets/pages de la recherche:"
675
 
676
  # @ relevanssi
677
+ #: lib/interface.php:1051
678
  msgid ""
679
  "Enter a comma-separated list of post/page IDs that are excluded from search "
680
  "results. This only works here, you can't use the input field option "
688
  "d'éditions des billets/pages pour retirer des billetx de l'index."
689
 
690
  # @ relevanssi
691
+ #: lib/interface.php:1054
692
  msgid ""
693
  "Enter a comma-separated list of post/page IDs that are excluded from search "
694
  "results. This only works here, you can't use the input field option "
700
  "dans ce cas). "
701
 
702
  # @ relevanssi
703
+ #: lib/interface.php:1060
704
  msgid "Respect exclude_from_search for custom post types:"
705
  msgstr "Respecter exclude_from_search pour les types de billets personnalisés:"
706
 
707
  # @ relevanssi
708
+ #: lib/interface.php:1062
709
  msgid ""
710
  "If checked, Relevanssi won't display posts of custom post types that have "
711
  "'exclude_from_search' set to true. If not checked, Relevanssi will display "
716
  "coché, Relevanssi affichera tout ce qui est indexé."
717
 
718
  # @ relevanssi
719
+ #: lib/interface.php:1064
720
  msgid "Custom excerpts/snippets"
721
  msgstr "Personnaliser extraits/snippets"
722
 
723
  # @ relevanssi
724
+ #: lib/interface.php:1066
725
  msgid "Create custom search result snippets:"
726
  msgstr "Créer des snippets personalisés de résultats de recherche:"
727
 
728
  # @ relevanssi
729
+ #: lib/interface.php:1068
730
  msgid ""
731
  "If checked, Relevanssi will create excerpts that contain the search term "
732
  "hits. To make them work, make sure your search result template uses "
737
  "de thème de résultat de recherche utilise the_excerpt() pour afficher les "
738
  "extraits de billet."
739
 
740
+ #: lib/interface.php:1070
741
  msgid ""
742
  "Note: Building custom excerpts can be slow. If you are not actually using "
743
  "the excerpts, make sure you disable the option."
746
  "n'utilisez pas les extraits, soyez certain de désactiver cette option."
747
 
748
  # @ relevanssi
749
+ #: lib/interface.php:1072
750
  msgid "Length of the snippet:"
751
  msgstr "Longueur du snippet:"
752
 
753
  # @ relevanssi
754
+ #: lib/interface.php:1075
755
  msgid "characters"
756
  msgstr "lettres"
757
 
758
  # @ relevanssi
759
+ #: lib/interface.php:1076
760
  msgid "words"
761
  msgstr "mots"
762
 
763
  # @ relevanssi
764
+ #: lib/interface.php:1078
765
  msgid "This must be an integer."
766
  msgstr "Ceci doit être un nombre entier."
767
 
768
+ #: lib/interface.php:1082
769
  msgid "Allowable tags in excerpts:"
770
  msgstr "Mots-clefs autorisés dans les extraits:"
771
 
772
+ #: lib/interface.php:1085
773
  msgid ""
774
  "List all tags you want to allow in excerpts, without any whitespace. For "
775
  "example: '&lt;p&gt;&lt;a&gt;&lt;strong&gt;'."
778
  "aucun espace. Par exemple: '&lt;p&gt;&lt;a&gt;&lt;strong&gt;'."
779
 
780
  # @ relevanssi
781
+ #: lib/interface.php:1089
782
  msgid "Show breakdown of search hits in excerpts:"
783
  msgstr "Montrer la répartition des résultats de recherche dans les extraits:"
784
 
785
  # @ relevanssi
786
+ #: lib/interface.php:1091
787
  msgid ""
788
  "Check this to show more information on where the search hits were made. "
789
  "Requires custom snippets to work."
793
  "pour fonctionner."
794
 
795
  # @ relevanssi
796
+ #: lib/interface.php:1095
797
  msgid "The breakdown format:"
798
  msgstr "Mise en forme des répartitions:"
799
 
800
  # @ relevanssi
801
+ #: lib/interface.php:1097
802
  msgid ""
803
  "Use %body%, %title%, %tags% and %comments% to display the number of hits (in "
804
  "different parts of the post), %total% for total hits, %score% to display the "
812
  "chacun des termes recherché. Interdit d'utiliser des guillemets (\")!"
813
 
814
  # @ relevanssi
815
+ #: lib/interface.php:1099
816
  msgid "Search hit highlighting"
817
  msgstr "Surbrillance des résultats de recherche"
818
 
819
  # @ relevanssi
820
+ #: lib/interface.php:1101
821
  msgid "First, choose the type of highlighting used:"
822
  msgstr "En premier, veuillez choisir le type de surbrillance utilisée:"
823
 
824
  # @ relevanssi
825
+ #: lib/interface.php:1104
826
  msgid "Highlight query terms in search results:"
827
  msgstr ""
828
  "Mettre en surbrillance les termes de recherche dans les résultats de "
829
  "recherche:"
830
 
831
  # @ relevanssi
832
+ #: lib/interface.php:1106
833
  msgid "No highlighting"
834
  msgstr "Pas de mise en surbrillance"
835
 
836
  # @ relevanssi
837
+ #: lib/interface.php:1110
838
  msgid "Text color"
839
  msgstr "Couleur du texte"
840
 
841
  # @ relevanssi
842
+ #: lib/interface.php:1111
843
  msgid "Background color"
844
  msgstr "Couleur du fond"
845
 
846
  # @ relevanssi
847
+ #: lib/interface.php:1112
848
  msgid "CSS Style"
849
  msgstr "Style CSS"
850
 
851
  # @ relevanssi
852
+ #: lib/interface.php:1113
853
  msgid "CSS Class"
854
  msgstr "Classe CSS"
855
 
856
  # @ relevanssi
857
+ #: lib/interface.php:1115
858
  msgid "Highlighting isn't available unless you use custom snippets"
859
  msgstr ""
860
  "La mise en surbrillance n'est pas disponible tant que vous n'avez pas activé "
861
  "l'utilisation de snippets personnalisés."
862
 
863
  # @ relevanssi
864
+ #: lib/interface.php:1119
865
  msgid "Highlight query terms in result titles too:"
866
  msgstr "Mettre en surbrillance les mots recherchés dans le titre également:"
867
 
868
  # @ relevanssi
869
+ #: lib/interface.php:1125
870
  msgid "Highlight query terms in documents from local searches:"
871
  msgstr ""
872
  "Mettre en évidence les termes de la requête dans les documents pour les "
873
  "recherches locales:"
874
 
875
  # @ relevanssi
876
+ #: lib/interface.php:1127
877
  msgid ""
878
  "Highlights hits when user opens the post from search results. This is based "
879
  "on HTTP referrer, so if that's blocked, there'll be no highlights."
883
  "cas de blocage, il y aura pas de surlignage."
884
 
885
  # @ relevanssi
886
+ #: lib/interface.php:1133
887
  msgid "Highlight query terms in comments:"
888
  msgstr "Surligner les termes recherchés dans les commentaires:"
889
 
890
  # @ relevanssi
891
+ #: lib/interface.php:1135
892
  msgid ""
893
  "Highlights hits in comments when user opens the post from search results."
894
  msgstr ""
896
  "ouvre le billet à partir des résultats de recherche."
897
 
898
  # @ relevanssi
899
+ #: lib/interface.php:1139
900
  msgid "Uncheck this if you use non-ASCII characters:"
901
  msgstr "Décochez ceci si vous utilisez des caractères non-ASCII:"
902
 
903
  # @ relevanssi
904
+ #: lib/interface.php:1141
905
  msgid ""
906
  "If you use non-ASCII characters (like Cyrillic alphabet) and the highlights "
907
  "don't work, uncheck this option to make highlights work."
911
  "fonctionner le surlignage."
912
 
913
  # @ relevanssi
914
+ #: lib/interface.php:1146
915
  msgid "Then adjust the settings for your chosen type:"
916
  msgstr "Ensuite ajustez les réglages du type choisi:"
917
 
918
  # @ relevanssi
919
+ #: lib/interface.php:1150
920
  msgid "Text color for highlights:"
921
  msgstr "Couleur du texte pour la surbrillance:"
922
 
923
  # @ relevanssi
924
+ #: lib/interface.php:1152 lib/interface.php:1158
925
  msgid "Use HTML color codes (#rgb or #rrggbb)"
926
  msgstr "Utiliser les codes de couleurs HTML (#rgb ou #rrggbb)"
927
 
928
  # @ relevanssi
929
+ #: lib/interface.php:1156
930
  msgid "Background color for highlights:"
931
  msgstr "Couleur du fond pour la surbrillance:"
932
 
933
  # @ relevanssi
934
+ #: lib/interface.php:1162
935
  msgid "CSS style for highlights:"
936
  msgstr "Style CSS pour la surbrillance:"
937
 
938
  # @ relevanssi
939
+ #: lib/interface.php:1164
940
  msgid ""
941
  "You can use any CSS styling here, style will be inserted with a &lt;span&gt;"
942
  msgstr ""
944
  "&lt;span&gt;"
945
 
946
  # @ relevanssi
947
+ #: lib/interface.php:1168
948
  msgid "CSS class for highlights:"
949
  msgstr "Classe CSS pour la surbrillance:"
950
 
951
  # @ relevanssi
952
+ #: lib/interface.php:1170
953
  msgid ""
954
  "Name a class here, search results will be wrapped in a &lt;span&gt; with the "
955
  "class"
958
  "avec cette classe"
959
 
960
  # @ relevanssi
961
+ #: lib/interface.php:1177 lib/interface.php:1335
962
+ msgid "Save the options"
963
+ msgstr "Sauvegarder les options"
964
+
965
+ # @ relevanssi
966
+ #: lib/interface.php:1181
967
  msgid "Choose post types to index:"
968
  msgstr "Veuillez choisir les types de billets personnalisés à indexer:"
969
 
970
+ #: lib/interface.php:1186
971
  msgid "Type"
972
  msgstr "Type"
973
 
974
+ #: lib/interface.php:1187 lib/interface.php:1233
975
  msgid "Index"
976
  msgstr "Index"
977
 
978
+ #: lib/interface.php:1188 lib/interface.php:1234
979
  msgid "Public?"
980
  msgstr "Publique ?"
981
 
982
+ #: lib/interface.php:1205 lib/interface.php:1248
983
  #, php-format
984
  msgid "%s"
985
  msgstr "%s"
986
 
987
+ #: lib/interface.php:1206 lib/interface.php:1249
988
  msgid "yes"
989
  msgstr "oui"
990
 
991
  # @ relevanssi
992
+ #: lib/interface.php:1206 lib/interface.php:1249
993
  msgid "no"
994
  msgstr "non"
995
 
996
  # @ relevanssi
997
+ #: lib/interface.php:1227
998
  msgid "Choose taxonomies to index:"
999
  msgstr "Veuillez choisir les taxonomie à indexer:"
1000
 
1001
+ #: lib/interface.php:1232
1002
  msgid "Taxonomy"
1003
  msgstr "Taxonomie"
1004
 
1005
+ #: lib/interface.php:1269
1006
  msgid ""
1007
  "If you check a taxonomy here, the terms for that taxonomy are indexed with "
1008
  "the posts. If you for example choose \"post_tag\", searching for tags will "
1014
  "mot-clef."
1015
 
1016
  # @ relevanssi
1017
+ #: lib/interface.php:1273
1018
  msgid "Minimum word length to index"
1019
  msgstr "Longueur minimum des mots à indexer"
1020
 
1021
  # @ relevanssi
1022
+ #: lib/interface.php:1275
1023
  msgid "Words shorter than this number will not be indexed."
1024
  msgstr "Les mots plus courts que ce nombre ne seront pas indexés."
1025
 
1026
  # @ relevanssi
1027
+ #: lib/interface.php:1281
1028
  msgid "Expand shortcodes in post content:"
1029
  msgstr "Traduire les shortcodes dans le contenu des billets:"
1030
 
1031
  # @ relevanssi
1032
+ #: lib/interface.php:1283
1033
  msgid ""
1034
  "If checked, Relevanssi will expand shortcodes in post content before "
1035
  "indexing. Otherwise shortcodes will be stripped. If you use shortcodes to "
1044
  "shortcode au moment de l'indexation."
1045
 
1046
  # @ relevanssi
1047
+ #: lib/interface.php:1289
1048
  msgid "Index and search your posts' authors:"
1049
  msgstr "Indexer et rechercher les auteurs des billets:"
1050
 
1051
  # @ relevanssi
1052
+ #: lib/interface.php:1291
1053
  msgid ""
1054
  "If checked, Relevanssi will also index and search the authors of your posts. "
1055
  "Author display name will be indexed. Remember to rebuild the index if you "
1060
  "reconstruire l'index si vous modifiez cette option !"
1061
 
1062
  # @ relevanssi
1063
+ #: lib/interface.php:1295
1064
  msgid "Index and search post excerpts:"
1065
  msgstr "Indexer et rechercher dans les extraits de billets:"
1066
 
1067
  # @ relevanssi
1068
+ #: lib/interface.php:1297
1069
  msgid ""
1070
  "If checked, Relevanssi will also index and search the excerpts of your posts."
1071
  "Remember to rebuild the index if you change this option!"
1074
  "N'oubliez pas de reconstruire l'index si vous modifiez cette option !"
1075
 
1076
  # @ relevanssi
1077
+ #: lib/interface.php:1301
1078
  msgid "Index and search these comments:"
1079
  msgstr "Indexer et rechercher ces commentaires:"
1080
 
1081
  # @ relevanssi
1082
+ #: lib/interface.php:1303
1083
  msgid "none"
1084
  msgstr "aucun"
1085
 
1086
  # @ relevanssi
1087
+ #: lib/interface.php:1304
1088
  msgid "normal"
1089
  msgstr "normal"
1090
 
1091
  # @ relevanssi
1092
+ #: lib/interface.php:1305
1093
  msgid "all"
1094
  msgstr "tout"
1095
 
1096
  # @ relevanssi
1097
+ #: lib/interface.php:1307
1098
  msgid ""
1099
  "Relevanssi will index and search ALL (all comments including track- &amp; "
1100
  "pingbacks and custom comment types), NONE (no comments) or NORMAL (manually "
1107
  "<br />N'oubliez pas de reconstruire l'index si vous modifiez cette option !"
1108
 
1109
  # @ relevanssi
1110
+ #: lib/interface.php:1311
1111
  msgid "Custom fields to index:"
1112
  msgstr "Champs personnalisés à indexer:"
1113
 
1114
+ #: lib/interface.php:1313
1115
  msgid ""
1116
  "A comma-separated list of custom fields to include in the index. Set to "
1117
  "'visible' to index all visible custom fields and to 'all' to index all "
1122
  "visibles et 'tout' pour indexer tous les champs personnalisés même ceux "
1123
  "commençant par le caractère '_' ."
1124
 
1125
+ #: lib/interface.php:1323
1126
+ msgid "Save indexing options, erase index and rebuild the index"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1127
  msgstr ""
1128
+ "Sauvegarder les options d'indexation, supprimer puis reconstruire l'index"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1129
 
1130
  # @ relevanssi
1131
+ #: lib/interface.php:1331
1132
  msgid ""
1133
  "Add synonyms here in 'key = value' format. When searching with the OR "
1134
  "operator, any search of 'key' will be expanded to include 'value' as well. "
1142
  "répéter la même clef à l'envers."
1143
 
1144
  # @ relevanssi
1145
+ #: lib/interface.php:1356
1146
  msgid ""
1147
  "<p>Enter a word here to add it to the list of stopwords. The word will "
1148
  "automatically be removed from the index, so re-indexing is not necessary. "
1154
  "une virgule.</p>"
1155
 
1156
  # @ relevanssi
1157
+ #: lib/interface.php:1358
1158
  msgid "Stopword(s) to add: "
1159
  msgstr "Stopword(s) à ajouter: "
1160
 
1161
  # @ relevanssi
1162
+ #: lib/interface.php:1359
1163
+ msgid "Add"
1164
+ msgstr "Ajouter"
1165
+
1166
+ # @ relevanssi
1167
+ #: lib/interface.php:1362
1168
  msgid ""
1169
  "<p>Here's a list of stopwords in the database. Click a word to remove it "
1170
  "from stopwords. Removing stopwords won't automatically return them to index, "
1177
  "les billet après retrait de stopwords pour les réinjecter dans l'index."
1178
 
1179
  # @ relevanssi
1180
+ #: lib/interface.php:1388
1181
+ msgid "Remove all stopwords"
1182
+ msgstr "Retirer tous les stopwords"
1183
+
1184
+ # @ relevanssi
1185
+ #: lib/interface.php:1394
1186
  msgid ""
1187
  "Here's a list of stopwords you can use to export the stopwords to another "
1188
  "blog."
1193
  "les billet après retrait de stopwords pour les réinjecter dans l'index."
1194
 
1195
  # @ relevanssi
1196
+ #: lib/uninstall.php:29
1197
  msgid "Data wiped clean, you can now delete the plugin."
1198
  msgstr "Données effacées, vous pouvez maintenant supprimer le plugin."
1199
+
1200
+ # @ relevanssi
1201
+ #: relevanssi.php:316
1202
+ msgid "Tag weight:"
1203
+ msgstr "Poids des mots-clef:"
1204
+
1205
+ # @ relevanssi
1206
+ #: relevanssi.php:331
1207
+ msgid "Category weight:"
1208
+ msgstr "Poids des catégories:"
1209
+
1210
+ # @ relevanssi
1211
+ #~ msgid "Caching"
1212
+ #~ msgstr "Mise en cache"
1213
+
1214
+ #~ msgid ""
1215
+ #~ "For better performance, adjust the limit to a smaller number. Adjusting "
1216
+ #~ "the limit to 100 - or even lower - should be safe for good results, and "
1217
+ #~ "might bring a boost in search speed."
1218
+ #~ msgstr ""
1219
+ #~ "Pour de meilleures performances, ajustez la limite à un nombre plus "
1220
+ #~ "petit. Ajuster la limite à 100 - et même en dessous - ne pose pas de "
1221
+ #~ "problèmes pour de bons résultats et est susceptible de booster la vitesse "
1222
+ #~ "de recherche."
1223
+
1224
+ # @ relevanssi
1225
+ #~ msgid ""
1226
+ #~ "Warning: In many cases caching is not useful, and in some cases can be "
1227
+ #~ "even harmful. Do not\n"
1228
+ #~ "\tactivate cache unless you have a good reason to do so."
1229
+ #~ msgstr ""
1230
+ #~ "Attention: dans de nombreux cas, le cache n'est pas utile et dans "
1231
+ #~ "certains cas il peut même causer du tort. Ne pas\n"
1232
+ #~ "\n"
1233
+ #~ "\\\tactiver le cache à moins que vous n'ayez une bonne raison."
1234
+
1235
+ # @ relevanssi
1236
+ #~ msgid "Enable result and excerpt caching:"
1237
+ #~ msgstr "Autoriser la mise en cache des résultats et d'extraits:"
1238
+
1239
+ # @ relevanssi
1240
+ #~ msgid "If checked, Relevanssi will cache search results and post excerpts."
1241
+ #~ msgstr ""
1242
+ #~ "Si coché, Relevanssi mettra en cache les résultats et extraits de billets."
1243
+
1244
+ # @ relevanssi
1245
+ #~ msgid "Cache expire (in seconds):"
1246
+ #~ msgstr "Expiration du coche (en secondes):"
1247
+
1248
+ # @ relevanssi
1249
+ #~ msgid "86400 = day"
1250
+ #~ msgstr "86400 = jour"
1251
+
1252
+ # @ relevanssi
1253
+ #~ msgid "Entries in the cache"
1254
+ #~ msgstr "Entrées dans le cache"
relevanssi.php CHANGED
@@ -3,12 +3,12 @@
3
  Plugin Name: Relevanssi
4
  Plugin URI: http://www.relevanssi.com/
5
  Description: This plugin replaces WordPress search with a relevance-sorting search.
6
- Version: 3.2
7
  Author: Mikko Saari
8
  Author URI: http://www.mikkosaari.fi/
9
  */
10
 
11
- /* Copyright 2013 Mikko Saari (email: mikko@mikkosaari.fi)
12
 
13
  This file is part of Relevanssi, a search plugin for WordPress.
14
 
@@ -40,20 +40,17 @@ global $relevanssi_variables;
40
  $relevanssi_variables['relevanssi_table'] = $wpdb->prefix . "relevanssi";
41
  $relevanssi_variables['stopword_table'] = $wpdb->prefix . "relevanssi_stopwords";
42
  $relevanssi_variables['log_table'] = $wpdb->prefix . "relevanssi_log";
43
- $relevanssi_variables['relevanssi_cache'] = $wpdb->prefix . "relevanssi_cache";
44
- $relevanssi_variables['relevanssi_excerpt_cache'] = $wpdb->prefix . "relevanssi_excerpt_cache";
45
  $relevanssi_variables['title_boost_default'] = 5;
46
  $relevanssi_variables['comment_boost_default'] = 0.75;
47
  $relevanssi_variables['post_type_weight_defaults']['post_tag'] = 0.75;
48
  $relevanssi_variables['post_type_weight_defaults']['category'] = 0.75;
49
  $relevanssi_variables['post_type_index_defaults'] = array('post', 'page');
50
- $relevanssi_variables['database_version'] = 4;
51
  $relevanssi_variables['file'] = __FILE__;
52
  $relevanssi_variables['plugin_dir'] = plugin_dir_path(__FILE__);
53
 
54
  require_once('lib/init.php');
55
  require_once('lib/interface.php');
56
- require_once('lib/cache.php');
57
  require_once('lib/indexing.php');
58
  require_once('lib/stopwords.php');
59
  require_once('lib/search.php');
@@ -105,6 +102,21 @@ function relevanssi_didyoumean($query, $pre, $post, $n = 5) {
105
 
106
  function relevanssi_check_old_data() {
107
  if (is_admin()) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  // Version 3.1.4 combined taxonomy indexing options
109
  $inctags = get_option('relevanssi_include_tags', 'nothing');
110
  if ($inctags == 'on') {
@@ -212,7 +224,7 @@ function relevanssi_check_old_data() {
212
  }
213
 
214
  function _relevanssi_install() {
215
- global $wpdb, $relevanssi_variables;
216
 
217
  add_option('relevanssi_title_boost', $relevanssi_variables['title_boost_default']);
218
  add_option('relevanssi_comment_boost', $relevanssi_variables['comment_boost_default']);
@@ -223,12 +235,14 @@ function _relevanssi_install() {
223
  add_option('relevanssi_css', 'text-decoration: underline; text-color: #ff0000');
224
  add_option('relevanssi_class', 'relevanssi-query-term');
225
  add_option('relevanssi_excerpts', 'on');
226
- add_option('relevanssi_excerpt_length', '450');
227
- add_option('relevanssi_excerpt_type', 'chars');
228
  add_option('relevanssi_excerpt_allowable_tags', '');
229
  add_option('relevanssi_log_queries', 'off');
 
230
  add_option('relevanssi_cat', '0');
231
  add_option('relevanssi_excat', '0');
 
232
  add_option('relevanssi_index_fields', '');
233
  add_option('relevanssi_exclude_posts', ''); //added by OdditY
234
  add_option('relevanssi_hilite_title', ''); //added by OdditY
@@ -236,7 +250,7 @@ function _relevanssi_install() {
236
  add_option('relevanssi_highlight_comments', 'off');
237
  add_option('relevanssi_index_comments', 'none'); //added by OdditY
238
  add_option('relevanssi_show_matches', '');
239
- add_option('relevanssi_show_matches_txt', '(Search hits: %body% in body, %title% in title, %tags% in tags, %comments% in comments. Score: %score%)');
240
  add_option('relevanssi_fuzzy', 'sometimes');
241
  add_option('relevanssi_indexed', '');
242
  add_option('relevanssi_expand_shortcodes', 'on');
@@ -245,13 +259,11 @@ function _relevanssi_install() {
245
  add_option('relevanssi_implicit_operator', 'OR');
246
  add_option('relevanssi_omit_from_logs', '');
247
  add_option('relevanssi_synonyms', '');
248
- add_option('relevanssi_index_excerpt', '');
249
  add_option('relevanssi_index_limit', '500');
250
  add_option('relevanssi_disable_or_fallback', 'off');
251
  add_option('relevanssi_respect_exclude', 'on');
252
- add_option('relevanssi_cache_seconds', '172800');
253
- add_option('relevanssi_enable_cache', 'off');
254
- add_option('relevanssi_min_word_length', 3);
255
  add_option('relevanssi_wpml_only_current', 'on');
256
  add_option('relevanssi_word_boundaries', 'on');
257
  add_option('relevanssi_default_orderby', 'relevance');
@@ -285,8 +297,15 @@ function relevanssi_get_post($id) {
285
  function relevanssi_remove_doc($id) {
286
  global $wpdb, $relevanssi_variables;
287
 
288
- $q = "DELETE FROM " . $relevanssi_variables['relevanssi_table'] . " WHERE doc=$id";
 
 
289
  $wpdb->query($q);
 
 
 
 
 
290
  }
291
 
292
  /*****
@@ -353,6 +372,8 @@ better search experience for your users?</p>
353
 
354
  <p><strong>Go Premium!</strong> Buy Relevanssi Premium. See <a href="http://www.relevanssi.com/features/?utm_source=plugin&utm_medium=link&utm_campaign=features">feature
355
  comparison</a> and <a href="http://www.relevanssi.com/buy-premium/?utm_source=plugin&utm_medium=link&utm_campaign=license">license prices</a>.</p>
 
 
356
  </div>
357
  </div>
358
  </div>
3
  Plugin Name: Relevanssi
4
  Plugin URI: http://www.relevanssi.com/
5
  Description: This plugin replaces WordPress search with a relevance-sorting search.
6
+ Version: 3.3.8
7
  Author: Mikko Saari
8
  Author URI: http://www.mikkosaari.fi/
9
  */
10
 
11
+ /* Copyright 2014 Mikko Saari (email: mikko@mikkosaari.fi)
12
 
13
  This file is part of Relevanssi, a search plugin for WordPress.
14
 
40
  $relevanssi_variables['relevanssi_table'] = $wpdb->prefix . "relevanssi";
41
  $relevanssi_variables['stopword_table'] = $wpdb->prefix . "relevanssi_stopwords";
42
  $relevanssi_variables['log_table'] = $wpdb->prefix . "relevanssi_log";
 
 
43
  $relevanssi_variables['title_boost_default'] = 5;
44
  $relevanssi_variables['comment_boost_default'] = 0.75;
45
  $relevanssi_variables['post_type_weight_defaults']['post_tag'] = 0.75;
46
  $relevanssi_variables['post_type_weight_defaults']['category'] = 0.75;
47
  $relevanssi_variables['post_type_index_defaults'] = array('post', 'page');
48
+ $relevanssi_variables['database_version'] = 5;
49
  $relevanssi_variables['file'] = __FILE__;
50
  $relevanssi_variables['plugin_dir'] = plugin_dir_path(__FILE__);
51
 
52
  require_once('lib/init.php');
53
  require_once('lib/interface.php');
 
54
  require_once('lib/indexing.php');
55
  require_once('lib/stopwords.php');
56
  require_once('lib/search.php');
102
 
103
  function relevanssi_check_old_data() {
104
  if (is_admin()) {
105
+ // Version 3.3 removes the cache feature
106
+ $cache = get_option('relevanssi_enable_cache', 'nothing');
107
+ if ($cache != 'nothing') {
108
+ global $wpdb;
109
+ $relevanssi_cache = $wpdb->prefix . "relevanssi_cache";
110
+ $relevanssi_excerpt_cache = $wpdb->prefix . "relevanssi_excerpt_cache";
111
+
112
+ $wpdb->query("DROP TABLE $relevanssi_cache");
113
+ $wpdb->query("DROP TABLE $relevanssi_excerpt_cache");
114
+
115
+ delete_option('relevanssi_enable_cache');
116
+ delete_option('relevanssi_cache_seconds');
117
+ wp_clear_scheduled_hook('relevanssi_truncate_cache');
118
+ }
119
+
120
  // Version 3.1.4 combined taxonomy indexing options
121
  $inctags = get_option('relevanssi_include_tags', 'nothing');
122
  if ($inctags == 'on') {
224
  }
225
 
226
  function _relevanssi_install() {
227
+ global $relevanssi_variables;
228
 
229
  add_option('relevanssi_title_boost', $relevanssi_variables['title_boost_default']);
230
  add_option('relevanssi_comment_boost', $relevanssi_variables['comment_boost_default']);
235
  add_option('relevanssi_css', 'text-decoration: underline; text-color: #ff0000');
236
  add_option('relevanssi_class', 'relevanssi-query-term');
237
  add_option('relevanssi_excerpts', 'on');
238
+ add_option('relevanssi_excerpt_length', '30');
239
+ add_option('relevanssi_excerpt_type', 'words');
240
  add_option('relevanssi_excerpt_allowable_tags', '');
241
  add_option('relevanssi_log_queries', 'off');
242
+ add_option('relevanssi_log_queries_with_ip', 'off');
243
  add_option('relevanssi_cat', '0');
244
  add_option('relevanssi_excat', '0');
245
+ add_option('relevanssi_extag', '0');
246
  add_option('relevanssi_index_fields', '');
247
  add_option('relevanssi_exclude_posts', ''); //added by OdditY
248
  add_option('relevanssi_hilite_title', ''); //added by OdditY
250
  add_option('relevanssi_highlight_comments', 'off');
251
  add_option('relevanssi_index_comments', 'none'); //added by OdditY
252
  add_option('relevanssi_show_matches', '');
253
+ add_option('relevanssi_show_matches_text', '(Search hits: %body% in body, %title% in title, %tags% in tags, %comments% in comments. Score: %score%)');
254
  add_option('relevanssi_fuzzy', 'sometimes');
255
  add_option('relevanssi_indexed', '');
256
  add_option('relevanssi_expand_shortcodes', 'on');
259
  add_option('relevanssi_implicit_operator', 'OR');
260
  add_option('relevanssi_omit_from_logs', '');
261
  add_option('relevanssi_synonyms', '');
262
+ add_option('relevanssi_index_excerpt', 'off');
263
  add_option('relevanssi_index_limit', '500');
264
  add_option('relevanssi_disable_or_fallback', 'off');
265
  add_option('relevanssi_respect_exclude', 'on');
266
+ add_option('relevanssi_min_word_length', '3');
 
 
267
  add_option('relevanssi_wpml_only_current', 'on');
268
  add_option('relevanssi_word_boundaries', 'on');
269
  add_option('relevanssi_default_orderby', 'relevance');
297
  function relevanssi_remove_doc($id) {
298
  global $wpdb, $relevanssi_variables;
299
 
300
+ $D = get_option( 'relevanssi_doc_count');
301
+
302
+ $q = "DELETE FROM " . $relevanssi_variables['relevanssi_table'] . " WHERE doc=$id";
303
  $wpdb->query($q);
304
+ $rows_updated = $wpdb->query($q);
305
+
306
+ if($rows_updated && $rows_updated > 0) {
307
+ update_option('relevanssi_doc_count', $D - $rows_updated);
308
+ }
309
  }
310
 
311
  /*****
372
 
373
  <p><strong>Go Premium!</strong> Buy Relevanssi Premium. See <a href="http://www.relevanssi.com/features/?utm_source=plugin&utm_medium=link&utm_campaign=features">feature
374
  comparison</a> and <a href="http://www.relevanssi.com/buy-premium/?utm_source=plugin&utm_medium=link&utm_campaign=license">license prices</a>.</p>
375
+
376
+ <p><strong><a href="http://sites.fastspring.com/painavasana/product/relevanssipremium?source=p">Buy Premium here &raquo;</a></strong></p>
377
  </div>
378
  </div>
379
  </div>
uninstall.php CHANGED
@@ -25,6 +25,7 @@ function relevanssi_uninstall() {
25
  delete_option('relevanssi_excerpt_allowable_tags');
26
  delete_option('relevanssi_log_queries');
27
  delete_option('relevanssi_excat');
 
28
  delete_option('relevanssi_cat');
29
  delete_option('relevanssi_index_fields');
30
  delete_option('relevanssi_exclude_posts'); //added by OdditY
@@ -46,8 +47,6 @@ function relevanssi_uninstall() {
46
  delete_option('relevanssi_index_limit');
47
  delete_option('relevanssi_disable_or_fallback');
48
  delete_option('relevanssi_respect_exclude');
49
- delete_option('relevanssi_cache_seconds');
50
- delete_option('relevanssi_enable_cache');
51
  delete_option('relevanssi_min_word_length');
52
  delete_option('relevanssi_options');
53
  delete_option('relevanssi_wpml_only_current');
@@ -59,6 +58,7 @@ function relevanssi_uninstall() {
59
  delete_option('relevanssi_index_post_types');
60
  delete_option('relevanssi_post_type_weights');
61
  delete_option('relevanssi_index_taxonomies_list');
 
62
 
63
  // Unused options, removed in case they are still left
64
  delete_option('relevanssi_custom_types');
@@ -70,6 +70,9 @@ function relevanssi_uninstall() {
70
  delete_option('relevanssi_include_tags'); //added by OdditY
71
  delete_option('relevanssi_custom_taxonomies');
72
  delete_option('relevanssi_include_cats');
 
 
 
73
 
74
  relevanssi_clear_database_tables();
75
  }
25
  delete_option('relevanssi_excerpt_allowable_tags');
26
  delete_option('relevanssi_log_queries');
27
  delete_option('relevanssi_excat');
28
+ delete_option('relevanssi_extag');
29
  delete_option('relevanssi_cat');
30
  delete_option('relevanssi_index_fields');
31
  delete_option('relevanssi_exclude_posts'); //added by OdditY
47
  delete_option('relevanssi_index_limit');
48
  delete_option('relevanssi_disable_or_fallback');
49
  delete_option('relevanssi_respect_exclude');
 
 
50
  delete_option('relevanssi_min_word_length');
51
  delete_option('relevanssi_options');
52
  delete_option('relevanssi_wpml_only_current');
58
  delete_option('relevanssi_index_post_types');
59
  delete_option('relevanssi_post_type_weights');
60
  delete_option('relevanssi_index_taxonomies_list');
61
+ delete_option('relevanssi_doc_count');
62
 
63
  // Unused options, removed in case they are still left
64
  delete_option('relevanssi_custom_types');
70
  delete_option('relevanssi_include_tags'); //added by OdditY
71
  delete_option('relevanssi_custom_taxonomies');
72
  delete_option('relevanssi_include_cats');
73
+ delete_option('relevanssi_cache_seconds');
74
+ delete_option('relevanssi_enable_cache');
75
+ delete_option('relevanssi_show_matches_txt');
76
 
77
  relevanssi_clear_database_tables();
78
  }