A small update,

user_ids =  [1, 3, 2]

I tried with *:sql => {:order => "field(id,#{user_ids.join(',')})"}*

but that still does not give me the result in the expected sorting order.I see
that we can pass :sql => :order in options when we need to sort on sql.

User.where(:id =>  [1, 2, 3])*.order("field(id,#{user_ids.join(',')})") *gives
me proper results as expected

Please correct me if i am doing anything wrong here.

Thanks,




Regards,
Sabarish S


On Mon, Oct 7, 2013 at 8:02 PM, JSWorld <[email protected]> wrote:

> Hi Pat,
>
> I have a requirement where I want to get results based on the order of IDs
> that i pass to sphinx:
>
> I did sorting and filtering with ruby and then find order of user_ids to be
>
> user_ids = [1, 3, 2]
>
> Now, I want to apply search on top of this like :
>
> User.search_for_ids("Test", {:with => {:page => params[:page], :per_page
> => 25, :sphinx_internal_id => user_ids}, *:order => user_ids*})
>
> Is there a way to preserve the order with respect to user_ids ? Any help
> is much appreciated.
>
> Thanks,
>
>  --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.

Reply via email to