Thinking Sphinx doesn't find any records with negative column values. In my case, the column is "site_id", which can contain -1 (we use -1 instead of NULL). My index looks like the sample below (with the four different examples that I tried separately):
ThinkingSphinx::Index.define :incident, with: :active_record, delta: ThinkingSphinx::Deltas::ResqueDelta do
indexes site_id
# indexes site_id, type: :float
# has site_id
# has site_id, type: :float
end
The solutions I tried are according to this answer and this answer, but it doesn't work for me. My Sphinx version doesn't support the == operator for floats. I get:
sphinxql: only >=, <=, and BETWEEN floating-point filter types are supported in this version
Upgrading Sphinx is not really an option. What else can be done to make this work?
The bigint
type should be useful - its the only sphinx attribute integer type that is signed.
(as found comparing floats is more complicated, because a comparison needs to implement a threadshold - because floats are inexact - sphinx doesnt do that with filters, but can be workedaround with the IF function - no idea how to put that into thinkingsphinx)