我正在尝试使用最新版本的 sphinx 2.0.4 为我的网站构建搜索引擎。到目前为止,索引和发送查询都有效。但我也想显示一些方面,所以我会做两次相同的查询。第一个用于正常搜索结果,第二个用于对某个属性进行分组。我的 sphinx.conf 看起来像这样:
{
...
sql_query = \
SELECT aID AS id, aFullname AS text, 'artist' AS type \
FROM artist
sql_attr_string = type
sql_ranged_throttle = 0
sql_query_info = SELECT * FROM artist WHERE aID=$id
}
source src2
{
...
sql_query = \
SELECT album_id AS id, album_name AS text, 'album' AS type \
FROM albums
sql_attr_string = type
sql_ranged_throttle = 0
sql_query_info = SELECT * FROM albums WHERE album_id=$id
}
index rt
{
type = rt
path = /var/data/rt
rt_field = text
rt_attr_uint = id
rt_attr_string = type
}
但是当我使用第二个查询时
$cl->SetGroupBy('type', SPH_GROUPBY_ATTR, '@count desc' );
我收到此错误:
WARNING: index rt: group-by attribute 'type' not found
任何人都可以在我的配置中发现错误吗?