0
我使用PHP斯芬克斯客戶端(PECL):如何獲取表獅身人面像的名字?
$s = new SphinxClient; $s->setServer("localhost", 9312);
$s->setMaxQueryTime(9000);
$s->setMatchMode(SPH_MATCH_ANY);
$result = $s->query($_POST['search'], '*');
var_dump($result);
請求後我得到一個輸出數組:
["fields"]=>
array(4) {
[0]=>
string(4) "type"
[1]=>
string(18) "specializationname"
[2]=>
string(17) "detailtousersname"
[3]=>
string(18) "detailtousersphoto"
}
在輸出陣列我試圖讓表,其中發現數據的名稱( ID的)。此設置我定在sphinx.conf中:
sql_query = SELECT idArticle as id, 'article' as type...
sql_field_string = type
如何,我可以得到一個表名'article'
?
源配置例如:
source users : lsParentSource
{
sql_query_range = SELECT MIN(idDetailToUsers), MAX(idDetailToUsers) FROM detailtousers
sql_range_step = 128
sql_query = SELECT idDetailToUsers as id, 9 as type, UsersTypeAccount, idDetailToUsers, SpecializationName, DetailToUsersName, DetailToUsersPhoto, city, country FROM detailtousers join users ON users.idUsers = detailtousers.idDetailToUsers left join usersspecialization ON usersspecialization.UsersSpecializationIdUser = detailtousers.idDetailToUsers left join specializationtousers ON specializationtousers.idSpecialization = usersspecialization.UsersSpecializationIdSpecialization WHERE idDetailToUsers >= $start AND idDetailToUsers <= $end GROUP BY idDetailToUsers
sql_attr_uint = type
sql_attr_uint = idDetailToUsers
sql_attr_uint = UsersTypeAccount
sql_field_string = SpecializationName
sql_field_string = DetailToUsersName
sql_field_string = DetailToUsersPhoto
sql_attr_uint = city
sql_attr_uint = country
sql_query_info = SELECT idDetailToUsers, DetailToUsersName, UsersTypeAccount, SpecializationName, DetailToUsersPhoto, city, country \
FROM detailtousers WHERE idDetailToUsers = $id
sql_ranged_throttle = 0
}
沒有'attr'數組。我添加到問題我的源配置 – Mario
在一個索引'type'是一個字符串屬性,另一個是int。它需要匹配。 – barryhunter