jrnl-org / jrnl

Collect your thoughts and notes without leaving the command line.
https://jrnl.sh
GNU General Public License v3.0
6.45k stars 522 forks source link

DayOne journal tag search fails for tags that don't use the first symbol in the config's tagsymbols #1658

Open micahellison opened 1 year ago

micahellison commented 1 year ago

Diagnostic output

jrnl: v3.3
Python: 3.11.1 (tags/v3.11.1:a7a450f, Dec  6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)]
OS: Windows 10

Current Behavior

Only the first character of the tagsymbols value in the config file is used when searching for tags in DayOne journals. Other journal types are fine.

Expected Behavior

Any tag starting with any tag symbol should be searchable in a DayOne jounal.

Repro Steps

With my DayOne test journal "dayone", I should be able to run the following:

jrnl dayone Here is a new entry with a @tag

Then, after running this, I should see that entry:

jrnl dayone @tag

Debug output

DEBUG    root         Parsed args: Namespace(debug=True, preconfig_cmd=None, postconfig_cmd=None, filename=None, on_date=None, today_in_history=False, month=None, day=None, year=None, start_date=None, end_date=None, contains=None, strict=False, starred=False, limit=None, excluded=[], edit=False, delete=False, change_time=None, export=False, tags=False, short=False, config_override=[], config_file_path='', text=['dayone', '@tag'])
DEBUG    root         Reading configuration from file C:\Users\micah\.config\jrnl\jrnl.yaml
DEBUG    root         Using configuration "{'colors': {'body': 'none', 'date': 'none', 'tags': 'none', 'title': 'none'}, 'default_hour': 9, 'default_minute': 0, 'editor': 'subl -w', 'encrypt': False, 'highlight': True, 'indent_character': '|', 'journals': ********************************** 'dayone': {'journal': 'C:\\Users\\micah\\Documents\\jrnl\\testing\\dayone.dayone'}}, 'linewrap': 79, 'tagsymbols': '#@', 'template': False, 'timeformat': '%F %r', 'version': 'v3.3'}"
DEBUG    root         Using journal name: dayone
DEBUG    root         Updating configuration with specific journal overrides {'journal': 'C:\\Users\\micah\\Documents\\jrnl\\testing\\dayone.dayone'}
┌────────────────────┐
│  no entries found  │
└────────────────────┘

Other Information

In DayOneJournal.py, the faulty line is:

self.config["tagsymbols"][0] + tag.lower()

That [0] is grabbing the first of the tagsymbols and ignoring the rest.

micahellison commented 1 year ago

I think this is ready for a PR if anyone is interested. A resolution should also include a test for each tag symbol. It wouldn't hurt for that test to run on all journal types.