[Zope-dev] ZCatalog Lazy Results
Tres Seaver
tseaver@digicool.com
Thu, 22 Feb 2001 08:03:28 -0500 (EST)
On Thu, 22 Feb 2001, 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;
>
> searchResults(index1='kalle', index2='kaviar')
There is no practical difference, unless you are "federating"
queries across multiple catalogs; the 'used' parameter is there
solely to accumulate a record of the indices used in the search.
> (Are used supposed to be a tuple?)
It should be something supporting the mapping interface. Here is
how it is used (from 'lib/python/Products/ZCatalog/Catalog.py'):
if used is None: used={}
for i in self.indexes.keys():
try:
index = self.indexes[i].__of__(self)
if hasattr(index,'_apply_index'):
r=index._apply_index(args)
if r is not None:
r, u = r
for name in u:
used[name]=1
In other words, "Nothing to see here; move along." :)
Tres.
--
===============================================================
Tres Seaver tseaver@digicool.com
Digital Creations "Zope Dealers" http://www.zope.org