[Zope-dev] Needed: tip iterative search of catalog indexes

Joseph Schlesinger jschlesinger@imeme.net
Fri, 3 Nov 2000 07:26:56 -0800


This is a multi-part message in MIME format.

------=_NextPart_000_0025_01C04567.7214FCE0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Can anyone provide advice for iterating a search through all indexes in =
a catalog.  E.g., determining whether 'foo' appears in any field of any =
of the indexed items.
The python method reproduced below does the job, but it seems rather =
cumbersome.  Is there a better way to do it in DTML?
Thanks.
---------------------------------------------

list =3D [index1, index2, ... ]
return  self.Catalog({list[0] : search_item})
for item in list[0:]:
   for result in self.Catalog({ item : search_item}):
        if not result in results: results.append(result)
return results=20


------=_NextPart_000_0025_01C04567.7214FCE0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Can anyone provide advice for iterating =
a search=20
through all indexes in a catalog.&nbsp; E.g., determining whether 'foo' =
appears=20
in any field of any of the indexed items.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The python method reproduced below does =
the job,=20
but it seems rather cumbersome.&nbsp; Is there a better way to do it in=20
DTML?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanks.</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>---------------------------------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><BR>list =3D [index1, index2, ... =
]<BR>return&nbsp;=20
self.Catalog({list[0] : search_item})<BR>for item in =
list[0:]:<BR>&nbsp;&nbsp;=20
for result in self.Catalog({ item :=20
search_item}):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if not =
result in=20
results: results.append(result)<BR>return results=20
<BR></FONT></DIV></BODY></HTML>

------=_NextPart_000_0025_01C04567.7214FCE0--