Hello, i have some problem with index conditions.
I'm have Post model with polymorphic relationship with Club model and
Project model. And i can't index posts if club or project is not
active.

Look this:

class Post < ActiveRecord::Base

  belongs_to :owner, :polymorphic => true

  define_index do
    indexes title, cached_tag_list
    indexes body, :html_strip => true

    has owner.city_id, :as => :city_id

    where "(`clubs`.activated_at IS NOT NULL OR
`projects`.activated_at IS NOT NULL)"

    set_property :match_mode => :boolean
    set_property :delta => true
  end

end

class Club < ActiveRecord::Base
  has_many :posts, :as => :owner
end

class Project < ActiveRecord::Base
  has_many :posts, :as => :owner
end

If i'm have projects and clubs and posts index sql query is good! But
if i'm don't have Project for example in index sql query join with
table projects is not present. And i'm have error on indexing:

ERROR: index 'post_core': sql_range_query: Unknown column
'projects.activated_at' in 'where clause' (DSN=mysql://
root:*...@localhost:3306/clubovorot).

What can i do?

--~--~---------~--~----~------------~-------~--~----~
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