编程语言
首页 > 编程语言> > php-Sphinx RT索引和SphinxQL查询

php-Sphinx RT索引和SphinxQL查询

作者:互联网

我们正在架构中部署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
        }

面临的问题

问题1:
        我们如何在SPHINXQL中获得count()查询结果.因为它对我们很重要,所以基于客户数量,我们必须将其显示在我们的应用程序中.

下面的例子

Query - select count(*) from logtable where CustomerId='871';   

在SphinxQL中-我们没有得到此结果并得到以下错误.错误1064(42000):索引日志表:无效的架构:查询了Count(*)或@count,但在架构中不可用.

问题2:
        我在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')

标签:sphinx,open-source,full-text-search,php
来源: https://codeday.me/bug/20191101/1982803.html