Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Silbe <sascha@silbe.org>2010-01-12 14:50:57 (GMT)
committer Sascha Silbe <sascha@silbe.org>2010-01-12 14:50:57 (GMT)
commit4913ddb0555775c5a4ba316207ea9c036d60c7c7 (patch)
treed1ca4e94c26ed5c73a2b21114dd4cd64f062a3d8
parent34d07f91c26e583f8975c23bbc87ab090418c32f (diff)
fix sort order in ambiguous cases, fix obscure test suite breakage due to overlapping timestamp values
-rw-r--r--src/carquinyol/indexstore.py3
-rw-r--r--tests/test_massops.py3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/carquinyol/indexstore.py b/src/carquinyol/indexstore.py
index 4dfd620..bc4ce21 100644
--- a/src/carquinyol/indexstore.py
+++ b/src/carquinyol/indexstore.py
@@ -274,14 +274,17 @@ 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':
enquire.set_sort_by_value(_VALUE_TITLE, 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()
diff --git a/tests/test_massops.py b/tests/test_massops.py
index 6739e74..234487d 100644
--- a/tests/test_massops.py
+++ b/tests/test_massops.py
@@ -46,14 +46,13 @@ class MassOpsTestCase(unittest.TestCase):
def test_create(self):
"""Run save() lots of times to create new objects."""
- timestamp = time.time()
for i in range(NUM_RUNS):
content_file = tempfile.NamedTemporaryFile()
content_file.write(self._create_content)
content_file.flush()
properties = self._create_properties.copy()
properties['number'] = str(i)
- properties['timestamp'] = timestamp+i
+ properties['timestamp'] = time.time()
self._datastore.create(properties, content_file.name, False)
content_file.close()