[Zope] Efficient Processing Of Large ZCatalog Queries

Toby Dickenson tdickenson@geminidataloggers.com
Thu, 17 Oct 2002 22:11:38 +0100


On Thursday 17 Oct 2002 10:04 pm, VanL wrote:
> Yes, the time is spent in the pseudocode loop, not in the dtml.  Sorry
> that wasn't clearer.  However, the dtml waits for the loop to completel=
y
> finish processing before it will display the result page.  One of the
> things that I am curious about is a method to display the results as
> they become available.  (As I noted in the original message,
> REQUEST.RESPONSE.write doesn't seem to be working for me in my current
> setup.

That makes sense if you are only calling RESPONSE.write once the pseudoco=
de=20
loop has finished. I think you need:

for x in catalog.search(myquery):
    ob =3D myFunction(getObject(x))=20
    RESPONSE.write(formatting_function(ob))


if you dont want to always display the whole list:

for x in catalog.search(myquery)[start:end]:
    ob =3D myFunction(getObject(x))=20
    RESPONSE.write(formatting_function(ob))