[ZODB-Dev] I would like append an indexer with uuid key at root of my ZODB, how can I append an function to commit event to update this uuid catalog ?

Stéphane Klein stephane at harobed.org
Tue Jun 28 05:21:14 EDT 2011


Le 28/06/2011 10:21, Thierry Florac a écrit :
>> I use ZODB to record some Resources.
>>
>> All my Resources have an "uuid" field.
>>
>> All work well but I would like append a BTree to ZODB root object to
>> "index" uuid of all my resources.
>>
>> I would like record to this BTree index only Resources commited to ZODB
>> database.
>>
>> How can I connect a function to "commit" event ?
>> In this function, how can I found all object modified ?
>> How can I found all object removed to the database ?
>>
>> Other question : are there already a package to perform this task ?
>
>
> The matching package is zope.catalog.
> It provides all you need (catalog and indexes) to handle your task.
> Objects creations and modifications are followed automatically by several
> subscribers as soon as this package is correctly registered.
> z3c.catalog and hurry.query packages can be good extensions packages to
> look at...

In repoze.catalog documentation, I read :

"""
Note that when you call index_doc, you pass in a docid as the first 
argument, and the object you want to index as the second argument. When 
we index the peach object above we index it with the docid 1. Each docid 
must be unique within a catalog; when you query a repoze.catalog 
catalog, you’ll get back a sequence of document ids that match the query 
you supplied, which you’ll presumably need to map back to the content 
object in order to make sense of the response; you’re responsible for 
keeping track of which objects map to which document id yourself.
"""
Url : http://docs.repoze.org/catalog/overview.html#indexing

"you’re responsible for keeping track of which objects map to which 
document id yourself." => it is this part I would like to implement.

Regards,
Stephane

-- 
Stéphane Klein <stephane at harobed.org>
blog: http://stephane-klein.info
Twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com



More information about the ZODB-Dev mailing list