Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Saller <bcsaller@objectrealms.net>2007-10-07 17:12:13 (GMT)
committer Benjamin Saller <bcsaller@objectrealms.net>2007-10-07 17:12:13 (GMT)
commitb603f340b26c57bb93f35188036e474cc87a5a3b (patch)
tree9eddba1b56c63defb6418aef4a425155db2b88b4
parentf6d8c721121bc3e4546540cd35b3d0d3703a97dc (diff)
orderby fix, allow []
-m to datastore-service will mount default repo allowing simple command line testing again
-rwxr-xr-xbin/datastore-service6
-rw-r--r--src/olpc/datastore/xapianindex.py7
2 files changed, 10 insertions, 3 deletions
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