Four Steps to create a sphinx confugiration file
STEP - 1
Create a file named as sphinx.conf
STEP - 2
Declare a source as per following.
source src1
{
type = mysql
sql_host = host name
sql_user = user name
sql_pass = password
sql_db = database name
sql_port = 3306 # optional, default is 3306
sql_query = sql query for fetching data
sql_attr_uint = unique column eg id #can use more than one sql_attr_uint
sql_attr_timestamp = date_added
sql_query_info = sql query for viewing in command prompt
}
STEP - 3
Declare an index as per following.
index test1
{
source = src1
path = /var/lib/sphinxsearch/data/test1
docinfo = extern
charset_type = sbcs
enable_star = 1
min_prefix_len = 1
}
indexer
{
mem_limit = 32M
}
STEP - 4
Declare a searchd function as per following.
searchd
{
port = 9312
log = /var/log/sphinxsearch/searchd.log
query_log = /var/log/sphinxsearch/query.log
read_timeout = 5 #return null if no results found for 5 secs
max_children = 30
#maximum result to show in a dropdown or autocomplete
pid_file = /var/run/searchd.pid
max_matches = 1000 #maximum matches to get from database
seamless_rotate = 1
preopen_indexes = 0
unlink_old = 1
}
After each modification on sphinx.conf file, developer needs to rotate the index declared in the confugiration file.
With Regards,
Er.Animesh Nanda
Software Developer,
Manusis Technology Pvt. Ltd.
Bengaluru,Karnataka,INDIA.