[ZCM] [ZC] 600/ 6 Comment "sort_on breaks results if sorted
attribute is missing"
Collector: Zope Bugs, Features,
and Patches ...
zope-coders-admin at zope.org
Tue May 25 15:55:38 EDT 2004
Issue #600 Update (Comment) "sort_on breaks results if sorted attribute is missing"
Status Accepted, Catalog/feature medium
To followup, visit:
http://collector.zope.org/Zope/600
==============================================================
= Comment - Entry #6 by chrisw on May 25, 2004 3:55 pm
Both please.
________________________________________
= Assign - Entry #5 by Caseman on May 22, 2004 2:32 pm
Status: Pending => Accepted
Supporters added: Caseman
This will be a BW compatible API change, should it be applied to the 2.7 branch or HEAD only?
________________________________________
= Edit - Entry #4 by Caseman on May 22, 2004 2:31 pm
Changes: submitter email, edited transcript, classification (bug => feature), new comment
We cannot change this behavior implicitly, because there is no fundamentally "correct" order ascribed to missing values and Python makes no guarantee about the order of None when compared to other objects.. There are undoubtedly applications which rely on the intersection happening via sort-on, which means we should leave it as the default behavior.
I changed this issue to a feature because I think the best way to implement this is to provide an optional 'sort_default' argument to the searchResults() method. When specified this value would be used as the sort key for objects found that are not in the sort index. Implementation would be straightforward with the existing sort code, and backward compatibility would be maintained.
________________________________________
= Resubmit - Entry #3 by mjablonski on May 22, 2004 6:17 am
Status: Rejected => Pending
Sorry for rejecting first (used a "wrong" test-case), but after another test (which I set up properly as Chris describes) in current Zope 2.7 I get the same error. Seems to be a bug, which can drive you crazy when using ZCatalog.
________________________________________
= Reject - Entry #2 by mjablonski on May 22, 2004 6:01 am
Status: Pending => Rejected
This is not a bug, but wrong usage of ZCatalog. "sort_on" can only be used on registered metadata (see metadata-tab in ZCatalog), not on an index.
________________________________________
= Request - Entry #1 by chrisw on Oct 2, 2002 11:35 am
Okay, take a ZCatalog which has a FieldIndex called dateofpublication and some others.
Search it so that it returns some objects. Some of these objects have dateofpublication attributes, some dont, but all match the search criteria.
Now, add sort_on='dateofpublication' to your search terms.
I'd expect the objects without dateofpublication to be up the top of the results list.
What appears to happen is that they're dropped from the results completely, which really strikes me as a bug.
==============================================================
More information about the Zope-Collector-Monitor
mailing list