Skip to main content

Introduction

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 Dexterity based content types).

The childsite’s UID can be used to search for content located in this childsite.

When listing items on the main portal, you can use the metadata-column childsite to indicate which childsites the content has been aggregated from.

How do I use it?

Once installed, new content gets indexed under the UID of its closest childsite. Existing content requires a catalog update (see Installation).

You can search for content within a childsite using the index:

brains = portal_catalog(childsite='9df827df17a94ad0aeda278e9570dc88')

Each brain has a metadata column telling which childsite it’s located in:

>>> brains[0].childsite
'9df827df17a94ad0aeda278e9570dc88'

If the item comes from the main portal (i.e. not inside a childsite),

  • in Plone 5 None will be indexed.

  • in Plone 6 the UID of the portal will be indexed.

This allows you to find only content from the main portal no belonging to any child site:

>>> brains = portal_catalog(childsite=None)  # Plone 5.x

>>> from plone.api import portal
>>> brains = portal_catalog(childsite=portal.get().UID())  # Plone 6+

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 view:

<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>
    </li>
</ul>

Installation

Install lineage.index with buildout or pip. Ensure to have the ZCML included.

In Plone install Lineage Index in Site Setup, Extensions.

In case you already have childsites and content that shall be indexed go to ZMI, portal_catalog, Advanced. Then click the Update Catalog button to populate the index and the catalog metadata (this may take a while).

Gotchas

The vocabulary caches all childsite titles until Zope is restarted. If you add childsites you need to restart Zope to make them show up in the vocabulary.

Changelog

1.0.1 (2022-03-11)

  • Fix README [jensens]

1.0 (2022-03-11)

  • Add portal to vocabulary in Plone 6. [jensens]

  • Fix recursion bug, if a context has no acquisition parent. [zworkb]

  • Minimal modernisation: black, isort, pyupgrade, more metadata, readme edited. [jensens]

  • Add uninstall profile. [thet]

0.5 (2015-06-25)

  • Depend on plone.api and use it to get the portal object. [thet]

  • Add chilsiteForContext method, which returns the childsite UUID for a given context. [thet]

  • Upgrade to UUID basd indexing instead of using the id. The id is not unique and causes problems when multiple lineage subsites with the same id are registered. Furthermore, the uuid can be used to retrieve the lineage childsite object without traversing up the content tree. A upgrade step is included. [thet]

0.4 (2012-01-10)

  • PEP8 fixes [claytron]

  • Use IContentish instead of IATContentType to ensure that all CMF, AT and Dexterity based content gets indexed properly. [claytron]

0.3 (2012-01-08)

  • Make non child site content be indexed as None so that “main site” content can be found via this index also. [claytron]

  • Make compatible with Plone 4.1 [jensens]

  • Add catalog.xml and remove setuphandlers logic. [jensens]

  • Add collective.lineage to metadata.xml dependencies. [jensens]

  • PEP8 fixes [jensens]

  • Change extensions of reStructuredText files so they preview correctly. [jensens]

  • Moved code to GitHub [jensens]

0.2 (2011-04-28)

  • Since Lineage’s ChildSite is not implementing IPloneSiteRoot anymore, changed the indexing reference to implementing INavigationRoot [tbesluau]

  • For other versions of ATContentType, we need to try and import the interface(s) with and without the ‘s’ [tbesluau]

0.1b1 (2010-03-16)

  • Initial release

Release files for lineage.index 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lineage.index 1.0.1
File Size Uploaded
lineage.index-1.0.1.tar.gz 16.5 kB Details

Release files / lineage.index-1.0.1.tar.gz

Download URL lineage.index-1.0.1.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e40e9ac7294114203bf26c821f3cf0a892b68bfb1b09d08ab75b9540bccba58b
BLAKE2b-256 checksum
How to use checksums
3d5c5bf351681069ff20d6221d23d4828b5d4c9df58364ee5c88e74d8032e43f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.9

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

1.0

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page