1 #if you have many posts, it's best to configure another index for new posts and
2 #periodically merge the diff index to the main
3 #this is not important until you get to hundreds of thousands posts
10 sql_user = cnprog #replace with your db username
11 sql_pass = secret #replace with your db password
12 sql_db = cnprog #replace with your db name
13 # these two are optional
15 #sql_sock = /var/lib/mysql/mysql.sock
17 # pre-query, executed before the main fetch query
18 sql_query_pre = SET NAMES utf8
20 # main document fetch query - change the table names if you are using a prefix
21 # this query creates a flat document from each question that includes only latest
22 # revisions of the question and all of it's answers
23 sql_query = SELECT q.id as id, q.title AS title, q.tagnames as tags, qr.text AS text, answers_combined.text AS answers \
27 SELECT MAX(id) as id, question_id \
28 FROM question_revision \
29 GROUP BY question_id \
32 ON q.id=mqr.question_id \
33 INNER JOIN question_revision AS qr ON qr.id=mqr.id \
36 SELECT GROUP_CONCAT(answer_current.text SEPARATOR '. ') AS text, \
40 SELECT a.question_id as question_id, ar.text as text \
44 SELECT MAX(id) as id, answer_id \
45 FROM answer_revision \
49 ON mar.answer_id = a.id \
50 INNER JOIN answer_revision AS ar ON ar.id=mar.id \
54 GROUP BY question_id \
56 AS answers_combined ON q.id=answers_combined.question_id \
59 # optional - used by command-line search utility to display document information
60 sql_query_info = SELECT title, id FROM question WHERE id=$id
64 # which document source to index
67 # this is path and index file name without extension
68 # you may need to change this path or create this folder
69 path = /var/data/sphinx/cnprog_main
71 # docinfo (ie. per-document attribute values) storage strategy
78 #stopwords = /var/data/sphinx/stopwords.txt
83 # uncomment next 2 lines to allow wildcard (*) searches
87 # charset encoding type
94 # memory limit (default is 32M)
101 # IP address on which search daemon will bind and accept
102 # optional, default is to listen on all addresses,
103 # ie. address = 0.0.0.0
106 # port on which search daemon will listen
109 # searchd run info is logged here - create or change the folder
110 log = /var/log/sphinx/searchd.log
112 # all the search queries are logged here
113 query_log = /var/log/sphinx/query.log
115 # client read timeout, seconds
118 # maximum amount of children to fork
121 # a file which will contain searchd process ID
122 pid_file = /var/log/sphinx/searchd.pid
124 # maximum amount of matches this daemon would ever retrieve
125 # from each index and serve to client