diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2020-12-07 11:09:53 +0100 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2020-12-07 11:09:53 +0100 |
commit | f957ca208648110777327a19f7bfa6d901fb0d27 (patch) | |
tree | 32ddc769b49ad5d3eb4ac27ee227caa91697aa22 | |
parent | 2fb3a0e13e2379f997d48ce3121acd94fcf7fa5d (diff) |
Enable sorting in the command
-rw-r--r-- | lesana/command.py | 7 |
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: |