Frank Burkhardt wrote:
> Hi,
>
> On Mon, May 15, 2006 at 11:16:09PM +0200, Florian Lindner wrote:
>   
>> Hello,
>> I've added some content objects of interface IFoo to my site.
>> Then I added a catalog to my site (and also a IntID utility). I registered 
>> both. To the catalog I've added a FieldIndex and a TextIndex, set the 
>> interface to IFoo and the fieldname to a field that IFoo has. I registered 
>> both indexes.
>>     
>
> The IntID utility has to be registered *before* all the objects you
> want to find. No object created before you had a registered IntID
> will ever be found.
>
> Have a look at
>
>  http://zope3.mpg.de/suchen ("Das Prinzip")
>
>   
You can get the IntIDs utility to register objects after they are created.

Something like the below will register and catalog a bunch of items:

def catalog_items(self):
        intids = zapi.getUtility(IIntIds,[name])
        catalog = zapi.getUtility(ICatalog,[name])
        for item in some_function_that_returns_the_items():
            catalog.index_doc(intids.register(item), item)

The most important part is the intids.register(item) statement.

-Jim Washington

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to