jeudi 20 août 2015

Thinking sphinx OR logic with attribute filters

I keep getting this error when attempting the search:

parse error: if() called with 1 args, 3 args expected

Here is my code:

with_display = "*, IF(elite = 1 OR formerly_elite = 1) AS display"

Fund.search @query,
              :sphinx_select => with_display,
              :with  => {:display => 1 }

The index definition looks like this:

define_index :frontend_index do
join fund.sector

indexes name, :as => :fund_name, :sortable => true
indexes summary
indexes isin
indexes sector.name, :as => :sector_name, :sortable => true
indexes other_search_terms

has elite, sector_id, featured, formerly_elite
end

I'm pretty sure what i have is exactly as the docs suggest?

http://ift.tt/1JlzxVc

Can anyone see what the problem is?

Cheers

Aucun commentaire:

Enregistrer un commentaire