From 6164a64b01c77542c40259e3f67e95415639c066 Mon Sep 17 00:00:00 2001 From: "fly.dvorkin" Date: Wed, 14 Nov 2012 10:25:55 +0000 Subject: [PATCH] r477 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Закончили править поиск по постам git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@477 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293 --- upload/admin/admin_rebuild_search.php | 4 +++- upload/config.php | 2 +- upload/includes/bbcode.php | 10 +++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/upload/admin/admin_rebuild_search.php b/upload/admin/admin_rebuild_search.php index ed7c93ea1..39defaca8 100644 --- a/upload/admin/admin_rebuild_search.php +++ b/upload/admin/admin_rebuild_search.php @@ -196,9 +196,11 @@ if ($mode == 'submit' || $mode == 'refresh') $end_post_id = $row['post_id']; // Get search words + $s_post_text = str_replace('\n', "\n", $row['post_text']); + $s_post_subject = str_replace('\n', "\n", $row['post_subject']); $words_sql[] = array( 'post_id' => (int) $row['post_id'], - 'search_words' => add_search_words($row['post_id'], stripslashes($row['post_text']), stripslashes($row['post_subject']), true), + 'search_words' => add_search_words($row['post_id'], stripslashes($s_post_text), stripslashes($s_post_subject), true), ); $timer_expired = (TIMENOW > $expire_time); diff --git a/upload/config.php b/upload/config.php index f82f076fa..237c6150f 100644 --- a/upload/config.php +++ b/upload/config.php @@ -58,7 +58,7 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do $bb_cfg['tp_version'] = '2.5 Beta'; $bb_cfg['tp_release_date'] = '14-11-2012'; -$bb_cfg['tp_release_state'] = 'R476'; +$bb_cfg['tp_release_state'] = 'R477'; // Database $charset = 'utf8'; diff --git a/upload/includes/bbcode.php b/upload/includes/bbcode.php index 21e50d1c1..f2e65ff24 100644 --- a/upload/includes/bbcode.php +++ b/upload/includes/bbcode.php @@ -375,7 +375,7 @@ function extract_search_words ($text) $text = preg_replace('#[.,:;]#u', ' ', $text); // short & long words - $text = preg_replace('#(?<=^|\s)(\S{1,'.$min_word_len.'}|\S{'.$max_word_len.',}|\W*)(?=$|\s)#u', ' ', $text); + // $text = preg_replace('#(?<=^|\s)(\S{1,'.$min_word_len.'}|\S{'.$max_word_len.',}|\W*)(?=$|\s)#u', ' ', $text); $text = remove_stopwords($text); # $text = replace_synonyms($text); @@ -383,6 +383,14 @@ function extract_search_words ($text) // Trim 1+ spaces to one space and split this string into unique words $text = array_unique(explode(' ', str_compact($text))); + // short & long words 2 + $text_out = array(); + foreach ($text as $word) + { + if (mb_strlen($word) > $min_word_len && mb_strlen($word) <= $max_word_len) $text_out[] = $word; + } + $text = $text_out; + if (sizeof($text) > $max_words_count) { # shuffle($text);