programmatically adding an index.
hi, in my Product I trying to programmatically create an index. like so: myCatalog.addIndex('id', 'FieldIndex'), this works fine, but when I try to specify the indexed-attribute like so: myCatalog.addIndex('name_sort','FieldIndex', extra={'indexed_attrs': 'name'}) the new index does not include the indexed_attrs. This is because the __init__ of Products/PluginIndexes/common/UnIndex.py expects for extra an instance of the HTTPRequest.py record-class. and does not support the mapping interface for extra. Is this a bug or feature ? -- Mit freundlichen Grüßen Joachim Schmitz ...................................................................... AixtraWare eK ..Joachim Schmitz ..www.aixtraware.de ..t: +49-2464-8851 Hüsgenstr. 33a .....d-52457 Aldenhoven .............f: +49-2464-905163
Joachim Schmitz wrote:
the new index does not include the indexed_attrs. This is because the __init__ of Products/PluginIndexes/common/UnIndex.py expects for extra an instance of the HTTPRequest.py record-class. and does not support the mapping interface for extra. Is this a bug or feature ?
Sounds like a bug to me, I'd chuck it in the collector... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
--On Dienstag, 1. Februar 2005 11:38 Uhr +0100 Joachim Schmitz <js@aixtraware.de> wrote:
hi,
in my Product I trying to programmatically create an index. like so:
myCatalog.addIndex('id', 'FieldIndex'), this works fine, but when I try to specify the indexed-attribute like so:
myCatalog.addIndex('name_sort','FieldIndex', extra={'indexed_attrs': 'name'})
the new index does not include the indexed_attrs. This is because the __init__ of Products/PluginIndexes/common/UnIndex.py expects for extra an instance of the HTTPRequest.py record-class. and does not support the mapping interface for extra. Is this a bug or feature ?
Not a bug. As the doc say it expects a record object but not a mapping although a mapping would be more elegant if you want to create indexes through Python and not TTW. Please file a collector issue for this feature request. There is already some code in TXNG that handles both record-style and mapping-like arguments. -aj
Andreas Jung schrieb:
--On Dienstag, 1. Februar 2005 11:38 Uhr +0100 Joachim Schmitz <js@aixtraware.de> wrote:
hi,
in my Product I trying to programmatically create an index. like so:
myCatalog.addIndex('id', 'FieldIndex'), this works fine, but when I try to specify the indexed-attribute like so:
myCatalog.addIndex('name_sort','FieldIndex', extra={'indexed_attrs': 'name'})
the new index does not include the indexed_attrs. This is because the __init__ of Products/PluginIndexes/common/UnIndex.py expects for extra an instance of the HTTPRequest.py record-class. and does not support the mapping interface for extra. Is this a bug or feature ?
Not a bug. As the doc say it expects a record object but not a mapping although a mapping would be more elegant if you want to create indexes through Python and not TTW. Please file a collector issue for this feature request. There is already some code in TXNG that handles both record-style and mapping-like arguments.
-aj
submitted as issue 1688 -- Mit freundlichen Grüßen Joachim Schmitz ...................................................................... AixtraWare eK ..Joachim Schmitz ..www.aixtraware.de ..t: +49-2464-8851 Hüsgenstr. 33a .....d-52457 Aldenhoven .............f: +49-2464-905163
Joachim Schmitz wrote:
hi,
in my Product I trying to programmatically create an index. like so:
myCatalog.addIndex('id', 'FieldIndex'), this works fine, but when I try to specify the indexed-attribute like so:
myCatalog.addIndex('name_sort','FieldIndex', extra={'indexed_attrs': 'name'})
the new index does not include the indexed_attrs. This is because the __init__ of Products/PluginIndexes/common/UnIndex.py expects for extra an instance of the HTTPRequest.py record-class. and does not support the mapping interface for extra. Is this a bug or feature ?
see http://plone.org/documentation/howto/extend-portal-catalog-on-install -- David Convent
participants (4)
-
Andreas Jung -
Chris Withers -
David Convent -
Joachim Schmitz