[Zope] ZCatalog OR search problems

Oliver Frommel oliver@aec.at
Fri, 23 Feb 2001 23:14:43 +0100 (CET)


Hi,

I've implemented an OR search for ZCatalog following the HowTos and mailing
list postings. However I am still trying to solve the problem that a search
result shows up twice when it matches two subsearch criteria. I tried a
Python Method "uniq" to make the results of the search unique, but get an
error "Error Type: AttributeError
             Error Value: __hash__".

dtml:
 <dtml-let resa="Catalog(text_obj=begriff)"
           resb="Catalog(abstract_obj=begriff)"
           resc="Catalog(title=begriff)"
           res="resa[:_.len(resa)] + resb[:_.len(resb)] + resc[:_.len(resc)]">

<dtml-in "uniq(items=res)" size=50 start=query_start>
...

python method (parameter "items"):
d = {}
for item in items:
    d.update( { item: 1 } )
return d.keys()

stack trace:
...
 File /opt2/cvs/Zope2/lib/python/Products/PythonScripts/PythonScript.py, line 337, in _exec
    (Object: uniq)
    (Info: ({'script': <PythonScript instance at 8c73b88>, 'context': <Folder instance at 8c95b88>, 'container': <Folder instance at 8968e08>, 'traverse_subpath': []}, (), {'items': [<mybrains instance at 8b215d0>, <mybrains instance at 8c2e778>, .....

  File Script (Python), line 5, in uniq
..

why can't I iterate over the "items" search results as a normal list?
Is there any way to make this work?

thanks for your help
--Oliver