Simple problem: I'm using the Savage-Beast forums plugin. It's great.
I'm trying to replace its simple SQL search function with the powerful
Sphinx/TS. Straightforward model relationship you'd expect for a
forum:
Form has_many Topic(s) which has_many Post(s). I'm indexing only the
Post model for now:
class Post
define_index do
indexes body
has user_id, created_at, updated_at
has topic(:title), :as => :topic_title
has topic.forum(:name), :as => :forum_name
end
end
Obviously, topic_title and forum_name would be the dynamic attributes
in this setup.
Running Post.search, I was hoping that each Post result would include
these two dynamic attributes. But they don't. And I couldn't find any
options to run with Post.search that would slurp in these attributes.
(Savage-Beast's code wants them.)
Oddly enough, if I run the sql_query that appears in the sphinx config
file, that search does nicely include the dynamic attributes. That
query is clearly constructed from the "define_index" code above.
Evidently, Post.search doesn't use that sql_query from config.
Sorry for the long post. My simple question is the following: Is there
an elegant way to have Post.search return Post objects that contain
the two dynamic attributes (topic_title and forum_name) defined in the
"define_index" code?
Thanks
Peter
--
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.