[Zope3-Users] catalog indexing adapter interfaces

Alen Stanisic alen.stanisic at gmail.com
Sun Oct 30 08:29:39 EST 2005


> Alen Stanisic wrote:
> I noticed that if I adapted a persistent content type and created a
> catalog with index on one of the fields provided by the adapter
> interface, the indexing worked for all of my content that was there at
> time of catalog creation.  But any new content objects created after
> catalog creation would not get indexed though.
>

I just had a play with this again and still can't resolve the problem,
I could be doing something wrong so I will try and provide more
detail:

This is my adapter I am trying to index:

<adapter
        for=".interfaces.IShoppingItem"
        provides=".interfaces.IItemInfo"
        factory=".iteminfo.ItemInfo"
        />

Here is the IItemInfo interface:

class IItemInfo(Interface):
       isPaid = Bool(title = _("Is Item Paid"))

In the implementation of IItemInfo isPaid is a property wrapped
method, it just checks annotation value and returns True/False.

I want to be able to only list paid IShoppingItem-s and I created a
catalog for that with a Field Index on IItemInfo interface and isPaid
field.

Here is an example of how I search the catalog:

search_filter['isPaid'] = [True]
content_catalog.searchResults(**search_filter)

The problem is every time I create a IShoppingItem type object and
mark it as paid, it is not being picked up by my catalog.  I have to
go to the catalog object  through the ZMI and hit 'Reindex' button and
after that all is well and the new object is indexed and returned by
my search.

Not sure what could be wrong here.

Thanks for any suggestions
Alen


More information about the Zope3-users mailing list