[Zope] Catalog sort=random (was Re: [Zope] DESPERATION: ZCatalog search madness)

R. David Murray bitz@bitdance.com
Sun, 27 Feb 2000 13:45:08 -0500 (EST)


On Fri, 25 Feb 2000, Hung Jung Lu wrote:
> inside ZCatalog, but nothing to worry about. I think they
> are letting the sort feature out of ZCatalog now. So,
> instead of using sort_on inside the Catalog call, you
> simply use the sort feature of the <dtml-in ...> tag.

I would not think that this would be the case.  Consider the example
where you return Catalog results with a 'size=' parameter.  In that
case, dtml-in sort would sort only the subset of results returned
in that Catalog call, not the whole dataset potentially returned
by that Catalog search.  For the latter, you have to have the sort
parameter on the Catalog call.

I have an issue related to this that I wonder if anyone can suggest
a solution to.  I have a Catalog, and a user interface that runs
a search on that catalog returning potentially many pages of
results.  I explicitly wish the items returned by that search to
be in *random* order (ie: a different order each time the seach is
initiated, but the same random order during one change of linked
search results pages).  I wonder if it is even possible to do this
and preserve lazy evaluation, perhaps by hacking on the Catalog
code itself.  So I'm also interested in suggestions for doining
this that may not preserve lazy evaluation but do not require
modifing the Catalog code.  (In the early stages of deployment the
average returned dataset will be less than 30 items (but still
multiple pages for design reasons), so lazy evaluation is not
significant at first).

--RDM