Does a normal search using the attribute work?

  Calendar.search :with => {:is_active => true}

-- 
Pat

On 23/02/2010, at 10:24 AM, Colin wrote:

> pastie updated to show whole class: http://pastie.org/837509
> 
> define_index do
>    indexes id
>    indexes subject
>    indexes parties
> 
>    set_property :enable_star => 1
>    set_property :min_infix_len => 3
> 
>    has organisation_id
>    has "deleted_at IS NULL", :as => :is_active, :type => :boolean
>  end
> 
> Yep, just stopped, reindexed and restarted there again. Still empty.
> 
> On Feb 22, 11:21 pm, Pat Allan <[email protected]> wrote:
>> What Aaron's been saying has been spot on.
>> 
>> Colin: can you paste your define_index block here, as it currently stands? 
>> And also, have you restarted Sphinx and re-indexed? An empty array would 
>> suggest Sphinx doesn't know about the new attribute you've created.
>> 
>> --
>> Pat
>> 
>> On 23/02/2010, at 9:59 AM, Aaron Brethorst wrote:
>> 
>> 
>> 
>>> and your sphinx_scope was defined identically to this?
>> 
>>> sphinx_scope(:active_ts) {
>>>   { :with => {:is_active => true} }
>>> }
>> 
>>> that should work, but i'm no expert unfortunately.
>> 
>>> On Feb 22, 2010, at 2:55 PM, Colin wrote:
>> 
>>>> Just to add in the "has "deleted_at IS NULL", :as => :is_active, :type
>>>> => :boolean" line.
>> 
>>>> On Feb 22, 10:52 pm, Aaron Brethorst <[email protected]> wrote:
>>>>> did you modify the define_index block?
>> 
>>>>> On Feb 22, 2010, at 2:48 PM, Colin wrote:
>> 
>>>>>> I tried your suggestion and also tried replacing the { :conditions =>
>>>>>> ["deleted_at IS NULL"] } with {:conditions => {:deleted_at => nil}}
>>>>>> but in both cases it seems to be returning an empty array.
>> 
>>>>>> On Feb 22, 10:34 pm, Aaron Brethorst <[email protected]> wrote:
>>>>>>> Pat could certainly speak to this better than I, but I was under the 
>>>>>>> impression that conditions are only used in conjunction with fields 
>>>>>>> that have been marked with 'indexes'.
>> 
>>>>>>> I was actually doing something similar to what you're trying to 
>>>>>>> accomplish earlier today. Maybe you could do something like the 
>>>>>>> following:
>> 
>>>>>>> # note: untested code; written in my Mail app
>> 
>>>>>>> define_index do
>>>>>>>   # all of your existing stuff goes here
>>>>>>>   has "deleted_at IS NULL", :as => :is_active, :type => :boolean
>>>>>>> end
>> 
>>>>>>> sphinx_scope(:active_ts) {
>>>>>>>   { :with => {:is_active => true} }
>> 
>>>>>>> }
>> 
>>>>>>> On Feb 22, 2010, at 2:21 PM, Colin wrote:
>> 
>>>>>>>> Thank you for the link.
>>>>>>>> It fixed the original error but it is now throwing:
>> 
>>>>>>>> undefined method `keys' for ["deleted_at IS NULL"]
>> 
>>>>>>>> So would I be right in thinking that I can't use the ["deleted_at IS
>>>>>>>> NULL"] syntax to define a condition?
>> 
>>>>>>>> Regards,
>> 
>>>>>>>> Colin
>> 
>>>>>>>> On Feb 22, 8:50 pm, Aaron Brethorst <[email protected]> wrote:
>>>>>>>>> Try declaring your sphinx_scopes after define_index.
>> 
>>>>>>>>> http://brethorsting.com/blog/2010/02/solution-for-undefined-method-sp...
>> 
>>>>>>>>> On Feb 22, 2010, at 12:46 PM, Colin wrote:
>> 
>>>>>>>>>> Hi,
>> 
>>>>>>>>>> I'm getting the above error when I try to declare a sphinx_scope.
>>>>>>>>>> I've googled around but couldn't find a solution.
>>>>>>>>>> The model in question can be found here:http://pastie.org/837509
>> 
>>>>>>>>>> I've tried it in the syntax shown above and also a direct copy of the
>>>>>>>>>> named_scope syntax.
>> 
>>>>>>>>>> Any ideas?
>> 
>>>>>>>>>> Regards,
>> 
>>>>>>>>>> Colin
>> 
>>>>>>>>>> --
>>>>>>>>>> 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 
>>>>>>>> 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 
>>>>>> 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 
>>>> 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 
>>> 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.
> 

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