[Zope] Finding unique objects in a ZCatalog returned list
Oleg Broytmann
phd@phd.fep.ru
Thu, 21 Jun 2001 13:13:51 +0400 (MSD)
On Thu, 21 Jun 2001, Oleg Broytmann wrote:
> 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.
Oops, forgot to say, that even this does not guarantee uniquness.
Consider these URLs:
http://my.server/Folder
http://my.server/Folder/
http://my.server/Folder/index_html
3 different URLs point to the same object.
Oleg.
----
Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.