The search method of PathIndex class returns varying types depending on
the success of the search.

If the search fails a list object is returned, if the search succeeds an
object of type BTrees.IIBTree.IISet is returned.

This causes a problem in _apply_index in PathIndex when PathIndex tries to
do either a union or intersection.

I am doing a search of a catalog like this:


This should return all objects in the catalog that are inside of folder1
or folder2 and works perfectly as long as objects from both folder1 and
folder2 exist in the catalog.

However if say folder2 does not exist then _apply_index tries to do a
union between a list and an IISet object. This raises an invalid argument

I'm not 100% sure where this problem should be addressed, but a quick fix
I saw was to change part of _apply_index in PathIndex from:

        if operator=="or": set_func = union
        else: set_func = intersection

        res = None

        for k in record.keys:
                rows =,level)
                res = set_func(res, rows)

To something like this:

        if operator=="or": set_func = union
        else: set_runc = intersection

        res = None

        for k in record.keys:
                rows =,level)
                if rows == []:
                        rows = None
                res = set_func(res,rows)

This works since union and intersection will take None as an argument but
not an empty list.

I would suggest be changed to return an empty IISet if it
fails just to have consistancy.

Let me know what you think

--Brian Brinegar
  ECN Web Technician
  MSEE 104 A 494-3106

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to