Hello!

I asked this same question some time ago. Pat Allan gave me a hint to
solve the problem, but I didn't manage to make it work.

So I used a different solution, but now the website is working and I
have realized that the other solution would be much better.

So, the problem is simple, I have

class Book < ActiveRecord::Base

define_index do
  indexes title
  has latitude
  has longitude
  has available_online
end

I need to search books that are within certain distance range OR are
available online.

I read this:

http://freelancing-god.github.com/ts/en/common_issues.html#or_attributes

and I've been trying to do something like:

with_display = "*, IF(available_online = 1 OR (geodist BETWEEN 0 AND
100), 1, 0) AS display"

@books = Book.search("The title", :geo =>
[@latitude,@longitude], :sphinx_select => with_display, :with =>
{'display' => 1})

But I get an error:

Riddle::ResponseError: searchd error (status: 1): select: syntax
error, unexpected SEL_TOKEN near 'BETWEEN 0 AND 3), 1, 0) AS display'

So, the thing is... Is it possible to filter the "geodist" attribute
that way?? I don't even know if I should use "geodist" or the column
has some other name or if the syntax is correct. Any ideas??

Thank you very much for your help!

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to