Hey Roger

Thanks for your tip, ill try that out when I get home and give an update if 
it works or not :-)

Regards

Den fredag den 20. juni 2014 11.25.37 UTC+2 skrev Roger Kind Kristiansen:
>
> I'm no expert and I'm not sure what is the problem with your current 
> setup, just pitching in here since I've done something similar. Translating 
> the solution I have to your setup, the way I've done it would look 
> something like this:
>
> has "COUNT(CASE courses.is_visible WHEN FALSE THEN 1 ELSE NULL END) > 0", 
> :as => :is_visible, :type => :boolean
>
> This attribute would be true only when all courses has is_visible set to 
> true.
>
>
>
>
> kl. 22:09:54 UTC+2 onsdag 18. juni 2014 skrev Daniel Gottschalck følgende:
>>
>> Hi again
>>
>>
>> Tried with the solution you mentioned before aswell, with the IF = SUM 
>> etc,
>>
>> same stuff, nothing happens, and the expected result is not there.
>>
>> The SQL query in the log looks as follow:
>>
>> Sphinx Query (0.8ms)  SELECT * FROM `refinery_wayfinders_project_core` 
>>> WHERE MATCH('felttest') AND `is_visible` = 1 AND `sphinx_deleted` = 0 LIMIT 
>>> 0, 20
>>
>>
>>
>> "AND `is_visible`" is incorrect? It doesn't look at 
>> "refinery_wayfinders_courses.is_visible", but sees it as an attribute of 
>> refinery_wayfinders_project........
>>
>> has "IF(SUM(refinery_wayfinders_courses.is_visible) = 
>>> COUNT(refinery_wayfinders_courses.is_visible), 1, 0)", as: :is_visible, 
>>> type: :boolean
>>
>>
>>
>>
>> Regards 
>>
>> Den tirsdag den 17. juni 2014 20.56.23 UTC+2 skrev Daniel Gottschalck:
>>>
>>> Hey
>>>
>>>
>>> In the website, there is "projects", and "projects" can have "courses".
>>>
>>>
>>> In my project index file, how would I filter on "courses" which 
>>> "is_visible" true?
>>>
>>> Im confused on whether to use "has" or "indexes" for a relation model 
>>> boolean value.
>>>
>>>  
>>>
>>> ThinkingSphinx::Index.define 'refinery/wayfinders/project', :with => 
>>> :active_record do
>>> indexes :name, sortable: true
>>> indexes :city
>>> indexes :description
>>> indexes courses.name, as: :course_name
>>>
>>> indexes courses.is_visible, as: :is_visible <------------------------ 
>>> This one?
>>>
>>> set_property :group_concat_max_len => 8192
>>> has zip, external_id
>>>
>>>  
>>>
>>> has courses.is_visible, as: :is_visible, type: :boolean 
>>> <------------------- Or this one?
>>> end
>>>
>>>
>>> And how would I then filter it in my search_controller? So I only get 
>>> courses which are visible?
>>>
>>> @project_search = Refinery::Wayfinders::Project.search(params[:search], 
>>>> :with => { :is_visible => true }) 
>>>
>>>
>>>
>>> OR
>>>
>>> @project_search = Refinery::Wayfinders::Project.search(params[:search], 
>>>> :include => :is_visible, :conditions => { :is_visible => true })
>>>
>>>
>>>
>>> Or a third solution?
>>>
>>>
>>> Thanks in advance
>>>
>>>
>>> Regards 
>>>
>>>>  
>>>
>>>

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