From f957ca208648110777327a19f7bfa6d901fb0d27 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Mon, 7 Dec 2020 11:09:53 +0100 Subject: Enable sorting in the command --- lesana/command.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lesana/command.py b/lesana/command.py index 85ed73b..31a452b 100644 --- a/lesana/command.py +++ b/lesana/command.py @@ -252,6 +252,10 @@ class Search(Command): ['--all'], 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: -- cgit v1.2.3