[Zope-dev] ZCatalog FieldIndex Bug (Fix?)

Chris Withers chrisw@nipltd.com
Thu, 05 Apr 2001 23:41:58 +0100


Chris Withers wrote:
> Correct me if I'm wrong, but if I query a field index with an empty string, I
> expect to get returned all catalogued objects where that attribute's value _is_
> the empty string.
> 
> Anyway, this happens most of the time and I wish it happened all the time.
> Basically, the only situation where this _doesn't_ happen is when _none_ of the
> objects catalogued in the field index have a value of the empty string, which
> seems really bug and nasty to me ;-)

I think I've got a solution, but I dunno if it's right. The patch is at the end.
How do I get the unit tests in ZCatalog/tests to run so I can check I haven't
screwed anything else up?

cheers,

Chris

E:\Zope\2.3.1\lib\python\SearchIndex>diff -u unindex.py.old unindex.py
--- unindex.py.old      Thu Apr 05 23:35:40 2001
+++ unindex.py  Thu Apr 05 23:37:46 2001
@@ -407,9 +407,9 @@

         if r is None:
             if anyTrue:
-                r=IISet()
-            else:
                 return None
+            else:
+                r=IISet()

         return r, (id,)