It seems, UltraSphinx has some minor trouble getting the SQL for more
complex queries right.

I've used it like this:

is_indexed :fields =>
[:name, :description, :updated_at, :created_at, :orders_count, :views, 
:low_res, :category_id],
             :concatenate => [{:association_name => "tags", :field =>
"name", :as => "tag_name",
                               :association_sql => "LEFT JOIN taggings
ON (taggings.taggable_id=products.id AND
taggings.taggable_type='Product') LEFT JOIN tags ON
taggings.tag_id=tags.id"}],
             :include => [{:association_name => "member", :field =>
"rating", :as => "member_rating",
                           :association_sql => "LEFT JOIN members ON
members.id=products.member_id LEFT JOIN ratings ON
(ratings.rateable_id=members.id AND
ratings.rateable_type='Member')"}],
             :conditions => "status = 1",
             :delta => {:field => "updated_at"}

The first index, concatenating all tags of
acts_as_taggable_on_steroids worked out of the box.
Then I added the second one to get the acts_as_rateable data in and
allow for sorting by ratings
This one failed to generate the correct SQL out of the belongs_to
relationship of the rating.
(It used the singular association name "member" as a table name
instead of members
Maybe it's my fault and I got some syntax detail wrong, but i tried
several variatons, all failed.

So at the end I took the generated sphinx config file and corrected
the SQL. Which means
of course, that in future I've to be careful about running us:config.
But still, all the rest of
the generated config saves a lot of work.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to