aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhruv <dhruv.goel92@gmail.com>2012-07-11 16:57:18 +0530
committerDhruv <dhruv.goel92@gmail.com>2012-07-19 23:01:42 +0530
commit172c583f1941a8b162f1a7bf258bb3e38149606d (patch)
tree61a19268dbe027b52aed1702a82adb11212bb59f
parent4b40f0d3c6d14adc2b20b866cbeb42586cf8d874 (diff)
downloadforums-172c583f1941a8b162f1a7bf258bb3e38149606d.tar
forums-172c583f1941a8b162f1a7bf258bb3e38149606d.tar.gz
forums-172c583f1941a8b162f1a7bf258bb3e38149606d.tar.bz2
forums-172c583f1941a8b162f1a7bf258bb3e38149606d.tar.xz
forums-172c583f1941a8b162f1a7bf258bb3e38149606d.zip
[feature/sphinx-fulltext-search] use new unique id instead of salt
a new unique id is generated by sphinx and stored in the config table instead of using avatar_salt. PHPBB3-10946
-rw-r--r--phpBB/docs/sphinx.sample.conf16
-rw-r--r--phpBB/includes/search/fulltext_sphinx.php15
2 files changed, 16 insertions, 15 deletions
diff --git a/phpBB/docs/sphinx.sample.conf b/phpBB/docs/sphinx.sample.conf
index 000d8157d6..06595a766f 100644
--- a/phpBB/docs/sphinx.sample.conf
+++ b/phpBB/docs/sphinx.sample.conf
@@ -1,4 +1,4 @@
-source source_phpbb_{AVATAR_SALT}_main
+source source_phpbb_{SPHINX_ID}_main
{
type = mysql
sql_host = localhost
@@ -38,7 +38,7 @@ source source_phpbb_{AVATAR_SALT}_main
sql_attr_timestamp = topic_last_post_time
sql_attr_str2ordinal = post_subject
}
-source source_phpbb_{AVATAR_SALT}_delta : source_phpbb_{AVATAR_SALT}_main
+source source_phpbb_{SPHINX_ID}_delta : source_phpbb_{SPHINX_ID}_main
{
sql_query_range =
sql_range_step =
@@ -60,10 +60,10 @@ source source_phpbb_{AVATAR_SALT}_delta : source_phpbb_{AVATAR_SALT}_main
AND p.post_id >= ( SELECT max_doc_id FROM phpbb_sphinx WHERE counter_id=1 )
sql_query_pre =
}
-index index_phpbb_{AVATAR_SALT}_main
+index index_phpbb_{SPHINX_ID}_main
{
- path = {DATA_PATH}/index_phpbb_{AVATAR_SALT}_main
- source = source_phpbb_{AVATAR_SALT}_main
+ path = {DATA_PATH}/index_phpbb_{SPHINX_ID}_main
+ source = source_phpbb_{SPHINX_ID}_main
docinfo = extern
morphology = none
stopwords =
@@ -73,10 +73,10 @@ index index_phpbb_{AVATAR_SALT}_main
min_prefix_len = 0
min_infix_len = 0
}
-index index_phpbb_{AVATAR_SALT}_delta : index_phpbb_{AVATAR_SALT}_main
+index index_phpbb_{SPHINX_ID}_delta : index_phpbb_{SPHINX_ID}_main
{
- path = {DATA_PATH}/index_phpbb_{AVATAR_SALT}_delta
- source = source_phpbb_{AVATAR_SALT}_delta
+ path = {DATA_PATH}/index_phpbb_{SPHINX_ID}_delta
+ source = source_phpbb_{SPHINX_ID}_delta
}
indexer
{
diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/includes/search/fulltext_sphinx.php
index 6e554eec00..5bdbbff119 100644
--- a/phpBB/includes/search/fulltext_sphinx.php
+++ b/phpBB/includes/search/fulltext_sphinx.php
@@ -72,16 +72,17 @@ class phpbb_search_fulltext_sphinx
// Initialize phpbb_db_tools object
$this->db_tools = new phpbb_db_tools($this->db);
- $this->id = $config['avatar_salt'];
+ if(!$this->config['fulltext_sphinx_id'])
+ {
+ set_config('fulltext_sphinx_id', unique_id());
+ }
+ $this->id = $this->config['fulltext_sphinx_id'];
$this->indexes = 'index_phpbb_' . $this->id . '_delta;index_phpbb_' . $this->id . '_main';
$this->sphinx = new SphinxClient();
// We only support localhost for now
- $this->sphinx->SetServer('localhost', (isset($config['fulltext_sphinx_port']) && $config['fulltext_sphinx_port']) ? (int) $config['fulltext_sphinx_port'] : 3312);
-
- $config['fulltext_sphinx_min_word_len'] = 2;
- $config['fulltext_sphinx_max_word_len'] = 400;
+ $this->sphinx->SetServer('localhost', (isset($this->config['fulltext_sphinx_port']) && $this->config['fulltext_sphinx_port']) ? (int) $this->config['fulltext_sphinx_port'] : 3312);
$error = false;
}
@@ -137,8 +138,8 @@ class phpbb_search_fulltext_sphinx
include ($phpbb_root_path . 'config.' . $phpEx);
/* Now that we're sure everything was entered correctly,
- generate a config for the index. We misuse the avatar_salt
- for this, as it should be unique. */
+ generate a config for the index. We use a config value
+ fulltext_sphinx_id for this, as it should be unique. */
$config_object = new phpbb_search_sphinx_config($this->config_file_data);
$config_data = array(