Skip to content

Instantly share code, notes, and snippets.

@favrik
Created September 7, 2012 01:53
Show Gist options
  • Save favrik/3662516 to your computer and use it in GitHub Desktop.
Save favrik/3662516 to your computer and use it in GitHub Desktop.
sphinx.conf
#############################################################################
## data source definition
#############################################################################
source users
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = k
sql_db = qchess
sql_port = 3306
sql_query = \
SELECT \
u.user_id, u.username AS str_username, lower(u.username) AS ordinal_username, \
u.first_name, u.last_name, u.country_id, unix_timestamp(u.last_login_date) AS last_login_date, \
unix_timestamp(u.activate_date) AS activate_date, u.points, u.user_id AS user_id_filter \
FROM \
user AS u \
WHERE \
u.is_enabled = 1;
sql_attr_uint = user_id_filter
sql_attr_uint = country_id
sql_attr_timestamp = last_login_date
sql_attr_timestamp = activate_date
sql_attr_uint = points
sql_attr_str2ordinal = ordinal_username
#sql_attr_string = str_username
}
source usernames : users
{
sql_query = \
SELECT \
u.user_id, u.username, lower(u.username) AS ordinal_username, \
u.country_id, unix_timestamp(u.last_login_date) AS last_login_date, \
unix_timestamp(u.activate_date) AS activate_date, u.points, u.user_id AS user_id_filter \
FROM \
user AS u \
WHERE \
u.is_enabled = 1;
}
source echess_users
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = k
sql_db = qchess
sql_port = 3306
sql_query = \
SELECT \
u.user_id,u.username,lower(u.username) AS ordinal_username,u.first_name,u.last_name,u.country_id,u.is_online, \
ugse.total_game_count, ugse.rating \
FROM \
user AS u, \
user_game_stats_email AS ugse \
WHERE \
u.is_enabled = 1 AND \
u.user_id = ugse.user_id AND \
ugse.is_active = 1;
sql_attr_uint = country_id
sql_attr_uint = rating
sql_attr_uint = total_game_count
sql_attr_bool = is_online
sql_attr_str2ordinal = ordinal_username
}
source echess_usernames : echess_users
{
sql_query = \
SELECT \
u.user_id,u.username,lower(u.username) AS ordinal_username,u.country_id,u.is_online, \
ugse.total_game_count, ugse.rating \
FROM \
user AS u, \
user_game_stats_email AS ugse \
WHERE \
u.is_enabled = 1 AND \
u.user_id = ugse.user_id AND \
ugse.is_active = 1;
}
source echess_users_chess960
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = k
sql_db = qchess
sql_port = 3306
sql_query = \
SELECT \
u.user_id,u.username,lower(u.username) AS ordinal_username,u.first_name,u.last_name,u.country_id,u.is_online, \
ugse.total_game_count, ugse.rating \
FROM \
user AS u, \
user_game_stats_email_chess960 AS ugse \
WHERE \
u.is_enabled = 1 AND \
u.user_id = ugse.user_id AND \
ugse.is_active = 1;
sql_attr_uint = country_id
sql_attr_uint = rating
sql_attr_uint = total_game_count
sql_attr_bool = is_online
sql_attr_str2ordinal = ordinal_username
}
source echess_usernames_chess960 : echess_users_chess960
{
sql_query = \
SELECT \
u.user_id,u.username,lower(u.username) AS ordinal_username,u.country_id,u.is_online, \
ugse.total_game_count, ugse.rating \
FROM \
user AS u, \
user_game_stats_email_chess960 AS ugse \
WHERE \
u.is_enabled = 1 AND \
u.user_id = ugse.user_id AND \
ugse.is_active = 1;
}
source forum_topics
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = k
sql_db = qchess
sql_port = 3306
sql_query = \
SELECT \
ft.forum_topic_id,ft.subject,ft.body,ft.parent_category_id \
FROM \
forum_topic ft \
WHERE \
ft.forum_topic_type_id = 1 AND \
ft.is_live=1 AND \
ft.is_parent_topic = 1;
sql_attr_uint = parent_category_id
}
#############################################################################
## index definition
#############################################################################
index users
{
source = users
path = /home/favio/sphinx/data/users
morphology = none
enable_star = 0
min_word_len = 1
min_prefix_len = 0
min_infix_len = 1
}
index users_by_username : users
{
source = usernames
path = /home/favio/sphinx/data/users_by_username
min_word_len = 3
min_infix_len = 0
}
index echess_users
{
source = echess_users
path = /home/favio/sphinx/data/echess_users
morphology = none
enable_star = 0
min_word_len = 1
min_prefix_len = 0
min_infix_len = 1
}
index echess_users_by_username : echess_users
{
source = echess_usernames
path = /home/favio/sphinx/data/echess_users_by_username
min_word_len = 3
min_infix_len = 0
}
index echess_users_chess960
{
source = echess_users_chess960
path = /home/favio/sphinx/data/echess_users_chess960
morphology = none
enable_star = 0
min_word_len = 1
min_prefix_len = 0
min_infix_len = 1
}
index echess_users_chess960_by_username : echess_users_chess960
{
source = echess_usernames_chess960
path = /home/favio/sphinx/data/echess_users_chess960_by_username
min_word_len = 3
min_infix_len = 0
}
index forum_topics
{
source = forum_topics
path = /home/favio/sphinx/data/forum_topics
morphology = none
enable_star = 0
min_word_len = 1
min_prefix_len = 0
min_infix_len = 1
}
#############################################################################
## indexer settings
#############################################################################
indexer
{
# memory limit, in bytes, kiloytes (16384K) or megabytes (256M)
# optional, default is 32M, max is 2047M, recommended is 256M to 1024M
mem_limit = 32M
# maximum IO calls per second (for I/O throttling)
# optional, default is 0 (unlimited)
#
# max_iops = 40
# maximum IO call size, bytes (for I/O throttling)
# optional, default is 0 (unlimited)
#
# max_iosize = 1048576
}
#############################################################################
## searchd settings
#############################################################################
searchd
{
# IP address to bind on
# optional, default is 0.0.0.0 (ie. listen on all interfaces)
#
# address = 127.0.0.1
# address = 192.168.0.1
# searchd TCP port number
# mandatory, default is 3312
port = 3312
# log file, searchd run info is logged here
# optional, default is 'searchd.log'
log = searchd.log
# query log file, all search queries are logged here
# optional, default is empty (do not log queries)
query_log = sphinx-query.log
# client read timeout, seconds
# optional, default is 5ho
read_timeout = 5
# maximum amount of children to fork (concurrent searches to run)
# optional, default is 0 (unlimited)
max_children = 30
# PID file, searchd process ID file name
# mandatory
pid_file = searchd.pid
# max amount of matches the daemon ever keeps in RAM, per-index
# WARNING, THERE'S ALSO PER-QUERY LIMIT, SEE SetLimits() API CALL
# default is 1000 (just like Google)
max_matches = 1000
# seamless rotate, prevents rotate stalls if precaching huge datasets
# optional, default is 1
seamless_rotate = 1
# whether to forcibly preopen all indexes on startup
# optional, default is 0 (do not preopen)
preopen_indexes = 0
# whether to unlink .old index copies on succesful rotation.
# optional, default is 1 (do unlink)
unlink_old = 1
}
# --eof--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment