Hi Pat,

Thanks for your reply. The issue is solved.

I have done this using following way.

User.search().group_by(&:created_month_year)

On Wed, Sep 16, 2015 at 12:27 AM, Pat Allan <[email protected]>
wrote:

> You probably already understand this, but just to be clear: Sphinx’s
> grouping functionality means that you’ll only get one result for each group
> value (the ‘best’ match for each group value is what is returned). Thus,
> you’ll get one user per created_month_year value. Is that what you’re
> expecting?
>
> And what is getting returned if this is not the case?
>
> —
> Pat
>
>
> On 14 Sep 2015, at 11:44 pm, Chaitali Khangar <[email protected]>
> wrote:
>
> Thanks for your reply.
>
> Yes the error is remove. But I am not getting grouping result.
>
> On Tue, Sep 15, 2015 at 11:39 AM, Pat Allan <[email protected]>
> wrote:
>
>> Hi Chaitali
>>
>> `group_by` in an index definition is only for SQL-backed indices (:with
>> => :active_record), as it’s for the generated SQL query (whereas real-time
>> indices operate on ActiveRecord instances rather than SQL queries). So,
>> you’ll want to remove that from your index definition, and then run a
>> `rebuild` and see if that helps?
>>
>> Kind regards,
>>
>> —
>> Pat
>>
>>
>> On 11 Sep 2015, at 5:21 am, Chaitali Khangar <[email protected]>
>> wrote:
>>
>> Hi,
>>
>> I have tried group_by in real time but it's giving error. Can you please
>> help me?
>>
>> *User Index*
>>
>> has created_month_year,:type=>:integer
>>
>> As mention in some search result I have tried group_by in user index:
>>
>> *User Index with group by*
>>
>> has created_month_year,:type=>:integer
>> group_by created_month_year
>>
>> *Thinking Sphinx Query*
>>
>> Tried below queries
>>
>>    1. User.search(:group_by=>"created_month_year")
>>    2. User.search(:group_by=>:created_month_year)
>>
>>
>> *Actual Output*
>>
>> *Error: index user_core: parse error: unknown identifier 'groupby'*
>>
>> *Expected Output*
>> Its not grouping the result according to created_month_year
>>
>>
>>
>> --
>> 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.
>>
>
>
> --
> 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.
>

-- 
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.

Reply via email to