[Zope-dev] Adding ZCatalog index programatically

Chris McDonough chrism@digicool.com
Thu, 18 May 2000 17:53:58 -0400


How about:

yourcatalog._catalog.addIndex(id, 'FieldIndex')

replace FieldIndex with TextIndex or KeywordIndex as desired.


"R. David Murray" wrote:
> 
> I was just looking at the ZCatalog code to figure out how to programatically
> add an index to a Catalog.  I figured out how to do that fairly easily,
> but the code I was looking at has me a bit mystified.  The method
> manage_addIndex is defined.  The form that you use through the
> management interface to add an index has a submit button whose name
> is manage_addIndex:method.  OK, that all looks like reasonable
> magic (magic because I don't know exactly what happens when a button
> gets marshalled as a method).
> 
> Here's the part I don't understand: the form's action is set to the
> Catalog itself.  manage_addIndex expects the index name and type
> as its first two parameters.  Where does the magic come from that
> turns the form submission into a correct call to manage_addIndex?
> 
> Probably I'm missing something obvious, but I will appreciate any
> aid in increasing my Zope Zen level here <grin>.
> 
> --RDM
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )

-- 
Chris McDonough
Digital Creations
Publishers of Zope - http://www.zope.org