Thanks, this is what I ended up with as well:
if(params[:title] && params[:title][:topic].present?)
@filter = :title_id
if @group = Group.find(params[:title][:topic])
@matches = @group.groupings.map(&:groupable_id).flatten
end
end
@results = Title.search Riddle.escape(params[:q].to_s),
:with => { @filter => @matches },
:page => params[:page],
:match_mode => :phrase,
:order => '@relevance DESC',
:excerpt_options => {
:exact_phrase => true,
:limit => 2000,
:around => 80,
:force_all_words => true
}
@hits = @results.total_entries rescue 0
Naturally, I found the documentation for passing an array around ten minutes
after I posted.
Walter
On Apr 3, 2014, at 3:20 PM, mamesaye kane wrote:
>
> my newbie 2 cents..
> As far as know you can. You will have to do a separate query first and feed
> the result to you sphinx search like this:
>
> array = Array.new
> arrayOfId = Array.new
> array = ModelName.find_all_by_id(params[:id])
> array.each do |num|
> arrayOfId << num.id
> end
> filters[:nameOfFilter] = arrayOfId # or
> filters[:sphinx_internal_id] = arrayOfId
>
> @results = ThinkingSphinx.search s, :with => filters, :per_page => 10
>
> you may have to use
> Hope it helps
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.