Frank Burkhardt wrote:
> On Mon, May 15, 2006 at 11:16:09PM +0200, Florian Lindner wrote:
>> 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:
intids = zapi.getUtility(IIntIds,[name])
catalog = zapi.getUtility(ICatalog,[name])
for item in some_function_that_returns_the_items():
The most important part is the intids.register(item) statement.
Zope3-users mailing list