[Zope] ZCatalog Range Weirdness

Jeff Hoffman jeff.hoffman@goingv.com
Thu, 9 Nov 2000 14:09:03 -0500 (EST)


Hello,

We have an interesting situation, here, and I can't seem to put my finger
on what's going on.

Let's say I have two different classes of objects being cataloged. The
first class, Class A, has a floating point attribute myFloat. The second
class, Class B, does not. 'myFloat' is an index in the Catalog.

Let's say the makeup of class instances in the catalog is 50/50 Class A
and Class B:

  Instance1 (Class A): myFloat = 0.5
  Instance2 (Class B)
  Instance3 (Class A): myFloat = 0.65
  Instance4 (Class B)
  Instance5 (Class A): myFloat = 0.55
  Instance6 (Class B)

I queried the catalog with:

  Catalog(myFloat=0.0, myFloat_usage='range:min')

Expecting to get record objects representing:

  Instance1 (Class A): myFloat = 0.5
  Instance3 (Class A): myFloat = 0.65
  Instance5 (Class A): myFloat = 0.55

Since objects of Class B do not have myFloat, and would not be included in
the myFloat index. Instead, I get:

  Instance1 (Class A): myFloat = 0.5
  Instance2 (Class B)
  Instance3 (Class A): myFloat = 0.65
  Instance4 (Class B)
  Instance5 (Class A): myFloat = 0.55
  Instance6 (Class B)

In other words, I get all objects back, whether they have a myFloat
attribute or not. Interestingly, if I change the query to:

  Catalog(myFloat=0.5, myFloat_usage='range:min')

I get the expected results. Using 0.1, 0.2, 0.3, or 0.4 does not work; 0.5
seems to be the magic number, which I find curious given that 0.5 is the
minimum value present in any of the instances of Class A.

Can anyone shed some light on what's going on, here? How do I ask the
Catalog to return all instances who have a value, any value, for myFloat,
but none others?

Thanks in advance,

--Jeff

---
Jeff K. Hoffman                               704.849.0731 x108
Chief Technology Officer                      mailto:jeff.hoffman@goingv.com
Going Virtual, L.L.C.                         http://www.goingv.com/