I've created a dexterity content type and have added some indexes for it.
class IMyContentType(form.Schema):
field ...
anotherfield ...
@indexer(IMyContentType)
def fieldIndexer(obj):
return obj.field
grok.global_adapter(fieldIndexer, "field")
@indexer(IMyContentType)
def anotherfieldIndexer(obj):
return obj.anotherfield
grok.global_adapter(anotherfieldIndexer, "anotherfield")
I've registered the catalog indexes using genericsetup catalog.xml:
<index name="field" meta_type="KeywordIndex">
<index_attr value="field" />
</index>
<column value="field" />
<index name="anotherfield" meta_type="KeywordIndex">
<index_attr value="anotherfield" />
</index>
<column value="anotherfield" />
Everything works like a charm this far, but I've also added a behavior to
the content type which I also want to register fields for. I followed
optiludes plone.behavior tutorial
and came up with something very similar to his localrole behavior. This time
I've tried using a multiadapter to index the fields:
class MyIndexer(grok.MultiAdapter):
grok.implements(IIndexer)
grok.adapts(IMyMarkerInterface, IZCatalog)
grok.name("thethirdfield")
def __init__(self, context, catalog):
self.context = context
self.catalog = catalog
self.data = IMyBehaviorInterface(context)
def __call__(self):
return self.data.thethirdfield or ()
The catalog.xml settings for the third field is exactly the same as field
and anotherfield, but this time data is not registered in the indexes,
allthough it's registered correctly in the
metadata fields. What should I do to correctly index thethirdfield?
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers