[Zope] Need ZCatalog help

Martijn Pieters mj@antraciet.nl
Fri, 10 Sep 1999 16:29:57 +0200


At 16:05 10/09/99 , Michel Pelletier wrote:
>Martijn Pieters wrote:
> >
> > >
> > So, if you have an index on an integer value, called 'level', and you ask
> > for {'level': 10, 'level_usage': 'range:max'} you'll get all objects whose
> > 'level' property is 10 or lower. If I only ask for {'level': 10} I only get
> > objects whose level is exactly 10. Note that if I use {'level': (1, 2, 3,
> > 4), 'level_usage': 'range:min:max'} I'll get all objects with a level from
> > 1 to 4.
>
>Really?  I thought that should be:
>
>{'level': (1, 4), 'level_usage': 'range:min:max'}

   if opr=="range":
       if 'min' in opr_args: lo = min(keys)
       else: lo = None
       if 'max' in opr_args: hi = max(keys)
       else: hi = None

So, when min is specified, it takes the lowest values from the keys list, 
and when max is given, it takes the highest value from the list. No order 
is imposed, and you can specify any nuber of values.

{'level': (1, 4), 'level_usage': 'range:min:max'} is all that is needed, in 
fact, you can get away with {'level': 4, 'level_usage': 'range:min:max'}, 
but that wouldn't be much use =).

My mistake for not making it clear that the last example would work even 
tough it had four items in the search values list.


--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-7502100 Fax: +31-35-7502111
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------