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.
This commit is contained in:
Marty Oehme 2023-10-02 21:58:38 +02:00
parent 3f335936c5
commit 342a350c97
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
2 changed files with 10 additions and 8 deletions

View file

@ -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 = *

View file

@ -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 '<red>󱝇 </red>' if doc['priority'] <= 1 else '<yellow>󱝇 </yellow>'}<cyan>{doc.alias('type')} {doc['ref']}</cyan> {doc.alias('readstatus')} {' 󰘓 ' if doc['notes'] else ''}"
- "{' ' if 'priority' not in doc or doc['priority'] == 'low' else '<red>󱝇 </red>' if doc['priority'] == 'high' else '<yellow>󱝇 </yellow>'}<cyan>{doc.alias('type')} {doc['ref']}</cyan> {doc.alias('readstatus')} {' 󰘓 ' if doc['notes'] else ''}"
- "<white><bold>{doc.html_escape['title']}</bold></white>"
- "<blue>{doc.html_escape['author']}</blue>"
- "{doc.foreach('tags', '<lightgray>(</lightgray><gray><dim>{}</dim></gray><lightgray>)</lightgray>', 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
<c-r>: 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