Ticket #13274 (confirmed Feature Request)
Pluggable catalog query transformation chain
Reported by: | mborch | Owned by: | vincentfretin |
---|---|---|---|
Priority: | minor | Milestone: | 4.x |
Component: | Internationalization | Version: | 4.3 |
Keywords: | catalog | Cc: |
Description
In various add-ons that extend Plone with support for content in multiple languages, there's typically a monkey-patch which customizes the default search to return results only in the current language.
This can look like this:
def searchResults(self, REQUEST=None, **kw): if REQUEST is not None and kw.get('Language', '') != 'all': language_filter(REQUEST) else: language_filter(kw) return originalSearchResults(REQUEST, **kw)
The simple patch works surprisingly well for multilingual Plone sites.
Note that language_filter modified the provided mapping in-place. Also, in a standard Plone site, there is currently no index on the content language (neither 'language', nor 'Language').
If there's only one active language, then obviously the point is moot. But note that if no index exists, then there is no impact.
The suggestion in this PLIP is to wire this functionality into Plone's catalog. The implementation details are not ready, but it could be a spelled as a transformation chain with an adapter lookup on the HTTP request:
adapters = sorted(getAdapters((request, ), IQueryTransform)) for name, transform in adapters: transform.update(kw)
Plone could then provide a default adapter that implements the "query only current language" behavior.
Change History
comment:1 Changed 3 years ago by mborch
- Owner set to vincentfretin
- Component changed from Unknown to Internationalization
- Type changed from Bug to Feature Request