Skip to content

Instantly share code, notes, and snippets.

@nikoncode
Created March 23, 2014 11:12
Show Gist options
  • Select an option

  • Save nikoncode/9721743 to your computer and use it in GitHub Desktop.

Select an option

Save nikoncode/9721743 to your computer and use it in GitHub Desktop.
sphinx indexes
searchd
{
listen = 1337:mysql41
pid_file = /var/run/searchd.pid
log = /var/log/sphinxsearch/log.txt
query_log = /var/log/sphinxsearch/query_log.txt
}
source users
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass =
sql_db = test
sql_query_pre = SET NAMES utf8
sql_query = SELECT id, CONCAT(users.fname,' ',users.lname) as fio, IF(IFNULL(TIMESTAMPDIFF(YEAR,users.bdate,CURDATE()), 0) < 0, 0, IFNULL(TIMESTAMPDIFF(YEAR,users.bdate,CURDATE()), 0)) AS age, users.country as country, users.city AS city, (SELECT name FROM clubs WHERE clubs.id = cid) AS club, users.work as work FROM users
sql_field_string = fio
sql_attr_uint = age
sql_field_string = country
sql_field_string = city
sql_field_string = club
sql_field_string = work
}
index users_index
{
type = plain
source = users
charset_type = utf-8
preopen = 1
path = /var/lib/sphinxsearch/data/users_index
}
source clubs
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass =
sql_db = test
sql_query_pre = SET NAMES utf8
sql_query = SELECT id, name, coords, ability, type, country, city, avatar FROM clubs
sql_field_string = name
sql_field_string = country
sql_field_string = city
sql_field_string = ability
sql_attr_string = avatar
sql_attr_string = coords
sql_attr_bool = type
}
index clubs_index
{
type = plain
source = clubs
charset_type = utf-8
preopen = 1
path = /var/lib/sphinxsearch/data/clubs_index
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment