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

Sascha Silbe sascha-pgp at silbe.org
Wed Jan 19 15:38:30 EST 2011


Consistent results are important for the test suite.

Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>

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