[Zope3-Users] How to make catalog working?

Florian Lindner mailinglists at xgm.de
Tue May 16 13:09:34 EDT 2006


Am Dienstag, 16. Mai 2006 13:23 schrieb Jim Washington:
> 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.

The problem is not that objects have been created before the IntIDs utility.

The IntID utility says that 3 objects are registered, but the catalog indexes 
are still zero count.

Thanks,

Florian


More information about the Zope3-users mailing list