Закончили править поиск по постам git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@477 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
fly.dvorkin 2012-11-14 10:25:55 +00:00
commit 6164a64b01
3 changed files with 13 additions and 3 deletions

View file

@ -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);

View file

@ -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';

View file

@ -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);