Plone 5.2: collection or query find documents without keywords

Hi, with Plone 5.2 we try to define search criteria inside a new-style collection to retrieve all documents which have no keywords assigned yet.

We want to assist the user in tagging every existing content object with the right tag before we enforce tagging on newly created objects.

We habe updated plone.app.querystring to 1.6.0 which should provide the new “none” operators which should make it possible to filter like “matches none of” in the criteria parameter field for a tag, keyword or subject criteria, in german it is called “Schlagwort”.

But when we define “matches none of” and put every tag that exists in the list, we get an empty resultlist in stead of a list with documents without a tag.

We tried a view with the following query

   query = \[ 
       { 
           'i': 'portal_type', 
           'o': 'plone.app.querystring.operation.selection.none', 
           'v': ( 
               'Folder', 
           ), 
       }, 
       { 
           'i': 'path', 
           'o': 'plone.app.querystring.operation.string.relativePath', 
           'v': './', 
       }, 
       { 
           'i': 'Subject', 
           'o': 'plone.app.querystring.operation.selection.none', 
           'v': ( 
               'PROTO', 
           ), 
       } 
   \]

but it gives an empty list, while excluding contenttypes of “Folder” actually works, but excluding keywords does not work.

What is the difference so that excluding Folders actually work, but excluding keywords does not ? What do we wrong ?

Try to reindex the Subject index.

That does not change the anything.

Additonally i tried with a fresh Plone-Site and a few folders and documents. It is not possible at all to set the search criteria of a collection to search for documents which have no tags assigned to it.

I consider this a missing feature. Maybe it is fixed in Plone 6 and someone with an installed Plone 6 can do a quick check.

But thanks for the hint anyway.

This was fixed in July in Products.ZCatalog. Searches with "not" in a KeywordIndex do not return records that do not contain a value for the index (2nd) by mamico · Pull Request #159 · zopefoundation/Products.ZCatalog · GitHub

That sounds good. Ich will give a backport to a Plone 5.2 compatible ZCatalog a try.