]> git.openstreetmap.org Git - osqa.git/blob - sphinx/sphinx.conf
initial import
[osqa.git] / sphinx / sphinx.conf
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
4
5 source src_cnprog
6 {
7         # data source
8         type            = mysql
9         sql_host        = localhost
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
14         #sql_port       = 3306
15         #sql_sock       = /var/lib/mysql/mysql.sock
16
17         # pre-query, executed before the main fetch query
18         sql_query_pre   = SET NAMES utf8
19
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 \
24                             FROM question AS q \
25                             INNER JOIN \
26                             ( \
27                                 SELECT MAX(id) as id, question_id \
28                                 FROM question_revision \
29                                 GROUP BY question_id \
30                             ) \
31                             AS mqr \
32                             ON q.id=mqr.question_id \
33                             INNER JOIN question_revision AS qr ON qr.id=mqr.id \
34                             LEFT JOIN \
35                             ( \
36                                 SELECT GROUP_CONCAT(answer_current.text SEPARATOR '. ') AS text, \
37                                        question_id \
38                                 FROM \
39                                 ( \
40                                     SELECT a.question_id as question_id, ar.text as text \
41                                     FROM answer AS a \
42                                     INNER JOIN \
43                                     ( \
44                                         SELECT MAX(id) as id, answer_id \
45                                         FROM answer_revision \
46                                         GROUP BY answer_id \
47                                     ) \
48                                     AS mar \
49                                     ON mar.answer_id = a.id \
50                                     INNER JOIN answer_revision AS ar ON ar.id=mar.id \
51                                     WHERE a.deleted=0 \
52                                 ) \
53                                 AS answer_current \
54                                 GROUP BY question_id \
55                             ) \
56                             AS answers_combined ON q.id=answers_combined.question_id \
57                             WHERE q.deleted=0;
58
59         # optional - used by command-line search utility to display document information
60         sql_query_info  = SELECT title, id FROM question WHERE id=$id
61 }
62
63 index cnprog {
64         # which document source to index
65         source          = src_cnprog
66
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
70
71         # docinfo (ie. per-document attribute values) storage strategy
72         docinfo         = extern
73
74         # morphology
75         morphology      = stem_en
76
77         # stopwords file
78         #stopwords      = /var/data/sphinx/stopwords.txt
79
80         # minimum word length
81         min_word_len    = 1
82
83         # uncomment next 2 lines to allow wildcard (*) searches
84         #min_infix_len = 1
85         #enable_star = 1
86
87         # charset encoding type
88         charset_type    = utf-8
89 }
90
91 # indexer settings
92 indexer
93 {
94         # memory limit (default is 32M)
95         mem_limit       = 64M
96 }
97
98 # searchd settings
99 searchd
100 {
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
104         address         = 127.0.0.1
105
106         # port on which search daemon will listen
107         port            = 3312
108
109         # searchd run info is logged here - create or change the folder
110         log             = /var/log/sphinx/searchd.log
111
112         # all the search queries are logged here
113         query_log       = /var/log/sphinx/query.log
114
115         # client read timeout, seconds
116         read_timeout    = 5
117
118         # maximum amount of children to fork
119         max_children    = 30
120
121         # a file which will contain searchd process ID
122         pid_file        = /var/log/sphinx/searchd.pid
123
124         # maximum amount of matches this daemon would ever retrieve
125         # from each index and serve to client
126         max_matches     = 1000
127 }