From 342a350c97a9457b13c3365ac35134e36e11d4e0 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 2 Oct 2023 21:58:38 +0200 Subject: [PATCH] papis: Regress to textual priority entry HACK Since there is some weirdness with the whoosh backend for papis not being able to either index or search for integer values in custom fields, this commit sets the priorities across the library (as well as the tui picker) to make use of textual reprentations. 1 -> high 3 -> medium 5 -> low This means we can't do simple arithmetic evaluations on priority anymore but at least we can search it correctly in papis. Should probably put in a ticket to see if it can be fixed. --- writing/.config/papis/config | 4 ++-- writing/.config/papis/papistui.yaml | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/writing/.config/papis/config b/writing/.config/papis/config index 01e93ca..2ef2eb3 100644 --- a/writing/.config/papis/config +++ b/writing/.config/papis/config @@ -15,10 +15,10 @@ ref-format = bbt add-folder-name = {doc[author_list][0][family]}-{doc[title]} add-file-name = {doc[author_list][0][family]}{doc[year]} header-format-file = ~/.config/papis/headerformat -extra-bibtex-keys = ["tags", "readstatus"] +extra-bibtex-keys = ["tags", "readstatus", "priority"] database-backend = whoosh -whoosh-schema-fields = ["doi", "ref", "author", "year", "title", "publisher", "tags", "readstatus", "date", "isbn", "type", "keyword", "qualityassured"] +whoosh-schema-fields = ["doi", "ref", "author", "year", "title", "publisher", "tags", "readstatus", "date", "isbn", "type", "keyword", "qualityassured", "priority"] # to make whoosh list everything by default default-query-string = * diff --git a/writing/.config/papis/papistui.yaml b/writing/.config/papis/papistui.yaml index da07300..965d94c 100644 --- a/writing/.config/papis/papistui.yaml +++ b/writing/.config/papis/papistui.yaml @@ -8,6 +8,8 @@ # - [ ] select all in view # - [ ] limit view to currently selected # +# for papis itself: +# - [ ] I can not search custom numeric fields in whoosh? i.e. 'priority:1' will not give results. 'priority:high' will base: vimflavour: nvim documentlist: @@ -16,7 +18,7 @@ documentlist: multilinestyle: rows: # TODO: show if already note attached; have info window display note content? - - "{' ' if 'priority' not in doc or doc['priority'] > 3 else '󱝇 ' if doc['priority'] <= 1 else '󱝇 '}{doc.alias('type')} {doc['ref']} {doc.alias('readstatus')} {' 󰘓 ' if doc['notes'] else ''}" + - "{' ' if 'priority' not in doc or doc['priority'] == 'low' else '󱝇 ' if doc['priority'] == 'high' else '󱝇 '}{doc.alias('type')} {doc['ref']} {doc.alias('readstatus')} {' 󰘓 ' if doc['notes'] else ''}" - "{doc.html_escape['title']}" - "{doc.html_escape['author']}" - "{doc.foreach('tags', '({})', split = ', ', sep = ' ')}" @@ -28,7 +30,7 @@ documentlist: columns: - { header: "󱝇", - content: "{'' if 'priority' not in doc or doc['priority'] > 3 else '󰝥' if doc['priority'] <= 1 else '󰝦'}", + content: "{'' if 'priority' not in doc or doc['priority'] == 'low' else '󰝥' if doc['priority'] == 'high' else '󰝦'}", width: 1, } - { @@ -92,7 +94,7 @@ keymappings: o: open -r "pdf$" O: open -d b: browse - B: browse -k doi + B: papis browse -k doi papis_id:{doc['papis_id']} R: view_reset : reload e: @@ -127,13 +129,13 @@ keymappings: - papis update -s readstatus "" papis_id:{doc['papis_id']} - set readstatus unread ",ph": - - papis update -s priority 1 papis_id:{doc['papis_id']} + - papis update -s priority high papis_id:{doc['papis_id']} - set priority high ",pm": - - papis update -s priority 2 read papis_id:{doc['papis_id']} + - papis update -s priority medium read papis_id:{doc['papis_id']} - set priority medium ",pl": - - papis update -s priority 3 read papis_id:{doc['papis_id']} + - papis update -s priority low read papis_id:{doc['papis_id']} - set priority low i: - info_toggle