How can I exclude a subject in a Mosaic content listing tile?

Any trick how to customize the content-listing tile or add-on?
Thanks for any hint!

Perhaps, override the template at main · plone/ · GitHub via z3c.jbot

I'm thinking of creating an additional criterium operation
This is, I bet, already done by someone.

I use a boolean Field via Behavior for "News Item", if this checked then the News is a "Sticky News" and pinned on top of site in a viewlet.
I think it can be adapted for "isEmpty" or "shouldNotContain" or whatever.

You need a catalog index

    <indexed_attr value="is_sticky" />

You need a indexer

<configure xmlns="">
    name="is_sticky" />
# -*- coding: utf-8 -*-
from import INewsItem
from plone.indexer import indexer
from my.addon.behaviors.sticky_news import StickyNews

def sticky_news(obj):
    """Calculate and return the value for the indexer"""
    sticky = StickyNews(obj)
    if not sticky:
        return False
    return sticky.enable

You need a querystring definition

    i18n:translate="">Sticky News</value>
  <value key="description">check is the sticky news behavior available and set</value>
  <value key="enabled">True</value>
  <value key="sortable">False</value>
  <value key="operations">
  <value key="group">Custom</value>

with all these steps, a filter in a collection is available.

That's nice. To avoid forcing the editor to mark the content, a boolean index with "not these subjects" would do. It's a hack cause it's tailored for one single use case, but hey. Obviously querying does not offer a boolean NOT. Should have known.

I have asked a similar question (here), but I did not find it.

The solution is to make a new indexer (that 'return True' when not these subject)

afaict portal_catalog nowadays support not queries. Maybe something like plone.api.content.find(not={'my:' 'query'} works?

The problem is I think not in what portal_catalog supports, but in the expressiveness of the querystring widget and the underlying key-operation-value triplets that are stored (I forgot the exact terminolgy in there).

This for example also limits/does not support grouping filter statements in logical and/or groups and other more advanced queries.

Maybe you can get away with adding a 'not' operation but the ordering of other filter items and those following the not becomes important, (should another rule after the not be additive again?) there is no reordering, etc etc.

The query argument is a logical conjunction. Logical conjunctions are commutative. That means the order of the operands does not change the result.

Unfortunatly multiple operands on the same index are allowed in a Mosaic content listing tile. The last wins.

Just for the records: An operation is possible (as ZCatalog actually supports boolean NOT in queries on KeywordIndex since version 3) and makes sense to add it to

<records interface=""

but the result is the set of documents that are indexed: all documents with a 'Subject'. So all documents without Subjects are ignored. Which is not what is expected. There's more work to do.

The operation method would be

def _exclude(context, row):
    return {row.index: {'not': row.values}}