aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lesana/command.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/lesana/command.py b/lesana/command.py
index 85ed73b..31a452b 100644
--- a/lesana/command.py
+++ b/lesana/command.py
@@ -253,6 +253,10 @@ class Search(Command):
dict(action='store_true', help='Return all available results'),
),
(
+ ['--sort'],
+ dict(action='append', help='Sort results by a sortable field'),
+ ),
+ (
['query'],
dict(help='Xapian query to search in the collection', nargs='+'),
),
@@ -276,7 +280,8 @@ class Search(Command):
if self.args.query == ['*']:
results = collection.get_all_documents()
else:
- collection.start_search(' '.join(self.args.query))
+ collection.start_search(' '.join(self.args.query),
+ sort_by=self.args.sort)
if self.args.all:
results = collection.get_all_search_results()
else: