Thank you  :-)

On Jan 4, 1:07 am, "Pat Allan" <[email protected]> wrote:
> Sphinx has no concept of the number of values (no COUNT() function), so 
> you'll need to create an attribute for that purpose:
>
>   has "COUNT(DISTINCT courses.id) > 0", :as => :has_courses, :type => :boolean
>   join courses # if you're not referring to the association elsewhere
>
> And then your search would be:
>
>   Project.search :with => {:paid => true, :has_courses => true}
>
> Cheers
>
> --
> Pat
>
> On 04/01/2012, at 5:52 AM,rtacconiwrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I have a project model which has a filter:
>
> > has paid, :type => :boolean
>
> > If paid checkbox is flagged, sphinx searches for paying projects. the
> > problem is that some projects have not any course:
>
> > project.courses.count # returns 0
>
> > I there a way to search for paying projects having at least one
> > course?
>
> > paid => true and projects.courses.count > 0
>
> > at the moment I have paid sent in the conditions
>
> > A solution could be to add a field set to true if its courses are more
> > than zero, but it is a redundant information
>
> > --
> > 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 
> > athttp://groups.google.com/group/thinking-sphinx?hl=en.

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

Reply via email to