Hello,

I am not sure what the root cause is, but here are the symptoms.

I have 2 models

class Comment < ActiveRecord::Base
  belongs_to :commentable, :polymorphic => true
end

class ChangeRequest < ActiveRecord::Base
  has_many :comments, :as => :commentable, :dependent => :destroy
  # Sphinx index
  define_index do
    indexes comments.text, :as => :comments
  end
end

Comments' text can sometimes be pretty large, as you would expect.
Some change requests have many comments.  It is not uncommon for some
to have 20-30 comments.

What I am experiencing is that some change requests' comments are
indexed fine and are searchable, while other requests' comments are
not searchable.  It seems I am seeing 2 patterns:

1.  From what I can see change requests with large amount of comments
and comment text are the ones that fail to index/search.  Those
requests that have only a few comments that are small do not run into
this issue.
2.  Those change requests that do have issues with comments being
searchable, fail to search across ALL associated comments, with small
or big text.  It is almost like an all or nothing deal.  I do have
other fields of change request model being index, and those work fine
in all cases, regardless if there is an issue with the comments
association being indexed.

Could you please point me in the direction of what you think might be
causing this or a better way to debug/research the issue?  The only
way I can test and re-produce this behaviour is running searches
against random change requests and see which ones work and which ones
don't, but this is not very scientific.  The searchd.log and
searchd.query.log seem to be clean.

Also, please do let me know if I need to define the index differently
in case of such large associations being indexed.  Thank you in
advance.

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