sphinx fixes upgrading 2.1.x -> 2.2.x

This commit is contained in:
SJ 2014-09-22 11:13:55 +02:00
parent 53c38a805d
commit 64f6aafeb3
3 changed files with 15 additions and 25 deletions

View File

@ -59,9 +59,9 @@ source dailydelta : base
source tag : base source tag : base
{ {
sql_query_pre = SET NAMES utf8 sql_query_pre = SET NAMES utf8
sql_query = SELECT `_id`, `id`, `uid`, `tag` FROM `tag` sql_query = SELECT `_id`, `id` AS iid, `uid`, `tag` FROM `tag`
sql_attr_uint = id sql_attr_uint = iid
sql_attr_uint = uid sql_attr_uint = uid
} }
@ -70,9 +70,9 @@ source tag : base
source note : base source note : base
{ {
sql_query_pre = SET NAMES utf8 sql_query_pre = SET NAMES utf8
sql_query = SELECT `_id`, `id`, `uid`, `note` FROM `note` sql_query = SELECT `_id`, `id` AS iid, `uid`, `note` FROM `note`
sql_attr_uint = id sql_attr_uint = iid
sql_attr_uint = uid sql_attr_uint = uid
} }
@ -83,8 +83,6 @@ index main1
source = main1 source = main1
path = /var/piler/sphinx/main1 path = /var/piler/sphinx/main1
docinfo = extern docinfo = extern
charset_type = utf-8
enable_star = 1
min_prefix_len = 6 min_prefix_len = 6
min_word_len = 1 min_word_len = 1
#ngram_len = 1 #ngram_len = 1
@ -96,8 +94,6 @@ index main2
source = main2 source = main2
path = /var/piler/sphinx/main2 path = /var/piler/sphinx/main2
docinfo = extern docinfo = extern
charset_type = utf-8
enable_star = 1
min_prefix_len = 6 min_prefix_len = 6
min_word_len = 1 min_word_len = 1
#ngram_len = 1 #ngram_len = 1
@ -109,8 +105,6 @@ index main3
source = main3 source = main3
path = /var/piler/sphinx/main3 path = /var/piler/sphinx/main3
docinfo = extern docinfo = extern
charset_type = utf-8
enable_star = 1
min_prefix_len = 6 min_prefix_len = 6
min_word_len = 1 min_word_len = 1
#ngram_len = 1 #ngram_len = 1
@ -122,8 +116,6 @@ index main4
source = main4 source = main4
path = /var/piler/sphinx/main4 path = /var/piler/sphinx/main4
docinfo = extern docinfo = extern
charset_type = utf-8
enable_star = 1
min_prefix_len = 6 min_prefix_len = 6
min_word_len = 1 min_word_len = 1
#ngram_len = 1 #ngram_len = 1
@ -135,8 +127,6 @@ index dailydelta1
source = dailydelta source = dailydelta
path = /var/piler/sphinx/dailydelta1 path = /var/piler/sphinx/dailydelta1
docinfo = extern docinfo = extern
charset_type = utf-8
enable_star = 1
min_prefix_len = 6 min_prefix_len = 6
min_word_len = 1 min_word_len = 1
#ngram_len = 1 #ngram_len = 1
@ -148,8 +138,6 @@ index delta1
source = delta source = delta
path = /var/piler/sphinx/delta1 path = /var/piler/sphinx/delta1
docinfo = extern docinfo = extern
charset_type = utf-8
enable_star = 1
min_prefix_len = 6 min_prefix_len = 6
min_word_len = 1 min_word_len = 1
#ngram_len = 1 #ngram_len = 1
@ -162,8 +150,6 @@ index tag1
source = tag source = tag
path = /var/piler/sphinx/tag1 path = /var/piler/sphinx/tag1
docinfo = extern docinfo = extern
charset_type = utf-8
enable_star = 1
min_prefix_len = 6 min_prefix_len = 6
min_word_len = 1 min_word_len = 1
#ngram_len = 1 #ngram_len = 1
@ -176,8 +162,6 @@ index note1
source = note source = note
path = /var/piler/sphinx/note1 path = /var/piler/sphinx/note1
docinfo = extern docinfo = extern
charset_type = utf-8
enable_star = 1
min_prefix_len = 6 min_prefix_len = 6
min_word_len = 1 min_word_len = 1
#ngram_len = 1 #ngram_len = 1
@ -206,5 +190,4 @@ searchd
preopen_indexes = 1 preopen_indexes = 1
unlink_old = 1 unlink_old = 1
workers = threads # for RT to work workers = threads # for RT to work
compat_sphinxql_magics = 0
} }

View File

@ -20,6 +20,12 @@ PID_NUMBER=`test -f ${PID_FILE} && cat ${PID_FILE}`
start() { start() {
echo "starting searchd . . ." echo "starting searchd . . ."
if [ ! -d /var/run/piler ]; then
mkdir -p /var/run/piler
chown piler:piler /var/run/piler
fi
if [ `id -u` -eq 0 ]; then if [ `id -u` -eq 0 ]; then
su piler -c searchd su piler -c searchd
else else

View File

@ -417,10 +417,11 @@ class ModelSearchSearch extends Model {
$s = $this->fixup_sphinx_operators($s); $s = $this->fixup_sphinx_operators($s);
$q = $this->sphx->query("SELECT id FROM $sphx_table WHERE uid=" . $session->get("uid") . " AND MATCH('@$field $s') "); $q = $this->sphx->query("SELECT iid FROM $sphx_table WHERE uid=" . $session->get("uid") . " AND MATCH('@$field $s') ");
if(ENABLE_SYSLOG == 1) { syslog(LOG_INFO, "sql: " . $q->query); }
foreach($q->rows as $a) { foreach($q->rows as $a) {
$id_list .= "," . $a['id']; $id_list .= "," . $a['iid'];
} }
if($id_list) { $id_list = substr($id_list, 1, strlen($id_list)); } if($id_list) { $id_list = substr($id_list, 1, strlen($id_list)); }
@ -446,10 +447,10 @@ class ModelSearchSearch extends Model {
} }
$q = $this->db->query("SELECT id FROM " . TABLE_FOLDER_MESSAGE . " WHERE folder_id IN ($q)", $__folders); $q = $this->db->query("SELECT iid FROM " . TABLE_FOLDER_MESSAGE . " WHERE folder_id IN ($q)", $__folders);
foreach($q->rows as $a) { foreach($q->rows as $a) {
$id_list .= "," . $a['id']; $id_list .= "," . $a['iid'];
} }
if($id_list) { $id_list = substr($id_list, 1, strlen($id_list)); } if($id_list) { $id_list = substr($id_list, 1, strlen($id_list)); }