Sphinx 的 sql_range_query 错误
在我的生产服务器上设置 Sphinx 时,尝试索引时出现了这个奇怪的错误
ERROR: index 'benefit_core': sql_range_query: You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version for the
right syntax to use near '' at line 1
,这在我的本地计算机上不会发生。是的,那是一个空字符串。
以前有人见过这种类型的问题吗?
benefit.rb
define_index do
# Fields
indexes category
indexes title
indexes tags
indexes description
indexes brief_description
indexes brand
indexes short_description
indexes long_description
indexes benefit_description
indexes address.city
indexes address.state
indexes address.street_1
where sanitize_sql(["active = true and expiration > ?", Time.now])
set_property :field_weights => {
:title => 15,
:tags => 10,
:brand => 10,
:description => 3
}
end
Thinking-Sphinx - 1.4.4
Sphinx - 0.9.9
谢谢!
While setting up Sphinx on my production server, this strange error came up when trying to index
ERROR: index 'benefit_core': sql_range_query: You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version for the
right syntax to use near '' at line 1
This doesn't happen on my local machine. And yes, that is an empty string.
Does anyone seen this type of issue before?
benefit.rb
define_index do
# Fields
indexes category
indexes title
indexes tags
indexes description
indexes brief_description
indexes brand
indexes short_description
indexes long_description
indexes benefit_description
indexes address.city
indexes address.state
indexes address.street_1
where sanitize_sql(["active = true and expiration > ?", Time.now])
set_property :field_weights => {
:title => 15,
:tags => 10,
:brand => 10,
:description => 3
}
end
Thinking-Sphinx - 1.4.4
Sphinx - 0.9.9
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保您运行的是最新版本的 Thinking Sphinx,3.0.4 左右。
sanitize_sql
似乎存在一些问题https:/ /github.com/freelancing-god/thinking-sphinx/issues/213
还尝试将该行重写为
还尝试注释掉所有行并逐渐将它们添加回来以确定错误的确切位置发生。
Be sure you are running the most recent version of Thinking Sphinx, 3.0.4 or so. Looks like there has been some issues with
sanitize_sql
https://github.com/freelancing-god/thinking-sphinx/issues/213
Also try re-writing the line to be
Also try commenting out all the lines and gradually add them back to determine exactly where the error is occurring.
问题最终出在
sanitize_sql
方法上。我将该行替换为:感谢您的帮助!
The problem ended up being with the
sanitize_sql
method. I replaced that line with:Thanks for the help!