Skip to content

Commit 6a0a750

Browse files
authored
Merge pull request #149 from bluedynamics/fix/pgindex-apply-index-and-parent-resolution
fix(pgindex): _apply_index + robust catalog resolution (#146)
2 parents a1bde82 + 957215d commit 6a0a750

8 files changed

Lines changed: 2769 additions & 30 deletions

File tree

CHANGES.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,54 @@
11
# Changelog
22

3+
## 1.0.0b61
4+
5+
### Fixed
6+
7+
- `_CatalogCompat.getIndex` and `_CatalogIndexesView.__getitem__` no
8+
longer silently fall back to the raw ZCatalog index when they
9+
cannot find the catalog tool — that fallback returned empty BTrees
10+
and masked #143 / #146 for weeks. A new private helper
11+
``_resolve_catalog`` tries three paths in order (``__parent__``
12+
Acquisition chain → ``zope.component.hooks.getSite().portal_catalog``)
13+
and raises ``RuntimeError`` if all three fail.
14+
15+
- ``_CatalogCompat.indexes`` property now self-heals a missing
16+
``__parent__`` on first access via ``getSite().portal_catalog``.
17+
First page render after deploy persists ``__parent__``; no second
18+
upgrade-step click required on sites where the #139 upgrade ran
19+
before that fix landed. Zero-touch prod recovery.
20+
21+
### Added
22+
23+
- ``PGIndex._apply_index(request, resultset=None)`` — ZCatalog-
24+
compatible low-level query entry point. Returns
25+
``(IITreeSet(zoids), (index_name,))``. Reuses
26+
``_QueryBuilder._process_index`` so every registered IndexType
27+
(FIELD, KEYWORD, PATH, DATE, DATE_RANGE, UUID, TEXT, BOOLEAN, GOPIP)
28+
plus every ``IPGIndexTranslator`` utility works for free. No
29+
implicit security filtering — matches ZCatalog semantics; use
30+
``catalog(**query)`` for secured results. Emits a
31+
``DeprecationWarning`` once per caller site.
32+
33+
- ``_PGIndexMapping.__getitem__`` / ``__len__`` — round out the
34+
PG-backed mapping so Plone core callers
35+
(``plone.app.uuid.utils``, ``plone.app.vocabularies.Keywords``)
36+
work against ``catalog._catalog.getIndex(name)._index`` without
37+
needing ``catalog.Indexes[name]`` acquisition.
38+
39+
- ``_PGIndexMapping.items()`` / ``values()`` raise
40+
``NotImplementedError`` with guidance pointing at ``uniqueValues``,
41+
``_apply_index``, and ``catalog(**query)`` as alternatives. No
42+
Plone-core caller uses them on a wrapped index; a concrete usecase
43+
can land in a future issue with server-side-cursor streaming.
44+
45+
- ``PGIndex._index`` property emits a ``DeprecationWarning`` on
46+
access — signals callers that the BTree-shaped API is an
47+
emulation and suggests the preferred pgcatalog-native
48+
alternatives.
49+
50+
Closes #146.
51+
352
## 1.0.0b60
453

554
### Fixed

0 commit comments

Comments
 (0)