[Zope-CMF] Topic ANDing
Tres Seaver
tseaver@zope.com
Tue, 09 Oct 2001 07:19:52 -0400
Loren Stafford wrote:
> I tried to do this on my Zope 2.3.2 installaion, but things still got ORed.
>
> I see support for texindex_operator, but not for a field index operator.
>
> Does that mean there is no way to AND Subject criteria on Zope 2.3.x?
>
>>What you require is not a "drop-in index"; standard keyword indexes
>>(of which the Subject index is one) have this feature, but the
>>CMFTopic.ListCriterion does not expose it. We would need to add
>>a property to ListCriterion to track the "operator" desired, and
>>then modify its 'getCriteriaItems' method to add that value, using
>>field + "_operator" as its key.
I just looked at my Zope 2.3 checkout -- you are correct, the KeywordIndex
there does not know from 'operator'.
You could perhaps implement a "hammer-in" index (unlike pluggable indices,
it requires some violence to get it installed) which did what you want
in Zope 2.3. This would either require a "monkey patch" to
$ZOPE_HOME/lib/python/Products/ZCatalog/Catalog.py, as its 'addIndex'
hardwires the list of possible indeex types, or else reaching into the
catalog's 'indexes' dict and installing your notional AndingKeywordIndex
directly. The AndingKeywordIndex would override '_apply_index', replacing
the use of 'union' with 'intersection'.
Tres.
--
===============================================================
Tres Seaver tseaver@zope.com
Zope Corporation "Zope Dealers" http://www.zope.com