[Zope] Finding unique objects in a ZCatalog returned list

Oleg Broytmann Oleg Broytmann <phd@phd.fep.ru>
Thu, 21 Jun 2001 13:07:52 +0400 (MSD)


On Thu, 21 Jun 2001, Mike Groves wrote:
> I'm doing quick search using several indexes in a ZCatalog as below
>
> <dtml-in expr="Catalog(title=query) +
>                Catalog(category=query) +
>                Catalog(description=query) +
>                Catalog(product=query) +
>                Catalog(keywords=query)">
>
> This works really well. However, if my query string is found in more than
> one index I get the same object returned more than once.
>
> How do I sort the list of objects returned and more importantly remove
> duplicate objects?

   Put all results in a dictionary, mapping URL to object. Do it in Python
Script, of course.

Oleg.
----
     Oleg Broytmann     http://www.zope.org/Members/phd/     phd@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.