[Zope] Sort keyword index

Garito garito at sistes.net
Mon Sep 13 10:39:46 EDT 2004


Hi all

How can I sort the results of a ZCatalog?

I try these:

return catalog({'meta_type': 'type1', 'multiplesvalues': 'value1'}, 
sort_on='multiplesvalues')

These raise me these error:

Traceback (innermost last):
  Module ZPublisher.Publish, line 100, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 40, in call_object
  Module Shared.DC.Scripts.Bindings, line 306, in __call__
  Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
  Module Products.PythonScripts.PythonScript, line 318, in _exec
  Module None, line 1, in Test
   - <PythonScript at /MyProduct/MyProduct/Test>
   - Line 1
  Module Products.ZCatalog.ZCatalog, line 634, in searchResults
  Module Products.ZCatalog.Catalog, line 755, in searchResults
  Module Products.ZCatalog.Catalog, line 559, in search
  Module Products.ZCatalog.Catalog, line 577, in sortResults
AttributeError: documentToKeyMap

Note that multiplesvalues is a keyword index and I need all objects that 
have value1 into multiplesvalues then sort by multiplesvalues

Another question:
Imagine the other example with 2 objects with a multiplesvalues like:
Object1
    multiplesvalues
       value3
       value4
       value5

Object2
    multiplesvalues
       value1
       value2
       value3
       value6
There are any sort mode to order by multiplesvalues that brings the 
sorted list like: Object2, Object1 (like these because Object2 has 
value1 - like the smallest value- and Object1 has value3 - like the 
smallest value?

I hope I explain me clear, if not sorry!! :)

Thanks!



More information about the Zope mailing list