I have a ZCatalog and I would like to search it and sort the results first on a Priority value and then sort all results with the same priority on a date. I would like to be able to do something like this: results = catalog.searchResults(sort_on=['priority','event_date']) but sort on cannot be a list. Is there a way to do this, or do I need to sort the results on my own? Thanks, -Brian Brinegar ECN Web Systems Developer
On Mon, Apr 08, 2002 at 11:50:51AM -0500, brian.r.brinegar.1 wrote:
results = catalog.searchResults(sort_on=['priority','event_date'])
but sort on cannot be a list. Is there a way to do this, or do I need to sort the results on my own?
Some code in Catalog.py leads me to think this might be possible. for k, intset in sort_index.items(): if hasattr(intset, 'keys'): intset=intset.keys() append((k,LazyMap(self.__getitem__, intset))) However, as of the end of 2001, we're told no one was working on it. http://lists.zope.org/pipermail/zope/2001-December/105254.html Then...there was a patch to do it. http://dev.zope.org/Members/rossl/MultikeyInSorts But it says that Zope 2.2.x handles it. So...I'm guessing you can now do it, but I don't see exactly how. I'll bang on it some more... --kyler
On Mon, Apr 08, 2002 at 11:50:51AM -0500, brian.r.brinegar.1 wrote:
I have a ZCatalog and I would like to search it and sort the results first on a Priority value and then sort all results with the same priority on a date. I would like to be able to do something like this:
results = catalog.searchResults(sort_on=['priority','event_date'])
but sort on cannot be a list.
I researched this a bit and had a length response with lots of references...then my laptop blew the GFCI here and...oh, I'm frustrated. Anyway...there was a patch to do this, but it's supposedly no longer needed. I poked around Catalog.py and found something that indicates to me that multiple sort keys can be used. I don't have an example yet, but I'll keep on it. --kyler
participants (2)
-
brian.r.brinegar.1 -
kyler@lairds.com