What's In A Catalog? A Quick Introduction
Role of Catalogs Native ZODB can only find by path Catalogs provide all other lookups Catalogs are lazy!
Catalogs Interface: Zope/lib/python/ZCatalog/interfaces.py Methods: searchResults(REQUEST=None, **kw) e.g.: searchResults(Topic=topic,Title=title) catalog_object(obj, uid …) uncatalog_object(uid) uniqueValuesFor(name)
Cataloging An Object All object attributes matching an index name are indexed All object attributes matching a metadata name are stored with index record (brain) Callable attributes are called to get data E.G., SearchableText
Querying A Catalog Simple: searchResults(indexName=value) Pseudo Indices: sort_on sort_order ("reverse") sort_limit
Index Types ZCTextIndex Full-Text, And, Or, Not, Quote operations Field Keyword Path / ExtendedPath DateIndex / DateRangeIndex TextIndexNG
Complex Queries Record Queries searchResults( categories={ 'query':['big','shiny'], 'operator':'and' }) Different for every Index Type
Catalog Brains Brain Methods: getObject() getURL() getPath() Brain Attributes: The metadata! But … not the index items! Brain Source: Zope/lib/python/ZCatalog/CatalogBrains.py
Archetypes Catalog Support Automatic Reindexing Searchable field attribute Adds field value to SearchableText Index field attribute Adds a portal_catalog index and (optionally) metadata