[Zope-CMF] Topic Criteria excluding subject
Tres Seaver
tseaver@zope.com
Sat, 27 Oct 2001 08:27:47 -0400
Jan Ulrich Hasecke wrote:
> Hi,
>
> is it possible to exclude Content in a topic-view by a keyword?
>
> I have a Topic which displays links with general content. Search by
> content-type "Link".
>
> Now I've made a Topic with links to a special Content, searched by
> Subject:"special Keyword" and I do not want to show this links up in
> the general linkcollection.
>
> Is it possible to exclude them by Subject, someting like !Keyword
Nope, not with a stock KeywordIndex. You could implement a new
PluginIndex which supported a syntax like:
portal_catalog.searchResults( Subject={ query: 'Spanish Inquisition'
, operator='not'
} )
Or you could leave the index out and post-filter the results:
brains = self.portal_catalog.searchResults( ... )
return filter( lambda x: 'Spanish Inquisition' not in x.Subject
, brains )
Tres.
--
===============================================================
Tres Seaver tseaver@zope.com
Zope Corporation "Zope Dealers" http://www.zope.com