Hello Pat, This didn't work:
@geodist BETWEEN 0 AND 100 But the following did work!: with_display = "*, IF(available_online = 0 OR @geodist < 1000000, 1, 0) AS display" It doesn't raise errors and finds some results. I'm going to perform some tests to check if it is working ok and I'll post the results. Thanks! On Jun 16, 1:17 am, Pat Allan <[email protected]> wrote: > What happens if you put a @ in front of geodist? It's a special internal > attribute from Sphinx's perspective, so you need to tell it that. > > ... OR (@geodist ... > > -- > Pat > > On 16/06/2011, at 5:25 AM, Yomismo wrote: > > > > > > > > > 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 > > athttp://groups.google.com/group/thinking-sphinx?hl=en. -- 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.
