mysql - Sphinx - 无增量 :sql_range_query

标签 mysql wordpress sphinx

我一直在尝试让 WordPress 的 Sphinx 搜索插件正常工作,但遇到了麻烦。我的服务器上有 Sphinx,并且使用源附带的测试数据库安装运行良好。但是,当我尝试使用 Sphinx 搜索插件 ( copy here ) 提供的 sphinx.conf 索引 WP 时,它拒绝处理。当我通过命令行运行它时,我得到以下输出:

# /usr/local/bin/indexer --rotate --config /home/example.com/public_html/wp-content/uploads/sphinx/sphinx.conf dk_delta dk_main dk_stats
Sphinx 2.2.9-id64-release (rel22-r5006)
Copyright (c) 2001-2015, Andrew Aksyonoff
Copyright (c) 2008-2015, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/home/example.com/public_html/wp-content/uploads/sphinx/sphinx.conf'...
indexing index 'dk_delta'...
ERROR: index 'dk_delta': sql_range_query: 'example.com.p.post_title' isn't in GROUP BY (DSN=mysql://dekanta_flyus3r:***@localhost:3306/example.com).
total 0 docs, 0 bytes
total 0.003 sec, 0 bytes/sec, 0.00 docs/sec
indexing index 'dk_main'...
ERROR: index 'dk_main': sql_range_query: 'example.com.p.post_title' isn't in GROUP BY (DSN=mysql://dekanta_flyus3r:***@localhost:3306/example.com).
total 0 docs, 0 bytes
total 0.003 sec, 0 bytes/sec, 0.00 docs/sec
indexing index 'dk_stats'...
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.003 sec, 0 bytes/sec, 0.00 docs/sec
total 1 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 7 writes, 0.000 sec, 0.4 kb/call avg, 0.0 msec/call avg
rotating indices: successfully sent SIGHUP to searchd (pid=20768).

问题肯定是 WordPress 数据库中没有 dk_delta、dk_main 或 dk_stats 表(我使用的是 dk_ 前缀),这让我很困惑,因为这个插件兼容最新的 WordPress。这让我相信我一定错过了这个过程中的一个重要步骤,例如我是否必须首先使用 sphinx 索引所有数据库,安装额外的 sql 表等。

我已经在 WordPress 支持论坛上发布了这个插件的信息,但没有人回复,而且距离那里有任何事件已经一个月了,所以我没有抱太大希望。如有任何建议,我们将不胜感激,谢谢。

最佳答案

我认为这是因为您使用的是最新版本的 MySQL,它对 GROUP BY 查询有更严格的语义。 ONLY_FULL_GROUP_BY 选项已开启。

这些错误是由 MySQL 服务器产生的,indexer 只是“报告”它无法运行配置文件中提供的 MySQL 查询。

http://www.tocker.ca/2014/01/24/proposal-to-enable-sql-mode-only-full-group-by-by-default.html

MySQL : isn't in GROUP BY

https://dev.mysql.com/doc/refman/5.0/en/group-by-handling.html

https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html#sqlmode_only_full_group_by

http://mechanics.flite.com/blog/2013/02/12/why-i-use-only-full-group-by/

该配置文件中的查询适用于旧版本的 MySQL,历史上 MySQL 对编写 GROUP BY 查询的方式非常宽松。

或者

  1. MySQL 查询需要更新才能在启用 ONLY_FULL_GROUP_BY 的情况下使用,或者
  2. 可以更改 MySQL 服务器设置以允许这些类型的查询。
<小时/>

对于 1. 自由使用 ANY_VALUE() 函数

http://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_any-value

(事实上,该函数的文档可能是对问题最简洁的解释!)

关于mysql - Sphinx - 无增量 :sql_range_query,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31746432/

相关文章:

php - 在 Woocommerce 单一产品页面中显示空白 (0) 星级

wordpress - 已关闭插件 Yuzo 相关帖子中的漏洞

php - 如何在php中实现mysql compress()函数

php - Sphinx 搜索重建索引

Mysql WHERE 字段包含 JSON 变量

php - 如何使用此 id 编写此查询?

mysql - 如何从 mysql 查询编辑 WordPress 页面

performance - 像 sphinx 一样在ElasticSearch中分页结果

java - 使用 OpenJPA 从数据库中未检索到主键(ID)(?)

php - Laravel 嵌套数组的类型转换