zopefoundation / Products.ZCatalog

Zope's indexing and search solution.
Other
5 stars 22 forks source link

Improve Handling of Empty Queries #152

Open kenara opened 3 months ago

kenara commented 3 months ago

Summary

This PR addresses the issue of empty queries in the ZCatalog returning no results without explicit feedback. It proposes raising a ValueError when an empty query is detected, providing clear feedback to developers.

Background

In the current implementation of ZCatalog in Zope 4 and 5, an empty query returns no results without any indication to the user. This behavior can be confusing and complicates debugging.

Justification

Changes

Benefits

Impact

d-maurer commented 3 months ago

kenara wrote at 2024-5-25 07:39 -0700:

This PR addresses the issue of empty queries in the ZCatalog returning no results without explicit feedback. It proposes raising a ValueError when an empty query is detected, providing clear feedback to developers.

The catalog usually returns the intersection of the subquery results. As a consequence, an empty query should return all possible results (as ZCatalog did in its early days).