[Sugar-devel] [PATCH sugar-datastore v2 1/3] find(): fix sort order in ambiguous cases

Sascha Silbe silbe at activitycentral.com
Fri Feb 11 07:58:05 EST 2011


From: Sascha Silbe <sascha-pgp at silbe.org>

Consistent results are important for the test suite.

Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>
Signed-off-by: Sascha Silbe <silbe at activitycentral.com>
---
 src/carquinyol/indexstore.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/carquinyol/indexstore.py b/src/carquinyol/indexstore.py
index dc721e7..80a1ade 100644
--- a/src/carquinyol/indexstore.py
+++ b/src/carquinyol/indexstore.py
@@ -301,8 +301,10 @@ class IndexStore(object):
 
         if order_by == '+timestamp':
             enquire.set_sort_by_value(_VALUE_TIMESTAMP, True)
+            enquire.set_docid_order(False)
         elif order_by == '-timestamp':
             enquire.set_sort_by_value(_VALUE_TIMESTAMP, False)
+            enquire.set_docid_order(True)
         elif order_by == '+title':
             enquire.set_sort_by_value(_VALUE_TITLE, True)
         elif order_by == '-title':
@@ -317,6 +319,7 @@ class IndexStore(object):
             enquire.set_sort_by_value(_VALUE_CREATION_TIME, False)
         else:
             logging.warning('Unsupported property for sorting: %s', order_by)
+            order_by = '+timestamp'
 
         query_result = enquire.get_mset(offset, limit, check_at_least)
         total_count = query_result.get_matches_estimated()
-- 
1.7.2.3



More information about the Sugar-devel mailing list