From b603f340b26c57bb93f35188036e474cc87a5a3b Mon Sep 17 00:00:00 2001 From: Benjamin Saller Date: Sun, 07 Oct 2007 17:12:13 +0000 Subject: orderby fix, allow [] -m to datastore-service will mount default repo allowing simple command line testing again --- diff --git a/bin/datastore-service b/bin/datastore-service index 8bf5fdc..758ca45 100755 --- a/bin/datastore-service +++ b/bin/datastore-service @@ -79,6 +79,12 @@ def main(): # really awful import time context = mainloop.get_context() + + if '-m' in sys.argv: + # mount automatically for local testing + ds.mount(repo_dir) + ds.complete_indexing() + try: while connected: context.iteration(False) diff --git a/src/olpc/datastore/xapianindex.py b/src/olpc/datastore/xapianindex.py index cc02b0a..8a5970f 100644 --- a/src/olpc/datastore/xapianindex.py +++ b/src/olpc/datastore/xapianindex.py @@ -414,10 +414,11 @@ class IndexManager(object): else: q = self.parse_query(query) - if order_by and isinstance(order_by, list): + if isinstance(order_by, (list, tuple)): # secore only handles a single item, not a multilayer sort - order_by = order_by[0] - + if order_by: order_by = order_by[0] + else: order_by = None + results = ri.search(q, start_index, end_index, sortby=order_by) count = results.matches_estimated -- cgit v0.9.1