|
From: Paul S. O. <ps...@us...> - 2002-02-25 01:00:51
|
Update of /cvsroot/phpbb/phpBB2/develop
In directory usw-pr-cvs1:/tmp/cvs-serv17789/develop
Modified Files:
search_fill.php
Log Message:
Fix issues with view posts since last visit, errors on next page, re-introduce external stopword list, examine feasibility of stemmer, tidy ups ...
Index: search_fill.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/develop/search_fill.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** search_fill.php 16 Feb 2002 10:35:40 -0000 1.9
--- search_fill.php 25 Feb 2002 01:00:47 -0000 1.10
***************
*** 8,29 ****
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
- die("Please read the first lines of this script for instructions on how to enable it");
//
// Do not change anything below this line.
//
-
set_time_limit(0);
- $common_percent = 0.4; // Percentage of posts in which a word has to appear to be marked as common
$phpbb_root_path = "../";
-
include($phpbb_root_path . 'extension.inc');
! include($phpbb_root_path . 'config.'.$phpEx);
! include($phpbb_root_path . 'includes/constants.'.$phpEx);
! include($phpbb_root_path . 'includes/db.'.$phpEx);
! include($phpbb_root_path . 'includes/functions.'.$phpEx);
include($phpbb_root_path . 'includes/search.'.$phpEx);
print "<html>\n<body>\n";
--- 8,24 ----
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
//
// Do not change anything below this line.
//
set_time_limit(0);
$phpbb_root_path = "../";
include($phpbb_root_path . 'extension.inc');
! include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/search.'.$phpEx);
+ $common_percent = 0.4; // Percentage of posts in which a word has to appear to be marked as common
+
print "<html>\n<body>\n";
***************
*** 31,60 ****
// Try and load stopword and synonym files
//
- //$stopword_array = file($phpbb_root_path . "language/lang_" . $board_config['default_lang'] . "/search_stopwords.txt");
- //$synonym_array = file($phpbb_root_path . "language/lang_" . $board_config['default_lang'] . "/search_synonyms.txt");
-
// This needs fixing! Shouldn't be hardcoded to English files!
! //$stopword_array = file($phpbb_root_path . "language/lang_english/search_stopwords.txt");
$synonym_array = file($phpbb_root_path . "language/lang_english/search_synonyms.txt");
- /*
- for ($j = 0; $j < count($stopword_array); $j++)
- {
- $filter_word = trim(strtolower($stopword_array[$j]));
- $search[] = "/\b" . phpbb_preg_quote($filter_word, "/") . "\b/is";
- $replace[] = '';
- }
- */
//
// Fetch a batch of posts_text entries
//
! $sql = "SELECT count(*) as total, max(post_id) as max_post_id
FROM ". POSTS_TEXT_TABLE;
! if(!$result = $db->sql_query($sql))
{
$error = $db->sql_error();
die("Couldn't get maximum post ID :: " . $sql . " :: " . $error['message']);
}
$max_post_id = $db->sql_fetchrow($result);
$totalposts = $max_post_id['total'];
$max_post_id = $max_post_id['max_post_id'];
--- 26,46 ----
// Try and load stopword and synonym files
//
// This needs fixing! Shouldn't be hardcoded to English files!
! $stopword_array = file($phpbb_root_path . "language/lang_english/search_stopwords.txt");
$synonym_array = file($phpbb_root_path . "language/lang_english/search_synonyms.txt");
//
// Fetch a batch of posts_text entries
//
! $sql = "SELECT COUNT(*) as total, MAX(post_id) as max_post_id
FROM ". POSTS_TEXT_TABLE;
! if ( !($result = $db->sql_query($sql)) )
{
$error = $db->sql_error();
die("Couldn't get maximum post ID :: " . $sql . " :: " . $error['message']);
}
+
$max_post_id = $db->sql_fetchrow($result);
+
$totalposts = $max_post_id['total'];
$max_post_id = $max_post_id['max_post_id'];
***************
*** 75,79 ****
BETWEEN $batchstart
AND $batchend";
! if(!$posts_result = $db->sql_query($sql))
{
$error = $db->sql_error();
--- 61,65 ----
BETWEEN $batchstart
AND $batchend";
! if( !($result = $db->sql_query($sql)) )
{
$error = $db->sql_error();
***************
*** 81,87 ****
}
! $rowset = $db->sql_fetchrowset($posts_result);
! if( $post_rows = $db->sql_numrows($posts_result) )
{
--- 67,76 ----
}
! $rowset = $db->sql_fetchrowset($result);
! $db->sql_freeresult($result);
! $post_rows = count($rowset);
!
! if( $post_rows )
{
***************
*** 93,108 ****
for($post_nr = 0; $post_nr < $post_rows; $post_nr++ )
{
-
print ".";
flush();
- $matches = array();
$post_id = $rowset[$post_nr]['post_id'];
- $text = clean_words("post", $rowset[$post_nr]['post_text'], $synonym_array); // Cleaned up post
- $text_title = clean_words("post", $rowset[$post_nr]['post_subject'], $synonym_array);
$matches = array();
! $matches['text'] = split_words($text);
! $matches['title'] = split_words($text_title);
while( list($match_type, $match_ary) = @each($matches) )
--- 82,93 ----
for($post_nr = 0; $post_nr < $post_rows; $post_nr++ )
{
print ".";
flush();
$post_id = $rowset[$post_nr]['post_id'];
$matches = array();
! $matches['text'] = split_words(clean_words("post", $rowset[$post_nr]['post_text'], $stopword_array, $synonym_array));
! $matches['title'] = split_words(clean_words("post", $rowset[$post_nr]['post_subject'], $stopword_array, $synonym_array));
while( list($match_type, $match_ary) = @each($matches) )
***************
*** 191,201 ****
}
- else
- {
- print "Couldn't get rowcount for number of posts<br>$sql<br>\n";
- } // All posts;
- $db->sql_freeresult($posts_result);
-
// Remove common words after the first 2 batches and after every 4th batch after that.
if( $batchcount % 4 == 3 )
--- 176,180 ----
|