Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catalog query Language='all' returns no objects in some cases #16

Closed
thet opened this issue Apr 30, 2018 · 3 comments
Closed

catalog query Language='all' returns no objects in some cases #16

thet opened this issue Apr 30, 2018 · 3 comments
Assignees

Comments

@thet
Copy link
Member

thet commented Apr 30, 2018

I have a site with very basic and custom multilingual support, using an Language index. Querying for Language='all' returns no elements from the catalog.
Can the language query be avoided?

@mauritsvanrees
Copy link
Member

That check is there precisely because of multilingual sites: without it, only results from the current language would be returned, so the catalog would only partially get fixed. And in newer versions of ZCatalog you need at least one filter to search on, or you don't get any results.
But wait, we have unrestrictedSearchResults for that, right?
Well, I don't see the restriction in latest ZCatalog that would require at least one filter.

So now I am confused. Do you know for sure what to call to get all catalog brains for current versions of Plone (4.3 up)?

@mauritsvanrees mauritsvanrees self-assigned this Feb 4, 2020
@mauritsvanrees
Copy link
Member

I tried with master on Plone 5.2, Python 3. Installed plone.app.multilingual, created Dutch, English and German content. Result of catalogcleanup:

Handling catalog portal_catalog.
Brains in portal_catalog: 16
Brains in portal_catalog using standard filter is different: 0
portal_catalog: removed 0 brains without UID.
portal_catalog: removed no brains in object check.
portal_catalog: 0 non unique uids found.
portal_catalog: 0 items need new unique uids.
portal_catalog: total problems: 1

Ignored non existing catalog uid_catalog.

Ignored non existing catalog reference_catalog.

Done with catalog cleanup.
Dry run selected: aborted any transaction changes.

So one problem, which is the one that you report:

Brains in portal_catalog: 16
Brains in portal_catalog using standard filter is different: 0

First I thought unrestrictedSearchResults would help, but that gives the same problem. But recent versions of Products.ZCatalog have a getAllBrains method. I have a branch that tries to use this method and falls back to unrestrictedSearchResults.
There might be versions where getAllBrains does not exist and where unrestrictedSearchResults does not return anything, but that seems a small range of versions.

mauritsvanrees added a commit that referenced this issue Feb 4, 2020
This is available in `Products.ZCatalog` 2.13.30+ or 4.1+.
Fall back to `unrestrictedSearchResults`.

Fixes issue #16.
@thet
Copy link
Member Author

thet commented Aug 24, 2022

I think this can be closed.

@thet thet closed this as completed Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants