[Zope-Coders] Proposal for minor ZCatalog improvement
Andreas Jung
andreas@andreas-jung.com
Mon, 11 Nov 2002 16:15:39 +0100
--On Montag, 11. November 2002 09:56 -0500 Shane Hathaway <shane@zope.com>
wrote:
> Andreas Jung wrote:
>> All ZCatalog indexes are using the id of the indexes to index attributes
>> with the same name. ZCTextIndex introduced a new approach by seperating
>> the id of the index from the attribute name to be indexed. This is a nice
>> idea and allows to have different indexes on the same attribute name
>> (e.g. having a FieldIndex and a text index on a string attribute).
>>
>> I propose add this functionality to all Zope indexes. All interface for
>> pluggable indexes should get a new method getIndexedAttribute() that
>> returns the name of the attribute that will be indexed by this index.
>> The indexes tab of the ZCatalog should be modified to display the
>> indexes as:
>>
>> topic_txt (TextIndex on topic) ...
>> topic_field (FieldIndex on topic)
>>
>> For backwards compatiblity getIndexedAttribute() would return the
>> id of the index if the indexes has no dedicated attribute to keep
>> the name of the indexed attribute.
>
> This is a good thing to point out, but what about the possibility of
> allowing ZCTextIndexes to index multiple attributes? Currently we have
> "SearchableText()" methods all over that return "self.description + ' ' +
> self.title + ' ' + self.body". We could instead let the ZCTextIndex
> perform that work, making it more configurable.
But that is an index related thing and is not directly ZCatalog related
>
> This would make getIndexedAttribute() impossible to implement correctly.
> Maybe getIndexedAttributeNames()?
Would be fine too.
>The ZMI could choose how to format
> multiple attributes.
>
see above...the choice of multiple indexes is in the hands of the ZMI
of the corresponding index.
-aj
---------------------------------------------------------------------
- Andreas Jung http://www.andreas-jung.com -
- EMail: andreas at andreas-jung.com -
- "Life is too short to (re)write parsers" -
---------------------------------------------------------------------