``lineage.index`` is an addon to `collective.lineage`_ that lets you
search for content within a certain childsite.
How does it work?
``lineage.index`` registers an index ``childsite`` on all items
implementing ``Products.CMFCore.interfaces.IContentish`` (which will be
all Archetypes and Dexterity based content types).
The childsite's id can be used to search for content located in this
When listing items on the main portal, you can use the metadata-column
``childsite`` to indicate which childsites the content has been
How do I use it?
Once installed, new content gets indexed under the id of its closest
childsite. Existing content requires a catalog update (see
You can search for content within a childsite using the index::
brains = portal_catalog(childsite='subsite1')
Each brain has a metadata column telling which childsite it's located
If the item comes from the main portal (i.e. not inside a childsite),
``None`` will be indexed. This allows you to find only content from the
>>> brains = portal_catalog(childsite=None)
>>> brains.childsite is None
There's also a vocabulary ``lineage.childsites`` listing the available
childsites with their title.
To show the title of the subsite of a brain you can use the utility
<ul tal:define="util context/@@childsite">
<li tal:repeat="item folderContents">
<span tal:replace="item/Title">Item 1</span> in
<span tal:replace="python: util.titleForKey(item.childsite)>Subportal One</span><br> </li><br> </ul><br><br>Installation<br>============<br><br>Simply add ``lineage.index`` to your buildout eggs (no zcml slug is<br>needed thanks to z3c.autoinclude).<br><br>Quickinstall ``Lineage Index``.<br><br>In case you already have childsites and content that shall be indexed<br>go to ``portal_catalog/manage_catalogAdvanced`` and click the<br>``Update Catalog`` button to populate the index and the catalog<br>metadata.<br><br>Gotchas<br>=======<br><br>The vocabulary caches all childsite titles until zope is restarted.<br>If you add childsites you need to restart zope to make them show up<br>in the vocabulary.<br><br>.. _`collective.lineage`: http://plone.org/products/collective-lineage/<br><br>/nChangelog<br>=========<br><br>0.5 (2015-06-25)<br>----------------<br><br>- Depend on ``plone.api`` and use it to get the portal object.<br> [thet]<br><br>- Add ``chilsiteForContext`` method, which returns the childsite UUID for a<br> given context.<br> [thet]<br><br>- Upgrade to ``UUID`` basd indexing instead of using the ``id``. The id is not<br> unique and causes problems when multiple lineage subsites with the same id<br> are registered. Furthermore, the uuid can be used to retrieve the lineage<br> childsite object without traversing up the content tree. A upgrade step is<br> included.<br> [thet]<br><br><br>0.4 (2012-01-10)<br>----------------<br><br>- PEP8 fixes<br> [claytron]<br><br>- Use ``IContentish`` instead of ``IATContentType`` to ensure that all<br> CMF, AT and Dexterity based content gets indexed properly.<br> [claytron]<br><br>0.3 (2012-01-08)<br>----------------<br><br>- Make non child site content be indexed as ``None`` so that " main="" site"<br=""> content can be found via this index also.
- Make compatible with Plone 4.1
- Add ``catalog.xml`` and remove ``setuphandlers`` logic.
- Add ``collective.lineage`` to ``metadata.xml`` dependencies.
- PEP8 fixes
- Change extensions of reStructuredText files so they preview correctly.
- Moved code to GitHub
- Since Lineage's ChildSite is not implementing IPloneSiteRoot anymore,
changed the indexing reference to implementing INavigationRoot
- For other versions of ATContentType, we need to try and import the interface(s)
with and without the 's'
- Initial release
TODO: Brief introduction on what you do with files - including link to relevant help section.