Portal_catalog search question

Is there a way to search the catalog if you have an 'unset item'?

I use:

 self.context.portal_catalog(portal_type='my type', cat_index1=my_index1, cat_index2=my_index2)

Which works if I have a value for both my_index1 and my_index2

But: Is there a way to search if my_index2 (or 1) is not set to some¨ specific value? ( is there some kind of 'wildcard' ?

my_index2 = '*'
my_index = None
my_index = []

If not: what is best

Search without the index, then filter or
Construct the search_query before doing the search

There is no way to search for unset values because most or all index types ignore indexable values evaluating to False or being None.

-aj

1 Like

you can but not with just a query unfortunately.

Long time ago, in plain-Zope-days, you could query for None values using a tuple:

context.portal_catalog(your_index=(None,))