[Zope] ZCatalog results.

Frank Tegtmeyer fte@lightwerk.com
23 Feb 2002 13:08:11 +0100


Sidnei da Silva <sidnei@x3ng.com.br> writes:

> Im trying to make 2 searchs on one ZCatalog and merge both into a single 
> result, but I had no success on removing the duplicated results.

The straightforward approach:

Supposing you have objectID as MetaData identifier in your ZCatalog:

results = ....your search here
seen = []
uniqresult = []

for result in results:
   if result.objectID not in seen:
      seen.append(result.objectID)
      uniqresult.append(result)

Many optimizations possible :)

Regards, Frank
-- 
CTO   fte@Lightwerk.com         http://www.Lightwerk.com/
Fax: +49-2434-80 07 94           Phone: +49-2434-80 07 81
Lightwerk GmbH * An der Kull 11 * 41844 Wegberg * Germany
Besuchen Sie uns auf der CeBIT:  Halle 6, Stand F68 / 595