php - Sphinx RT 索引和 SphinxQL 查询

标签 php open-source full-text-search sphinx

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

相关文章:

php - PHP 中管道的非阻塞打开

php - 创建数据库表的文件

c++ - 顺序/在线 kmeans 聚类,它是如何工作的?现有代码?

java - 如何从Github项目编译java文件

c# - 我应该为 .NET 中的新 OSS 项目使用什么许可证

solr - 对结果进行分组并保持分面计数一致

sql-server - 如何从 SQL Server 全文索引返回的文本中生成上下文文本提取?

javascript - 使用ajax将数据发布到当前php页面

php - laravel 上传文件时出现错误

open-source - 开源代码指南?