我正在尝试获取所有posiblle响应,但到目前为止只得到了我得到的结果:
index test_responses:找不到分组依据属性'rr'
这是sphinx.conf:
source test_responses {
type = mysql
sql_host = ******
sql_user = ******
sql_pass = ******
sql_db = ******
sql_query_pre = SET NAMES utf8
sql_query = \
SELECT responseID, respondentID, response, \
questionID, surveyID, response as rr \
FROM responses WHERE deleted IS NULL
sql_attr_string = rr
sql_attr_uint = questionID
sql_query_info = SELECT * from responses where responseID = $id
}
index test_responses {
source = test_responses
path = /var/run/sphinxsearch
charset_type = utf-8
}
和PHP代码:
$query_string = "";
$index_name = "test_responses";
$sphinx_client = new SphinxClient();
$sphinx_client->SetServer(SPHINX_HOSTNAME, 3312);
$sphinx_client->SetMatchMode(SPH_MATCH_EXTENDED2);
$sphinx_client->setLimits(0, 0);
$sphinx_client->SetFilter("questionID", 604);
$sphinx_client->SetGroupBy("rr", SPH_GROUPBY_ATTR);
$result = $sphinx_client->Query($query_string, $index_name);
为什么会发生这种情况? ;}
答案 0 :(得分:0)
关于http://sphinxsearch.com/docs/2.0.7/conf-sql-attr-string.html
sql_attr_string = title#将被存储,但不会被编入索引
尝试sql_attr_str2ordinal = rr