[Zope] FieldIndex NOT

Chris McDonough chrism@zope.com
Wed, 22 Aug 2001 23:20:37 -0400


There's currently no way to do this in a single query, but you can do 
(inefficient/torturous):

unique_states = catalog.uniqueValuesFor('state')
l = []
for state in unique_states:
     if state != 'California': l.append(state)
notCalifornia = catalog.searchResults({'state':l})

There is a proposal in the fishbowl that, implemented properly, would 
provide a difference function that would allow you to do this more 
efficiently 
(http://dev.zope.org/Wikis/DevSite/Proposals/UnionAndIntersectionOperations).

HTH,

- C



Brian Brinegar wrote:
> I'm probably overlooking this, but has a NOT usage been implemented in
> fieldIndexes. I would like to have something like
> 
> catalog.searchResults({'state':'California','state_usage':'not'})
> 
> return a list of everything that did not have "California" as the value for
> state.
> 
> --Brian
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 


-- 
Chris McDonough                    Zope Corporation
http://www.zope.org             http://www.zope.com
"Killing hundreds of birds with thousands of stones"