Hi Pat,

Thanks for the reply, and the great work on TS.

> I'm not sure that approach is going to work - what happens if some  
> comments are moderated and some aren't? Records will be returned in  
> both situations.

If _any_ comments for a picture are unmoderated, I want the picture to
be excluded from the search results.

This seems to be what happens when I do searches from the console,
i.e. I search for a picture that has all comments moderated and find
it, I mark one of the comments unmoderated, regenerate the index and
then that same search no longer finds that picture.

>From what I gather, the "Picture.search(params[:q], :without =>
{:comments_moderated => false}} " only finds pictures that do not have
_any_ comments_moderated set to false.  I had first tried
"Picture.search(params[:q], :with => {:comments_moderated => true}}",
but that didn't do what I wanted, but I think it does what you think I
wanted :)

> You will also want delta indexing to be fired when a comment is saved  
> - and yes, that means forcing the picture's updated_at to be updated.  
> This was a lot easier pre-2.1 (object.save), but now with the dirty  
> object stuff (object.changed?, etc) I'm not sure how to force a save  
> if the object itself hasn't changed.

Ok, thats what I thought :/

I was hoping there would be an undocumented way to do this - I could
always hand edit the generated sql, but would prefer not to do so.

I'd think this would be a problem that needs to be solved
generically.  That is, anytime you pull in a child association, your
delta indexing won't work as expected - updates to the child would
never be pulled into the delta index since the parent's updated_at
would not have changed, and most people would not remember (or want)
to update parent on child save.

How hard would it be to introspect the index/associations to add the
joins and make the updated_at check be something like
'parent.updated_at > time OR child.updated_at > time'.  Don't you
think this should be the default behavior, or am I missing something?

Matt

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