[Zope-CMF] proposal for cmf:indexable directive
whit
whit at burningman.com
Mon Sep 12 17:26:00 EDT 2005
here is a sketch of how a working "indexable" configuration would look.
Names subject to improvement.
------------
<configure xmlns="http://namespaces.zope.org/cmf"
xmlns="http://namespaces.zope.org/zope">
<adapter
name="SearchableText"
for="IContent"
provides="IIndexable"
factory="SearchableTextExtractor"
/>
<adapter
name="folder_order"
for="IContent"
provides="ICatalogMetadata"
factory="folderOrderCalculator"
/>
<cmf:indexable
for="IContent"
attributes='SearchableText
path
folder_order'
metadata='folder_order' />
<!-- or this for interface lovers --/>
<cmf:indexable
for="IContent"
attributes='IContentIndexableAttrs'
metadata='IContentMetadataAttrs' />
</configure>
-------------
Our primary goal was is to be able to catalog non-direct
attributes as both indexes and metadata. This straight forward to
accomplish.
Eventually, I think it makes sense, as content gets happily dumber, that
all indexing should work this way.
For backward compatibility, a default adapter could return direct attrs
from an object for indexing.
<adapter
provides="IDefaultIndexable, IDefaultMetadata"
for="*"
factory="directAttrAccess"
/>
<cmf:indexable
for="*"
attributes='*'
metadata='*' />
Ultimately, if you didn't need back compatibility, you could override
like this:
<cmf:indexable
for="*"
attributes='None'
metadata='None' />
then developers could determine class by class and interface by
interface (and perhaps even by event) what was called when an object is
indexed, thus lowering the overhead of cataloging.
Some other niceties come to mind when thinking about this that may not
be inially easily attainable; the main two are installation of indexes
via configuration and the validation of index existence by the
cmf:indexable handler.
I look forward to y'alls comments.
-w
More information about the Zope-CMF
mailing list