Skip to content

Commit

Permalink
Merge pull request #82 from RedTurtle/revert_uid_filter
Browse files Browse the repository at this point in the history
Re-apply context UID filter in querystringsearch service (as it is in…
  • Loading branch information
cekk committed Oct 25, 2023
2 parents 1a9a8d9 + d08a6f2 commit cd7febf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Changelog
Auth users can need to perform an higher query (in contents view for example).
[cekk]

- Re-apply context UID filter in querystringsearch service (as it is in plone.restapi).
[cekk]

5.2.4 (2023-09-26)
------------------

Expand Down
12 changes: 6 additions & 6 deletions src/redturtle/volto/restapi/services/querystringsearch/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from plone.app.event.base import get_events
from plone.app.querystring import queryparser
from plone.restapi.batching import HypermediaBatch
from plone.restapi.bbb import IPloneSiteRoot
from plone.restapi.deserializer import json_body
from plone.restapi.exceptions import DeserializationError
from plone.restapi.interfaces import ISerializeToJson
Expand All @@ -13,6 +14,7 @@
from plone.restapi.services.querystringsearch.get import (
QuerystringSearch as BaseQuerystringSearch,
)
from plone.restapi.services.querystringsearch.get import SUPPORT_NOT_UUID_QUERIES
from redturtle.volto.config import MAX_LIMIT
from urllib import parse
from zExceptions import BadRequest
Expand Down Expand Up @@ -71,14 +73,12 @@ def __call__(self):
limit=limit,
)

# PATCH: we disable this query to boost performances on big sites
# Exclude "self" content item from the results when ZCatalog supports NOT UUID
# queries and it is called on a content object.
# if not IPloneSiteRoot.providedBy(self.context) and SUPPORT_NOT_UUID_QUERIES:
# querybuilder_parameters.update(
# dict(custom_query={"UID": {"not": self.context.UID()}})
# )
# END OF PATCH
if not IPloneSiteRoot.providedBy(self.context) and SUPPORT_NOT_UUID_QUERIES:
querybuilder_parameters.update(
dict(custom_query={"UID": {"not": self.context.UID()}})
)

try:
results = querybuilder(**querybuilder_parameters)
Expand Down

0 comments on commit cd7febf

Please sign in to comment.