|
From: Paul S. O. <ps...@us...> - 2001-11-29 15:27:51
|
Update of /cvsroot/phpbb/phpBB2/develop
In directory usw-pr-cvs1:/tmp/cvs-serv23056
Modified Files:
search_fill.php
Log Message:
Updated to take account of schema changes
Index: search_fill.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/develop/search_fill.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** search_fill.php 2001/11/15 22:07:29 1.2
--- search_fill.php 2001/11/29 15:27:48 1.3
***************
*** 11,16 ****
--- 11,25 ----
static $later_replace = array(" ", " ", " ", " ", " ", " ", " ", " ", " ", " " , " ", " ", " ", " ", " ", " ", " ");
+ static $sgml_match = array(" ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ");
+ static $sgml_replace = array(" ", "s", "a", "a", "a", "a", "a", "a", "a", "c", "e", "e", "e", "e", "i", "i", "i", "i", "o", "n", "o", "o", "o", "o", "o", "o", "u", "u", "u", "u", "y", "t", "y");
+
+ static $accent_match = array("ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ");
+ static $accent_replace = array("s", "a", "a", "a", "a", "a", "a", "a", "c", "e", "e", "e", "e", "i", "i", "i", "i", "o", "n", "o", "o", "o", "o", "o", "o", "u", "u", "u", "u", "y", "t", "y");
+
$entry = " " . strip_tags(strtolower($entry)) . " ";
+ $entry = str_replace($sgml_match, $sgml_match, $entry);
+ $entry = str_replace($accent_match, $accent_replace, $entry);
+
// Replace line endings by a space
$entry = preg_replace("/[\n\r]/is", " ", $entry);
***************
*** 63,69 ****
global $db;
! $sql = "
! SELECT
! COUNT(DISTINCT post_id) as total_posts
FROM " . SEARCH_MATCH_TABLE;
$result = $db->sql_query($sql);
--- 72,76 ----
global $db;
! $sql = "SELECT COUNT(DISTINCT post_id) as total_posts
FROM " . SEARCH_MATCH_TABLE;
$result = $db->sql_query($sql);
***************
*** 76,92 ****
$total_posts = $total_posts['total_posts'];
! $common_threshold = floor($total_posts * ($percent/100));
! $sql = "
! SELECT
! word_id,
! count(word_id) AS word_occur
! FROM
! ".SEARCH_MATCH_TABLE."
! GROUP BY
! word_id
! HAVING
! word_occur > $common_threshold
! ";
$result = $db->sql_query($sql);
if( !$result )
--- 83,92 ----
$total_posts = $total_posts['total_posts'];
! $common_threshold = floor($total_posts * ( $percent / 100 ));
! $sql = "SELECT word_id
! FROM " . SEARCH_MATCH_TABLE . "
! GROUP BY word_id
! HAVING count(word_id) > $common_threshold";
$result = $db->sql_query($sql);
if( !$result )
***************
*** 178,184 ****
//
$sql = "
! SELECT
! count(*) as total,
! max(post_id) as max_post_id
FROM ". POSTS_TEXT_TABLE;
if(!$result = $db->sql_query($sql))
--- 178,182 ----
//
$sql = "
! SELECT count(*) as total, max(post_id) as max_post_id
FROM ". POSTS_TEXT_TABLE;
if(!$result = $db->sql_query($sql))
***************
*** 202,209 ****
$sql = "SELECT *
! FROM " .
! POSTS_TEXT_TABLE ."
! WHERE
! post_id BETWEEN $batchstart AND $batchend";
if(!$posts_result = $db->sql_query($sql))
{
--- 200,207 ----
$sql = "SELECT *
! FROM " . POSTS_TEXT_TABLE ."
! WHERE post_id
! BETWEEN $batchstart
! AND $batchend";
if(!$posts_result = $db->sql_query($sql))
{
***************
*** 300,308 ****
{
$comma = ($sql_insert != '')? ', ': '';
! $sql_insert .= "$comma($post_id, ".$row['word_id'].", ".$word_count[$row['word_text']]." ,0)";
}
$sql = "INSERT INTO ".SEARCH_MATCH_TABLE."
! (post_id, word_id, word_count, title_match)
VALUES
$sql_insert
--- 298,306 ----
{
$comma = ($sql_insert != '')? ', ': '';
! $sql_insert .= "$comma($post_id, ".$row['word_id'].", 0)";
}
$sql = "INSERT INTO ".SEARCH_MATCH_TABLE."
! (post_id, word_id, title_match)
VALUES
$sql_insert
|