aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/search/search.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2006-05-28 19:06:21 +0000
committerNils Adermann <naderman@naderman.de>2006-05-28 19:06:21 +0000
commitebf4f4ec8e787153e16cc6cec6fc5fefadc97107 (patch)
tree1dd320eb12a0915a11565bbb0b64c699ca6a6e61 /phpBB/includes/search/search.php
parentb84ebb999d1e7f0340fbb6ff7fbf113be9a81816 (diff)
downloadforums-ebf4f4ec8e787153e16cc6cec6fc5fefadc97107.tar
forums-ebf4f4ec8e787153e16cc6cec6fc5fefadc97107.tar.gz
forums-ebf4f4ec8e787153e16cc6cec6fc5fefadc97107.tar.bz2
forums-ebf4f4ec8e787153e16cc6cec6fc5fefadc97107.tar.xz
forums-ebf4f4ec8e787153e16cc6cec6fc5fefadc97107.zip
- added search by author_id to solve problems with looking up posts of users with a name containing wildcards
- user based flood control (seperate limits for users and guests) [Bug #1357] - inform the user about ignored words if he receives a "no words specified" message - solve problems with the number of entries per page [Bug #1973] - different height for popup window ["Bug" #1814] - speed improvements for posting and search reindexing in fulltext_native -> use php files for ignore words and synonyms git-svn-id: file:///svn/phpbb/trunk@5981 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/search/search.php')
-rwxr-xr-xphpBB/includes/search/search.php57
1 files changed, 20 insertions, 37 deletions
diff --git a/phpBB/includes/search/search.php b/phpBB/includes/search/search.php
index 16d87947d2..28f805bca5 100755
--- a/phpBB/includes/search/search.php
+++ b/phpBB/includes/search/search.php
@@ -43,31 +43,21 @@ class search_backend
}
/**
- * Stores a list of common words that should be ignored in $this->ignore_words and caches them
+ * Retrieves a language dependend list of words that should be ignored by the search
*/
function get_ignore_words()
{
if (!sizeof($this->ignore_words))
{
- global $user, $cache;
+ global $user, $phpEx;
- $ignore_words = $cache->get('_ignore_words');
+ $words = array();
- if (!$ignore_words)
- {
- $ignore_words = array();
- }
-
- if (!isset($ignore_words[$user->lang_name]))
- {
- $ignore_words[$user->lang_name] = explode("\n", str_replace("\n\n", "\n", str_replace("\r", "\n", file_get_contents($user->lang_path . '/search_ignore_words.txt'))));
-
- $cache->put('_ignore_words', $ignore_words, 7200);
- }
-
- $this->ignore_words = $ignore_words[$user->lang_name];
+ // include the file containing ignore words
+ include("{$user->lang_path}/search_ignore_words.$phpEx");
- unset($ignore_words);
+ $this->ignore_words = $words;
+ unset($words);
}
}
@@ -78,28 +68,17 @@ class search_backend
{
if (!sizeof($this->match_synonym))
{
- global $user, $cache;
+ global $user, $phpEx;
- $match_synonym = $cache->get('_match_synonym');
+ $synonyms = array();
- if (!$match_synonym)
- {
- $match_synonym = array();
- }
+ // include the file containing synonyms
+ include("{$user->lang_path}/search_synonyms.$phpEx");
- if (!isset($match_synonym[$user->lang_name]))
- {
- preg_match_all('#^\s*(\S+)\s+(\S+)\s*$#m', file_get_contents($user->lang_path . '/search_synonyms.txt'), $match);
- $match_synonym[$user->lang_name]['replace']= &$match[1];
- $match_synonym[$user->lang_name]['match'] = &$match[2];
+ $this->match_synonym = array_keys($synonyms);
+ $this->replace_synonym = array_values($synonyms);
- $cache->put('_match_synonym', $match_synonym, 7200);
- }
-
- $this->replace_synonym = $match_synonym[$user->lang_name]['replace'];
- $this->match_synonym = $match_synonym[$user->lang_name]['match'];
-
- unset($match_synonym);
+ unset($synonyms);
}
}
@@ -173,7 +152,7 @@ class search_backend
*/
function save_ids($search_key, $keywords, $author_ary, $result_count, &$id_ary, $start, $sort_dir)
{
- global $cache, $config, $db;
+ global $cache, $config, $db, $user;
$length = min(sizeof($id_ary), $config['search_block_size']);
@@ -211,7 +190,11 @@ class search_backend
}
$db->sql_freeresult($result);
}
- set_config('last_search_time', time());
+ //set_config('last_search_time', time());
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_last_search = ' . time() . '
+ WHERE user_id = ' . $user->data['user_id'];
+ $db->sql_query($sql);
$store = array(-1 => $result_count, -2 => $sort_dir);
$id_range = range($start, $start + $length - 1);