[Zope] ZCatalog 2.3.0 -> 2.3.2 issues...

Steve Spicklemire steve@spvi.com
Thu, 10 May 2001 07:02:44 -0500

Hi Folks,

	I'm experiencing trouble with ZCatalog in 2.3.2. I read all about 
upgrading from my working 2.3.0 catalog and thinking that maybe I futzed 
it, I just created a new catalog. I couldn't find any reports of sort_on 
problems except for some references to a 'FieldIndex' bug, that has 
already been squashed. Here's my situation, I have a bunch of cataloged 
objects and I want to sort on one of the fields. In 2.3.0 I would just 
set 'sort_on' in the REQUEST to be one of the 'FieldIndexed' attributes 
and it worked. When I upgraded to 2.3.2 (yesterday) it stopped working. 
I've managed to trace it down to the _indexedSearch call in the __call__ 
of Catalog. sort_index looks OK, but _indexedSearch goes through the 
index items and creates LazyMap objects, but they seem broken somehow:

656                     raise CatalogError, ('Unknown sort_on index 
%s' % sort_index)
658             # Perform searches with indexes and sort_index
659             r=[]
660             used=self._indexedSearch(kw, sort_index, r.append, used)
661  ->         if not r:
662                 return LazyCat(r)
664             # Sort/merge sub-results
665             if len(r)==1:
666                 if sort_index is None: r=r[0]
(Pdb) print r
[('aerosmith', [<mybrains instance at 8bb6340>]), ('albert finney', 
[<mybrains instance at 8bb6350>]), ('alfred hitchcock', [<mybrains 
instance at 8bb6360>]), ('beatles',  *** TypeError: unsubscriptable 

When _indexedSearch returns, the 'r' list is sunk, though what's there 
is sorted. ;-)

I'm invoking the Catalog like so:

<dtml-in "Catalog({}, sort_on='kArtist')">
<dtml-var Artist><br>

I don't have time right now to dig into why LazyMap is raising a 
TypeError, but I might later today. When I take out the sort_on, all the 
records are returned. Any ideas would be appreciated!