[MKDoc-dev] Handling Component Deletion
Sam Tregar
sam at tregar.com
Sun Oct 24 17:53:21 BST 2004
On Sun, 24 Oct 2004, Bruno Postle wrote:
> On Sat 23-Oct-2004 at 14:27 -0400, Sam Tregar wrote:
>
> > As it stands there's no code in place to delete the index data
> > when the component is deleted.
>
> > 1) Create a new method in flo::Component called on_delete() which is
> > called when a component is removed.
>
> Presumably the Document_TimeRange table is updated when the document
> is saved rather than when the component is modified.
Yes. Currently I'm doing the update in an overridden generate_xml()
method. This method is only called to produce the XML stored in
Document.Body so it makes a reasonably good on_save() stand-in.
> What about deleting/reinserting all timerange entries associated
> with the document each time the document is saved?
That's exactly what I'd like to do. It seems that the system isn't
setup to allow this to happen. At present the system forgets about a
component as soon as the user clicks delete. Then when the user
clicks save the objects that are present get saved to the DB. This
makes it hard to call methods on the missing objects since the data
needed to instantiate them is gone. I can think of a few ways to fix
this but they all involve fairly substantial changes to the way the
editor works.
> We could actually run it every minute with a parameter of 90
> seconds, but it then causes high server-loads when somebody does a
> mass import of ten thousand documents and you end up with multiple
> indexer instances running concurrently.
It would be possible to solve this using a lock-file to inhibit
concurrent runs.
> I think this sort of delay would be ok for event components too.
Ok. If I can't find a solution using a save-time callback I'll switch
to doing to the updates and deletes in the index process.
Thanks,
-sam
More information about the MKDoc-dev
mailing list