Ah, I forgot that I'd fixed a bug in that area - good to know it's now working :)
-- Pat On 24/02/2010, at 9:38 AM, Colin wrote: > I updated to the latest version of the gem (1.3.15 -> 1.3.16) and > everything seems to be working fine now :) > > Thanks for your help, > > Regards, > > Colin > > On Feb 23, 3:01 pm, Colin <[email protected]> wrote: >> Your assumptions are correct; a user belongs to one organisation and >> an organisation has many users and many calendars. Each calendar >> belongs to only one organisation. >> >> Have rebooted and reindexed and the behaviour remains the same. >> >> Additionally, I changed my index method to: >> >> @calendars = current_user.organisation.calendars.activeTS >> >> And it now lists every non-deleted calendar in the system. So the >> sphinx_scope seems to be ignoring everything that it's chained onto. >> >> No errors that I can see. >> >> On Feb 23, 4:56 am, Pat Allan <[email protected]> wrote: >> >> >> >>> It looks like a user belongs to a single organisation, right? And calendars >>> belong to organisations... >> >>> So, your search *should* work, because you have the attribute for >>> organisation_id: it should return calendars for a given organisation. Is it >>> not doing this? Are there any errors? >> >>> -- >>> Pat >> >>> On 23/02/2010, at 12:23 PM, Colin wrote: >> >>>> So near and yet so far :/ >> >>>> My Index method: >> >>>> @calendars = current_user.organisation.calendars.active >> >>>> It displays all of a users' organisations' calendars. >> >>>> My search method: >> >>>> @calendars = current_user.organisation.calendars.activeTS.search >>>> params[:query], :star => true >> >>>> So I only want the search to be done on that users' organisations' >>>> calendars. The way activeTS is built now, it indexes all calendars >>>> that have not been deleted. So I can display calendars that do not >>>> belong to that user if I search for them. >> >>>> Any idea how to tweak it to behave the way I want? >> >>>> On Feb 23, 1:09 am, Colin <[email protected]> wrote: >>>>> I tried to setup my code the way I had it before. When it was still >>>>> all null I realised that it obviously wasn't indexing despite what it >>>>> was saying. >>>>> One reboot later and it all seems to be working :) >> >>>>> Thanks for your time and patience guys. >> >>>>> Regards, >> >>>>> Colin >> >>>>> On Feb 22, 11:46 pm, Colin <[email protected]> wrote: >> >>>>>> Here you go:http://pastie.org/837827 >> >>>>>> On Feb 22, 11:41 pm, Aaron Brethorst <[email protected]> wrote: >> >>>>>>> Can you perform a ts:index and dump the output into a pastie? >> >>>>>>> On Feb 22, 2010, at 3:40 PM, Colin wrote: >> >>>>>>>> Should that would work as the only place is_active is defined is the >>>>>>>> line where Aaron suggested to try it? >> >>>>>>>> Either way, no it doesn't. Still empty. >> >>>>>>>> On Feb 22, 11:32 pm, Pat Allan <[email protected]> wrote: >>>>>>>>> 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 >>>>>>>>>> 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.
