Here it is. I don?t see any mistake.
It would be really nice if someone could confirm it. Thanks alot.
Code:
#
# sphinx configuration file sample
#
#############################################################################
## data source definition
#############################################################################
source src1
{
type = mysql
strip_html = 0
sql_host = localhost
sql_user = root
sql_pass = xx
sql_db = xx
sql_port = 3306
sql_query_pre = REPLACE INTO sphinx.sphinx_counter SELECT 1, MAX(postid) FROM post
sql_query_range = SELECT MIN(postid), MAX(postid) FROM post
sql_range_step = 1000
sql_query = \
SELECT postid, forumid, post.threadid as threadid, IF(post.userid=0,99999999,post.userid) AS userid, IF(postuserid=0,99999999,postuserid) AS postuserid, post.title, pagetext, post.dateline \
FROM post \
INNER JOIN thread AS thread ON(thread.threadid = post.threadid) \
WHERE post.visible = 1 AND postid >= $start AND postid <= $end \
AND postid <= (SELECT max_doc_id FROM sphinx.sphinx_counter WHERE counter_id = 1);
sql_group_column = forumid
sql_group_column = threadid
sql_group_column = userid
sql_group_column = postuserid
sql_date_column = dateline
sql_query_post =
}
source src2 : src1
{
sql_query_pre =
sql_query_range = SELECT ( SELECT max_doc_id FROM sphinx.sphinx_counter WHERE counter_id = 1 ), MAX(postid) FROM post
sql_range_step = 1000
sql_query = \
SELECT postid, forumid, post.threadid as threadid, IF(post.userid=0,99999999,post.userid) AS userid, IF(postuserid=0,99999999,postuserid) AS postuserid, post.title, pagetext, post.dateline \
FROM post \
INNER JOIN thread AS thread ON(thread.threadid = post.threadid) \
WHERE post.visible = 1 AND postid >= $start AND postid <= $end \
AND postid > ( SELECT max_doc_id FROM sphinx.sphinx_counter WHERE counter_id = 1 );
}
source src3
{
type = mysql
strip_html = 0
sql_host = localhost
sql_user = root
sql_pass = xx
sql_db = xx
sql_port = 3306
sql_query_pre = REPLACE INTO sphinx.sphinx_counter SELECT 2, MAX(threadid) FROM thread
sql_query_range = SELECT MIN(threadid), MAX(threadid) FROM thread
sql_range_step = 1000
sql_query = \
SELECT threadid, forumid, title, IF(postuserid=0,99999999,postuserid) AS postuserid, IF(firstpostid=0,99999999,firstpostid) as firstpostid, lastpost \
FROM thread \
WHERE visible = 1 AND threadid >= $start AND threadid <= $end \
AND threadid <= ( SELECT max_doc_id FROM sphinx.sphinx_counter WHERE counter_id = 2 );
sql_group_column = forumid
sql_group_column = postuserid
sql_group_column = firstpostid
sql_date_column = lastpost
sql_query_post =
}
source src4 : src3
{
sql_query_pre =
sql_query_range = SELECT ( SELECT max_doc_id FROM sphinx.sphinx_counter WHERE counter_id = 2 ), MAX(threadid) FROM thread
sql_range_step = 1000
sql_query = \
SELECT threadid, forumid, title, IF(postuserid=0,99999999,postuserid) AS postuserid, IF(firstpostid=0,99999999,firstpostid) as firstpostid, lastpost \
FROM thread \
WHERE visible = 1 AND threadid >= $start AND threadid <= $end \
AND threadid > ( SELECT max_doc_id FROM sphinx.sphinx_counter WHERE counter_id = 2 );
}
#############################################################################
## index definition
#############################################################################
# local index example
#
# this is an index which is stored locally in the filesystem
# all indexing-time options (such as morphology and charsets) belong to the index
index vbpost
{
source = src1
path = /var/sphinx/vbpost
docinfo = extern
morphology = none
stopwords =
min_word_len = 4
charset_type = sbcs
}
index vbpostindex
{
source = src2
path = /var/sphinx/vbpostindex
docinfo = extern
morphology = none
stopwords =
min_word_len = 4
charset_type = sbcs
}
index vbthreadindex
{
source = src3
path = /var/sphinx/vbthreadindex
docinfo = extern
morphology = none
stopwords =
min_word_len = 4
charset_type = sbcs
}
index vbthreadindexdelta
{
source = src4
path = /var/sphinx/vbthreadindexdelta
docinfo = extern
morphology = none
stopwords =
min_word_len = 4
charset_type = sbcs
}
index vbfulltext
{
type = distributed
local = vbpost
local = vbpostindex
}
index vbfulltextthread
{
type = distributed
local = vbthreadindex
local = vbthreadindexdelta
}
#############################################################################
## indexer settings
#############################################################################
indexer
{
# memory limit
# can be specified in bytes, kilobytes (mem_limit=1000K) or megabytes (mem_limit=10M)
# will grow if set unacceptably low
# will warn if set too low, hurting the performance
# optional, default is 32M
mem_limit = 64M
}
#############################################################################
## searchd settings
#############################################################################
searchd
{
# port on which search daemon will listen
port = 3312
# log file
# searchd run info is logged here
log = /var/log/searchd.log
# query log file
# all the search queries are logged here
query_log = /var/log/query.log
# client read timeout, seconds
read_timeout = 5
# maximum amount of children to fork
# useful to control server load
max_children = 30
# a file which will contain searchd process ID
# used for different external automation scripts
# MUST be present
pid_file = /var/run/searchd.pid
# maximum amount of matches this daemon would retrieve from each index
# and serve to client
#
# this parameter affects per-client memory usage slightly (16 bytes per match)
# and CPU usage in match sorting phase; so blindly raising it to 1 million
# is definitely NOT recommended
#
# default is 1000 (just like with Google)
max_matches = 1500
}