I'm using ThinkingSphinx.search (global search) to search across
multiple models. For simplicity, I'll refer to two models: Article and
Comment.
I'm wrapping the ThinkingSphinx search into a Search model that groups
the results into an ordered hash so I can then pull out the results
for whichever model I'm looking for (useful for a multi-result search
page). So it's something like this:
<pre>
class Search
def self.grouped(keywords)
ThinkingSphinx.search(keywords).group_by { |kind|
kind.class.to_s.underscore }
end
end
</pre>
So on the multi-result page I'm only showing the top 5 of each model,
with a link to "see all" that shows the full results page. The problem
is, the results are different for global search vs. model search. For
example:
<pre>
>> Article.search('morgantown').size
>> # => 125
>> Search.grouped('morgantown')["article"].size
>> # => 19
</pre>
My only thought is I'm also indexing the associated tags for the
Article model, and maybe the global search doesn't search across the
tags (associated indexes) as well?
Any help would be greatly appreciated!
--
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.