[Zope] Catalog without a Z

Andre Meyer andre.meyer at decis.nl
Sat Mar 6 13:01:52 EST 2004


Thanks for your help. With your help I have added a ZCatalog to my 
product and some indexes to it. Next question is how to add new items to 
the indexes as they are created and edited. CatalogAware alone does not 
seem to be sufficient.

Here is what I have so far:

------------------------------------------------------------------------

from Products.ZCatalog import ZCatalog
...
class MusicLibrary(Folder):
    "A Zope Folder for the objects of the Music Library"
   
    meta_type = "Music Library"
   
    def __init__(self, id, title, description = ""):
        ...      
        self._catalog = ZCatalog.*ZCatalog*('Catalog')
        self._catalog.*addIndex*('path_index', 'PathIndex')
        self._catalog.*addIndex*('text_index', 'TextIndex')
        self._catalog.*addIndex*('field_index', 'FieldIndex')
        self._*setObject*('Catalog', self._catalog)
    ...
    def addItem(self, id, item):
        self._*setObject*(id, item)
        self.category = None
       
        self._catalog.*catalog_object*(item) # does not work yet !!!

------------------------------------------------------------------------

from Products.ZCatalog.CatalogPathAwareness import CatalogAware
...
class Composer(SimpleItem, *CatalogAware*):
    ...

------------------------------------------------------------------------

Any ideas or examples? Your help is appreciated.

thanks
Andre



Dieter Maurer wrote:

>Andre Meyer wrote at 2004-3-4 15:03 +0100:
>  
>
>>The Zope Book explains the use of ZCatalog for indexing and searching 
>>(http://zope.org/Documentation/Books/ZopeBook/2_6Edition/SearchingZCatalog.stx).
>>
>>However, I want to use Catalog (and not ZCatalog) in my 
>>file-system-based product. I use a Folder object to which I add custom 
>>objects using self._setObject(id, item).
>>    
>>
>
>"ZCatalog" is essentially a configuration device for the "Catalog".
>Searching, indexing, adding columns and indexes essentially
>work for "Catalog" as they do for "ZCatalog".
>
>You are using "Catalog" in an "unsupported" way.
>Therefore, you must expect to look at its (and that of ZCatalog)
>code from time to time to find out some relevant details.
>
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20040306/91c64310/attachment.html


More information about the Zope mailing list