Hi, everyone! Kind of new to Sphinx and Thinking Sphinx. Seems to be
pretty great so far, though! I do have a question about
aggregation ... For example, let's say you're creating a blog
application and would like people to be able to search on posts. Since
there are often insightful comments, you want the search to return
posts whose comments match the search term, even if the posts don't.
And you wan to highlight the search terms. The thing that's come to
mind is to define an index like so:

class Post < ActiveRecord::Base
  define_index do
    indexes subject
    indexes body
    indexes comments(:body), :as => comments_text
  end
end

Which would let us include the comments in the Post. Is there a better
way? Such as indexing body on comments and somehow combining them in a
query? I suspect not, but thought I'd ask. Also, I suspect that if a
post has many long comments, we might run into some size issues
(currently setting group_concat_max_len to 1 MB).

Also, if you wanted to highlight found search terms, then ... I
suppose there are several ways, but none of the ones I've come up with
sound great. The simplest one (and possibly the least performant)
would be to index body on comments and run the search against each of
those to be able to get excerpts. Any better ideas?

Thanks!

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