Hi Walter, I can’t think of a better way to do this off the top of my head - I’m presuming there’s no special scope provided by Ancestry that allows access to all records (as I understand it, that’s what you’re after?) that can be used by find_in_batches?
— Pat > On 17 Mar 2019, at 6:30 am, Walter Lee Davis <wa...@wdstudio.com> wrote: > > I've got a combination of TS (latest) and Ancestry in play, and I'm just now > trying to move from SQL indices to real_time. I was able to make a tortured > bit of Ruby to collect all the IDs and then return them in a single > association that TS could find_in_batches over, but I am wondering if there > is a way to do this that I will not have to stare at so long in a few months, > when I've forgotten why it works: > > scope { Document.where(id: Document.publicly.map{ |d| > [d.id].concat(d.descendant_ids) }.flatten) } > > publicly is a scope that gives me only the "roots" of the ancestry tree with > a combination of a particular set of slugs and the "published" flag, and then > I'm appending descendent_ids and making a new collection from the lot of them > with the outer "find". > > Any suggestions? > > Thanks in advance, > > Walter > > -- > 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 thinking-sphinx+unsubscr...@googlegroups.com. > To post to this group, send email to thinking-sphinx@googlegroups.com. > Visit this group at https://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 thinking-sphinx+unsubscr...@googlegroups.com. To post to this group, send email to thinking-sphinx@googlegroups.com. Visit this group at https://groups.google.com/group/thinking-sphinx. For more options, visit https://groups.google.com/d/optout.