[Zope] ZCatalog Field indexes

Chris McDonough chrism@zope.com
22 Nov 2002 10:42:56 -0500


I think you can emulate the old behavior like this:

Catalog(field1=('',))

Here's a comment from the code:

          - if the value is a blank string, None is returned (in
            order to support requests from web forms where
            you can't tell a blank string from empty).

          - if the value is a nonblank string, turn the value into
            a single-element sequence, and proceed.

          - if the value is a sequence, return a union search.

        FAQ answer:  to search a Field Index for documents that
        have a blank string as their value, wrap the request value
        up in a tuple ala: request = {'id':('',)}


On Fri, 2002-11-22 at 10:07, Tim McLaughlin wrote:
> I swear that this used to work, but I think maybe it has changed accidentally somewhere in 2.4+.
> 
> Catalog(field1='') (where field1 is a 'Field' type index)
> 
> should return all catalogged objects which have an empty string for that attribute, and it used to (I think).  In current versions, ZCatalog just seems to ignore the parameter altogether and return all catalogged objects.  This current implementation doesn't make sense to me...
> 
> Tim
> -- 
> Tim McLaughlin
> Chief Technology Officer
> Siteworx, Inc... Set your site on the future!
> 703.390.5421
> 
> 
> _______________________________________________
> 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 )