[Zope-dev] ZCatalog stuff

Chris Withers chrisw@nipltd.com
Thu, 22 Feb 2001 10:42:14 +0000


Johan Carlsson wrote:
> 
> > Casey Duncan <casey_duncan@yahoo.com> wrote:
> > >
> > > Yes, you always get all the meta-data. However, does
> > > anyone know how the "used" argument of
> > > ZCatalog.searchResults works, or why you would use it?
> >
> > 'used' tells you the names of the indexes which actually
> > participated in the search (as distinct from those you
> > asked for).
> 
> What does this meen?
> 
> Example, What's the different between:
> 
>   searchResults(used=(index1,index2), index1='kalle', index2='kaviar')
> 
> and;

Damn, where's this documented?
I think this is _exactly_ what I've been looking for for ages, especially, I'm
guessing, that if you don't specify 'used' then:

1. It's assumed all indexes take part in the search
2. All parameters that aren't supplied are assumed to be blank, and therefore
will match anything?

Am I on the right track?

Furthermore, is there any way I can tell ZCatalog that nothing means nothing,
not everything?

For example, if I do searchResults(age=''), I want only records with a blank age
record, _not_ all the records.

Okay while I'm here, one final one.

We have the sort_on and sort_order parameters, they'll return stuff ordered
like:

Aardvark
Badger
anteater
bird

Whereas most humans would think the following would be more readable:

Aardvark
anteater
Badger
bird

I guess ZCatalog uses cmp somewhere along the line. IS there any way I can pass
in a different cmp function for a given index?

Hah, just thought of one last one ;-)

Okay, we have sort_on, which lets me sort on one index. Is there any way I can
provide a secondary sort key?

something like
searchResults(age='',sort_on=(('lastname','normal'),('firstname','normal'),'('salary','reverse')))
would eb a dream.

Wow, that turned into a ZCatalog wishlist... any ideas if any of it is
available, and if not, hwo hard it would be to achieve?

cheers,

Chris