我想将Sphinx索引更改为实时。但是在尝试执行搜索查询时,我总是遇到此错误。
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
index serv1: parse error: unknown column: post_category_name
即使我尝试此查询,我也有空结果集,但它不是有效信息:
select * from serv1
如果没有这个配置,evrything工作正常:
type = rt
rt_field = title
rt_field = description
rt_field = post_category_name
我的sphinx.conf是:
source src1
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = root
sql_db = serv
sql_port = 3306
sql_query = select p.id, p.title, p.description, l.Latitude as latitude, $
FROM post p join location l on l.id = p.location_id \
left join post_category pc on pc.post_id=p.id GROUP BY p.id ORDER BY NULL
sql_attr_float = latitude
sql_attr_float = longitude
sql_field_string = title
sql_field_string = description
sql_field_string = post_category_name
}
index serv1
{
type = rt
rt_field = title
rt_field = description
rt_field = post_category_name
source = src1
path = /var/lib/sphinxsearch/data/test1
docinfo = extern
morphology = stem_en
}
searchd
{
listen = 9306:mysql41
log = /var/log/sphinxsearch/searchd.log
query_log = /var/log/sphinxsearch/query.log
read_timeout = 5
max_children = 30
pid_file = /var/run/sphinxsearch/searchd.pid
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
binlog_path = /var/lib/sphinxsearch/data
mysql_version_string = 5.0.37
}
我的搜索查询:
select id, post_category_name , title, description,
WEIGHT()from serv1 where match('@(title,description) site
@post_category_name ALL | THERAPEUTIC') LIMIT 0 , 30 OPTION
ranker=expr('sum(hit_count*user_weight)'),field_weights=
(title=3,body=1);
请帮我找错。
答案 0 :(得分:0)
错误在于不支持在实时索引中指定源。你可以在普通索引中指定一个源,然后在'indexer'的帮助下重建它,或者只是配置一个实时索引,然后插入它或ATTACH一个实时索引的普通索引。 / p>
但你得到的错误应该有另一个原因。也许您修改了配置并添加了新属性,但您的RT索引并不知道。在这种情况下,尝试: