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!
Garito wrote at 2004-9-13 16:39 +0200:
How can I sort the results of a ZCatalog?
I try these:
return catalog({'meta_type': 'type1', 'multiplesvalues': 'value1'}, sort_on='multiplesvalues')
A requirement for this is that "multiplesvalues" is a "FieldIndex". Other types of indexes cannot be used for index based sorting.
... 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
You cannot use index based sorting but must implement your own (external) sorting. -- Dieter
Dieter Maurer wrote:
Garito wrote at 2004-9-13 16:39 +0200:
How can I sort the results of a ZCatalog?
I try these:
return catalog({'meta_type': 'type1', 'multiplesvalues': 'value1'}, sort_on='multiplesvalues')
A requirement for this is that "multiplesvalues" is a "FieldIndex". Other types of indexes cannot be used for index based sorting.
... 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
You cannot use index based sorting but must implement your own (external) sorting.
Hi Dieter Thanks for your response At these time I had implemented an external sorter but Is there any kind of "rules" to create these kind of behavior integrated with ZCatalog? Thanks!!!!
--On Dienstag, 14. September 2004 2:02 Uhr +0200 Garito <garito@sistes.net> wrote:
Hi Dieter Thanks for your response At these time I had implemented an external sorter but Is there any kind of "rules" to create these kind of behavior integrated with ZCatalog?
Some restrictions are just fundamental issues based on the nature of algorithms and datastructures. Some operations just do not make sense for a certain kind of indexes.. just from the logical point of view. -aj
Andreas Jung wrote:
--On Dienstag, 14. September 2004 2:02 Uhr +0200 Garito <garito@sistes.net> wrote:
Hi Dieter Thanks for your response At these time I had implemented an external sorter but Is there any kind of "rules" to create these kind of behavior integrated with ZCatalog?
Some restrictions are just fundamental issues based on the nature of algorithms and datastructures. Some operations just do not make sense for a certain kind of indexes.. just from the logical point of view.
-aj
Hi Andreas! Need more concretion! I'm not a wizard and these is not sorcery :) ;) jejejeje Perhaps I'm geting in hot water? (jeje, ultralingua rules!) Cheers
Garito wrote at 2004-9-14 02:02 +0200:
... At these time I had implemented an external sorter but Is there any kind of "rules" to create these kind of behavior integrated with ZCatalog?
I doubt that you will get it into the ZCatalog code because the semantics of your sorting operation is not well defined: Suppose, you have keywords a1 < a2 and b1 < b2 and documents d1 with keywords a1 and b2 as well as d2 with keywords a2 and b1. Should "d1" come before "d2" or vice versa? Questions like this rule out "KeywordIndex" (or any other index that indexes an object under several terms) as sort index. -- Dieter
Dieter Maurer wrote:
Garito wrote at 2004-9-14 02:02 +0200:
... At these time I had implemented an external sorter but Is there any kind of "rules" to create these kind of behavior integrated with ZCatalog?
I doubt that you will get it into the ZCatalog code because the semantics of your sorting operation is not well defined:
Suppose, you have keywords a1 < a2 and b1 < b2 and documents d1 with keywords a1 and b2 as well as d2 with keywords a2 and b1.
Should "d1" come before "d2" or vice versa?
Questions like this rule out "KeywordIndex" (or any other index that indexes an object under several terms) as sort index.
Ok Then I don't worry about this! Thanks a lot!!!!
participants (3)
-
Andreas Jung -
Dieter Maurer -
Garito