[Zope-dev] ZCatalog Bug: scope for the problem

Chris Withers chrisw@nipltd.com
Sat, 21 Jul 2001 09:01:27 +0100


> I'm doing something simple:
>
> return catalog.searchResults(sort_on='dateofpublication')
>
> ...and getting something horrible:
>
> Error Type: TypeError
> Error Value: unsubscriptable object

Further scoping out this problem has expanded it:

- this bug isn't limited to 2.4.0bx, it's also manifests at least in 2.3.2
and probably in 2.3.1+.

...and narrowed it:

- the bug occurs when you sort on an index where more than one indexed item
has the same value.

For example, if:

x=SimpleItem()
y=SimpleItem()
z=Simpleitem()
x.fred=1
y.fred=1
z.fred=2

...now if you have a FieldIndex called 'fred' and catalog this lot, you'll
get the error when you do a search along the lines of:

r = Catalog(sort_on='fred')

However, if you changed it so y.fred=2 and z.fred=3, you wouldn't get any
unexpected behaviour :-S

It appears that IITreeSet objects don't like being subscripted. That sounds
kindof weird, but then it doesn't look like IITreeSets should be appearing
in that context anyhow...

Help!

Chris