Skip to content

Commit 40bc372

Browse files
committed
Apply vanilla collective.solr search view
Filter on portal root to avoid Unauthorized
1 parent 229759a commit 40bc372

File tree

3 files changed

+263
-252
lines changed

3 files changed

+263
-252
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Changelog
1919
- Add collective.solr and make the eea.facetednavigation view compatible with that [gyst]
2020
- Activate fulltext PDF solr search, provide upgrade, adjust tests [gyst]
2121
- Bugfix PublicationsViewlet for the Plone upgrade [gyst]
22+
- Aplly vanilla new collective.solr search [gyst]
2223

2324
1.0.6 (2025-05-22)
2425
------------------

src/recensio/plone/browser/listing.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
from collective.solr.browser.facets import SearchView
12
from eea.facetednavigation.browser.app.query import FacetedQueryHandler
23
from plone import api
34
from plone.app.contentlisting.interfaces import IContentListing
45
from plone.base.navigationroot import get_navigation_root
5-
from Products.CMFPlone.browser.search import Search
66
from Products.CMFPlone.utils import normalizeString
77
from Products.Five.browser import BrowserView
88
from recensio.plone import _
@@ -70,9 +70,20 @@ def criteria(self, **kwargs):
7070
return criteria
7171

7272

73-
class RecensioSearch(Search, ListingBase):
73+
class RecensioSearch(SearchView, ListingBase):
7474
"""Add recensio capabilities"""
7575

76+
def filter_query(self, query):
77+
"""Avoid throwing Unauthorized.
78+
79+
Solr indexes across sibling sites recensio, regio, altertum. We should
80+
return results only from the current site.
81+
"""
82+
query = super(RecensioSearch, self).filter_query(query)
83+
if "path" not in query and "parent_path" not in query:
84+
query["path_parents"] = "/".join(api.portal.get().getPhysicalPath())
85+
return query
86+
7687

7788
class ReviewSectionsListing(ListingBase):
7889
@property

0 commit comments

Comments
 (0)