Re: [ts] Access the value of one of the indexes.

8 views
Skip to first unread message

Pat Allan

unread,
Nov 5, 2012, 5:05:37 AM11/5/12
to thinkin...@googlegroups.com
Yup, you can access that value through each search result with the sphinx_attributes method:

Deal.search('Touch').collect { |deal| deal.sphinx_attributes['managed_slots'] }

--
Pat

On 30/10/2012, at 7:00 AM, Wency wrote:

> Hi, I am new to Thinking Sphinx/Sphinx. I have my indexes defined as in deal.rb
>
> define_index 'merchant_deals' do
> indexes user.company(:name), :as => :company_name
> has "COUNT(slots.id)", :as => :slots_count, :type => :integer
> has "COUNT(slots.manage)", :as => :managed_slots, :type => :integer
> join slots
> end
>
> Is there any way to access :has_managed_slots for each Deal?
> I have tried using Deal.search('Touch', :select=>"deals.*, COUNT(slots.manage) as managed_slots", :joins => [:slots]). Problem with this approach is that, it also returns nil.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/QviW_2VGfzYJ.
> To post to this group, send email to thinkin...@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.


Reply all
Reply to author
Forward
0 new messages