I would like to run sphinx search against the results of a named scope
i have (see below).
Seems like it will not work the way I had hoped (the search seems to
ignore the named_scope) and maybe I need to put everything in sphinx
instead of in AR.
But how to convert this kind of query into sphinx ...boy am i lost on
that. I would love to get any idea or advice on how to proceed from
here.
in model:
named_scope :user_in_and_following, lambda { |user| {:include =>
[:user,:users],
:conditions => ["conversations.user_list like
'%,?,%' or (conversations.user_id in (?) and conversations.type = 3)",
user.id,user.following]} }
define_index do
indexes body
indexes description
indexes title
indexes url
indexes tags.name, :as => :tag_name
indexes updated_at, :sortable => true
indexes comments.comment, :as => :comment_content
indexes [user.first_name, user.last_name], :as
=> :user_name
end
in controller:
@results = Conversation.search(params[:search],
:page => params[:page], :per_page => 25, :order =>
"updated_at desc",
:field_weights => {:title => 20,
:tag => 17,
:url => 15,
:description => 14,
:body => 10,
:comment_content => 5},
:match_mode => :boolean).compact
--
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.