[Zope-dev] ZCatalog hackery
Casey Duncan
cduncan@kaivo.com
Thu, 01 Mar 2001 08:32:17 -0700
"Morten W. Petersen" wrote:
>
> Hi guys,
>
> I've got a problem with ZCatalog. I've got plenty of large
> objects, ranging from 100KB to 100MB in size. Needless to
> say, these take up a lot of processor time when indexed by
> the ZCatalog.
>
> Now, these object have to be moved from time to time, only
> moved, so that one or two of the related columns and indexes
> are affected (the path and the parent container id); is
> there a way to go around this so that those two, the
> one column and the index are updated, and not, let's say
> the indexed body (which is 100KB - 100MB in size) ?
>
> Thanks,
>
> Morten
>
There is no built-in way. however I see no reason that the Catalog could
not be extended to do this with a bit of python coding.
A catalog contains a collection called indexes that contains the indexes
themselves (what else?). An External method could be written like so
(not tested):
def partialReindexObject(catalog, indexes, uid, object):
rid = catalog.uids.get[uid]
for idx_key in indexes:
idx = catalog.indexes[idx_key].__of__(catalog)
idx.unindex_object(rid)
idx.index_object(rid, object, None)
I think that will do it. Pass the names of the indexes as a sequence in
indexes, and data_record_id_ as the uid.
The above does not update any meta-data in the catalog.
--
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>