Skip to content

Instantly share code, notes, and snippets.

Created August 18, 2013 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2c1b32be9c7dd61bc24f to your computer and use it in GitHub Desktop.
Save anonymous/2c1b32be9c7dd61bc24f to your computer and use it in GitHub Desktop.
sphinx.conf
source src1
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = root
sql_db = cumlesozluk
sql_port = 3306 # optional, default is 3306
sql_query = \
SELECT u.username, a.user_id, a.id,a.text,a.lang as fromLang, b.lang as toLang,\
GROUP_CONCAT(DISTINCT b.id) AS translation_ids , GROUP_CONCAT(DISTINCT b.text) AS translation_texts\
FROM(select s.*\
from sentence AS s\
WHERE s.lang IN ('tur','eng','deu','fra','spa','ita','por','rus','ara','pes','bul')\
order by s.id\
LIMIT 10\
) a INNER JOIN\
sentence_relationship sr\
ON sr.sentence_id = a.id INNER JOIN\
sentence b\
ON b.id = sr.translation_id AND a.id = sr.sentence_id INNER JOIN\
users as u\
ON u.id = a.user_id\
WHERE \
b.lang IN ('tur','eng','deu','fra','spa','ita','por','rus','ara','pes','bul') \
GROUP BY a.id
sql_attr_uint = id
sql_attr_string = fromLang
sql_attr_string = toLang
sql_query_info = \
SELECT u.username, a.user_id, a.id AS id,a.text,a.lang as fromLang, b.lang as toLang,\
GROUP_CONCAT(DISTINCT b.id) AS translation_ids , GROUP_CONCAT(DISTINCT b.text) AS translation_texts\
FROM (select s.*\
from sentence s\
WHERE s.lang = $fromLang AND s.id=$id\
order by s.id\
) a INNER JOIN\
sentence_relationship sr\
ON sr.sentence_id = a.id INNER JOIN\
sentence b\
ON b.id = sr.translation_id AND a.id = sr.sentence_id INNER JOIN\
users as u\
ON u.id = a.user_id\
WHERE b.lang = $toLang\
GROUP BY a.id
}
index search
{
source = src1
path = /var/data/sentence
docinfo = extern
charset_type = utf-8
}
indexer
{
mem_limit = 256M
}
searchd
{
listen = 9312
listen = 9306:mysql41
log = /opt/sphinx/var/log/searchd.log
query_log = /opt/sphinx/var/log/query.log
read_timeout = 5
max_children = 30
pid_file = /opt/sphinx/var/log/searchd.pid
max_matches = 1000
seamless_rotate = 1
preopen_indexes = 0
unlink_old = 1
workers = threads # for RT to work
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment