aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2002-02-18 15:06:15 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2002-02-18 15:06:15 +0000
commit0ce9506ffd9ba1778cc7900e0bce481fc0dc407e (patch)
tree0cc3614981984f858d6707027123ca0172bdc14f /phpBB
parentcc1a7450f9c987d0892b82b0f1605427fd4c5b62 (diff)
downloadforums-0ce9506ffd9ba1778cc7900e0bce481fc0dc407e.tar
forums-0ce9506ffd9ba1778cc7900e0bce481fc0dc407e.tar.gz
forums-0ce9506ffd9ba1778cc7900e0bce481fc0dc407e.tar.bz2
forums-0ce9506ffd9ba1778cc7900e0bce481fc0dc407e.tar.xz
forums-0ce9506ffd9ba1778cc7900e0bce481fc0dc407e.zip
Wasn't updating search match table ... fudged solution
git-svn-id: file:///svn/phpbb/trunk@2190 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/search.php29
1 files changed, 19 insertions, 10 deletions
diff --git a/phpBB/includes/search.php b/phpBB/includes/search.php
index 80002f7def..8304ec77c5 100644
--- a/phpBB/includes/search.php
+++ b/phpBB/includes/search.php
@@ -115,8 +115,10 @@ function add_search_words($post_id, $post_text, $post_title = "")
$search_raw_words['title'] = split_words(clean_words("post", $post_title, $synonym_array));
$word = array();
+ $word_insert_sql = array();
while( list($word_in, $search_matches) = @each($search_raw_words) )
{
+ $word_insert_sql[$word_in] = "";
if( !empty($search_matches) )
{
for ($i = 0; $i < count($search_matches); $i++)
@@ -125,7 +127,11 @@ function add_search_words($post_id, $post_text, $post_title = "")
if( $search_matches[$i] != "" )
{
- $word[] = $search_matches[$i];
+ $word[] = $search_matches[$i];
+ if ( !strstr($word_insert_sql[$word_in], "'" . $search_matches[$i] . "'") )
+ {
+ $word_insert_sql[$word_in] .= ( $word_insert_sql[$word_in] != "" ) ? ", '" . $search_matches[$i] . "'" : "'" . $search_matches[$i] . "'";
+ }
}
}
}
@@ -156,7 +162,7 @@ function add_search_words($post_id, $post_text, $post_title = "")
case 'msaccess':
case 'oracle':
case 'db2':
- $sql = "SELECT word_id, word_text, word_common
+ $sql = "SELECT word_id, word_text
FROM " . SEARCH_WORD_TABLE . "
WHERE word_text IN ($word_text_sql)";
if( !($result = $db->sql_query($sql)) )
@@ -166,7 +172,7 @@ function add_search_words($post_id, $post_text, $post_title = "")
while( $row = $db->sql_fetchrow($result) )
{
- $check_words[$row['word_text']] = $row['word_common'];
+ $check_words[$row['word_text']] = $row['word_id'];
}
break;
}
@@ -228,17 +234,20 @@ function add_search_words($post_id, $post_text, $post_title = "")
}
}
- while( list($word_in, $match_sql) = @each($word_text_sql) )
+ while( list($word_in, $match_sql) = @each($word_insert_sql) )
{
$title_match = ( $word_in == 'title' ) ? 1 : 0;
- $sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match)
- SELECT $post_id, word_id, $title_match
- FROM " . SEARCH_WORD_TABLE . "
- WHERE word_text IN ($match_sql)";
- if( !($result = $db->sql_query($sql)) )
+ if ( $match_sql != "" )
{
- message_die(GENERAL_ERROR, "Couldn't insert new word matches", "", __LINE__, __FILE__, $sql);
+ $sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match)
+ SELECT $post_id, word_id, $title_match
+ FROM " . SEARCH_WORD_TABLE . "
+ WHERE word_text IN ($match_sql)";
+ if( !($result = $db->sql_query($sql)) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't insert new word matches", "", __LINE__, __FILE__, $sql);
+ }
}
}