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!
The problem ended up being with the
sanitize_sqlmethod. I replaced that line with:Thanks for the help!