No problem! Would love to help you think it through and would be happy to
offer help with a patch -- just want to make sure we're on the same page in
terms of the goals. I'm thinking it would be great if TS could be a little
more... automagical... by (1) handling realtime attribute updates for
associations, (2) handling realtime attribute updates for SQL-snippets, and
(3) association delta indexes automatically.

(1) and (2) could probably be addressed with the same syntax adjustments/DSL
additions. Behind the scenes, (1) would be a bit trickier... When an index
has `belongs_to` attributes and a parent object is updated, we should be
able to update the attributes of all the children efficiently: e.g. (in
http://gist.github.com/596934) if a group goes from `state = pending` to
`state = active`, it would be nice if all that group's memberships could be
efficiently changed to have the sphinx attributes `is_group_pending = false`
and `is_group_active = true` (and `is_group_archived = false`). Is there an
easy way to get/calculate all the sphinx_document_id for the group's
memberships at once so that only a single `config.client.update(...)` call
needs to be made? Should there be an association reflection method
sphinx_document_ids? Also, there other types of associations we would need
to handle... The has_one and has_many cases seem easier seeing as only one
sphinx document's attributes would require updating.

(3) For normal delta indexes, it seems like it wouldn't be that hard to
insert after_commit hooks into associations such that updating a group's
name would trigger `group.memberships.update(["delta"], [true])` and either
trigger the detla index right away or queue it for delayed-delta... For
datetime deltas, it could just be `group.memberships.update(["updated_at"],
[Time.now])`... Right now the docs seem to suggest you should loop over all
the children in ruby...

Also, do you prefer Github issues for discussing features?

Thanks,
Aaron

On Wed, Sep 29, 2010 at 8:52 AM, Pat Allan <[email protected]> wrote:

> Hi Aaron
>
> Sorry I've not gotten back to you more quickly on this - I know you've
> mentioned it in other emails and tweets.
>
> What you're proposing has been requested before (at least, the tracking of
> associated objects - this is a little more detailed). I'm not sure about the
> syntax, but I think we should be able to work something out. Let me ponder
> further, and I'll see if I can come up with something that clicks in my
> head.
>
> But all that said - thanks so much for taking the time to think through
> this and sketch out a proposed syntax. It really does help to get me
> thinking about how to change things.
>
> Cheers
>
> --
> Pat
>
> On 28/09/2010, at 2:11 AM, agibralter wrote:
>
> > What do people think of an addition to the DSL for handling automatic
> > updating of attributes defined by SQL-snippet:
> http://gist.github.com/596934
> > ?
> >
> > I was thinking that in case in the gist: if a group's :state
> > or :memberships_count are updated (specified by
> > `attributes :state, :memberships_count`), using group.membership_ids
> > ThinkingSphinx should mass update all documents in searchd with the
> > latest attribute value for :is_big_group as defined by the `value`
> > block.
> >
> > I know it seems really verbose, but I can't really think of a better
> > way of doing it without having to somehow interpret the SQL-snippet...
> >
> > I was also thinking that it might be nice to automagically handle
> > setting delta = 1 when associated models are changed...
> >
> > Any thoughts?
> >
> > Thanks,
> > Aaron
> >
> > --
> > 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]<thinking-sphinx%[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]<thinking-sphinx%[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