(カタログ)

はじめに

Catalogs are object managing Plone search data - they store indexed data and act as an start point for search query.

  • ZCatalog source code.
  • Catalog indexes and metadata columns be be registerd in GenericSetup XML profiles/default/catalogtool.xml

portal_catalog

The default Plone catalog, where all content is indexed, is called portal_catalog.

It is in the portal root.

The best way to learn what’s inside portal_catalog, is to click its various s in Zope Management Interface.

Other catalogs

Besides, portal_catalogs, the site contains other catalogs.

  • uid_catalog maintains object look up by Unique Identified (UID). UID is given to the object when it is created and it does not change even if the object is moved around the site.
  • reference_catalog maintains inter-object references by object unique identified (UID). Archetypes’s ReferenceField uses this catalog. The catalog contains indexes UID, relationship, sourceUID, targetId and targetUID.
  • Add-on products may install their own catalogs which are optimized for specific purposes. For example, betahaus.emaillogin creates email_catalog is which is used to speed-up login by email process.

Manually indexing object to a catalog

The default content objectreindexObject() is defined in CMFCatalogAware and will update the object data to portal_catalog.

If your code uses additional catalogs, you need to manually update cataloged values after the object has been modified.

Example:

# Update email_catalog which mantains loggable email addresses
email_catalog = self.portal.email_catalog
email_catalog.reindexObject(myuserobject)

Rebuilding a catalog

Catalog rebuild means walking through all the objects on Plone site and adding them to the catalog. Rebuilding the catalog is very slow as the whole database must be read through. Reasons for you to do this in code could be

  • Creating catalog after setting up objects in the unit tests
  • Rebuilding after massive content migration

How to trigger rebuild:

portal_catalog = self.portal.portal_catalog
portal_catalog.clearFindAndRebuild()

archetype_tool catalog map

archetype_tool maintains map between content types and catalogs which are interested int them. When object is modified through Archetypes mechanisms, Archetypes post change notification to all catalogs enlisted.

See Catalogs tab on archetype_tool in Zope Management Interface.

目次

前のトピックへ

(検索とインデックス作成)

次のトピックへ

(検索インデックスとメタデータ)

このページ