我们正在我们的架构中部署 RT 索引。但我们需要澄清一些,并在部署过程中遇到一些困难。
索引中定义的架构:
index logtable
{
type = rt
path = /usr/local/sphinx20/var/data/logtable
rt_attr_string = TransactionId
rt_attr_uint = CustomerId
rt_attr_timestamp = DateOfTransaction
rt_attr_string = CustomerFeedback
rt_field = TransactionType
}
遇到的问题
问题一: 我们如何在 SPHINXQL 中获取 count() 查询结果。因为它对我们很重要,所以根据客户数量,我们必须将其显示在我们的应用程序中。
下面的例子,
Query - select count(*) from logtable where CustomerId='871';
在 SphinxQL 中 - 我们没有得到此结果并收到以下错误。错误 1064 (42000):索引日志表:无效架构:查询了 Count(*) 或 @count,但在架构中不可用。
问题二: 我在 conf 中为“TransactionId”字段声明为 STRING 属性,但如果该字段在 where 条件下使用,我将无法检索记录。
Example below,
select * from logtable where TransactionId='TRA23454';
我得到以下错误, 错误 1064 (42000): sphinxql: 语法错误,意外的 $undefined,期望 CONST_INT 或 CONST_FLOAT 或 '-' 靠近 '"TRA23454"'
如果知道,请帮助我们关闭这些问题。
库马兰
最佳答案
select * from logtable where TransactionId='TRA23454';
回答:
select * from logtable where MATCH('@TransactionId TRA23454')
关于php - Sphinx RT 索引和 SphinxQL 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10595934/