Re: [Zope-dev] Adding ZCatalog capability for a (Python) product, and using it.

2000-10-23 Thread Ender

"Morten W. Petersen" wrote:
> 
> Is there any documentation that explains this?  Or, maybe some
> *understandable* and *well-written* product?


i found using a zcatalog with composition fairly straight forward. i
like to recommend a product that i wrote:), but sadly the code on a
whole is a mess, which i'm looking forward to rewriting someday, ahh
patterns.

anyways some relevant code snip


def setup_catalog(self):
''' setups catalog for searching news channels '''

id = 'news_catalog'
catalog = Products.ZCatalog.ZCatalog.ZCatalog(id)
self._setObject(id, catalog)

# setup indexes and such
self.news_catalog.manage_addColumn('description')
self.news_catalog.manage_addColumn('Date')

self.news_catalog.manage_addIndex('Date', 'FieldIndex')
self.news_catalog.manage_addIndex('SearchableText', 'TextIndex')

# get rid of defaults
self.news_catalog.manage_delColumns(['bobobase_modification_time',
'summary'])
self.news_catalog.manage_delIndexes(['bobobase_modification_time',
'PrincipiaSearchSource'])

return 1


i'd recommend composition, although maybe with a custom wrapper to
facilitate searches. i tend to feel that the zcatalog stuff should be
handled transparently by the storage not the object.

reading the source is probably the best way to examine the interface
(catalog and zcatalog) 


kapil

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )




[Zope-dev] Adding ZCatalog capability for a (Python) product, and using it.

2000-10-23 Thread Morten W. Petersen

Is there any documentation that explains this?  Or, maybe some
*understandable* and *well-written* product?

Thanks.

-Morten

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )