[Zope] Finding unique objects in a ZCatalog returned list

Mike Groves Mike.Groves@polymerlabs.com
Thu, 21 Jun 2001 10:25:18 +0100


Thanks for the suggestion Oleg,

Would the rid be unique in this case? Would this be a better key to use?

All the objects returned are my own ZClasses so alternatively I could add a
property which I could make sure is unique for all items.

Any thoughts anyone?

Thanks

Mike

-----Original Message-----
From: Oleg Broytmann [mailto:phd@phd.fep.ru]
Sent: 21 June 2001 10:14
To: Mike Groves
Cc: 'zope@zope.org'
Subject: Re: [Zope] Finding unique objects in a ZCatalog returned list


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.

----
The Information in this communication is confidential and may be privileged
and should be treated by the recipient accordingly.  If you are not the
intended recipient please notify me immediately. You should not copy it, or
use it for any purpose nor disclose its contents to any other person.
Opinions, conclusions and other information expressed in this message are not 
given or endorsed by Polymer Laboratories Ltd. unless otherwise 
indicated by an authorised representative independent of this message.
Any quotations, offers for sale or negotiations on behalf of the company 
contained in this Email are Subject to Contract and require alternative confirmation.