Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-and flag with -contains #1877

Open
rcrx opened this issue Mar 26, 2024 · 1 comment
Open

-and flag with -contains #1877

rcrx opened this issue Mar 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@rcrx
Copy link

rcrx commented Mar 26, 2024

Diagnostic output

jrnl: v3.3
Python: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
OS: Linux 5.15.0-101-generic

Current Behavior

Using the -and flag with multiple instances of -contains only displays entries containing the second term, not both as expected. For instance jrnl -contains "term 1" -and -contains "term 2" gives results containing term 2 not term 1 and term 2.

Expected Behavior

What I would like to do is search for multiple words contained in the same entries.

Repro Steps

Search for contents with multiple instances of the -contains flag along with the -and flag.

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=[])
DEBUG root Reading configuration from file /home/allen/.config/jrnl/jrnl.yaml
DEBUG root Using configuration "{'colors': {'body': 'none', 'date': 'blue', 'tags': 'green', 'title': 'yellow'}, 'default_hour': 12, 'default_minute': 0, 'editor': 'gvim -f', 'encrypt': False, 'highlight': True, 'indent_character': '|', 'journals': {'default': {'encrypt': False, 'journal': '/home/allen/Documents/journal.md'}, 's': '/home/allen/Documents/notes/snippets/snip.txt'}, 'linewrap': 75, 'tagsymbols': '#@', 'template': False, 'timeformat': '%F %r', 'version': 'v3.3'}"
DEBUG root Using journal name: default
DEBUG root Updating configuration with specific journal overrides {'encrypt': False, 'journal': '/home/allen/Documents/journal.md'}
DEBUG root opened PlainJournal with 188 entries
DEBUG root Write mode: starting
DEBUG root Write mode: opening editor
DEBUG root Write mode: loading template for entry
DEBUG root Write mode: no template configured

Other Information

No response

@rcrx rcrx added 🆕 New! bug Something isn't working labels Mar 26, 2024
@micahellison
Copy link
Member

micahellison commented May 8, 2024

Thanks for filing this, @rcrx. I believe we have a similar bug filed, but I can't seem to find it. Searching for "-and" in GitHub is rather difficult.

I reproduced this bug with the latest version of jrnl:

jrnl: v4.1
Python: 3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]
OS: Windows 10

It's not particularly well-documented, but I would expect the same behavior without the -and flag, and that is also not showing up right.

Repro steps:

>jrnl foo
>jrnl bar
>jrnl foo bar

>jrnl -contains foo -contains bar
┏━━━━━━━━━━━━━━━━━━━┓
┃  2 entries found  ┃
┗━━━━━━━━━━━━━━━━━━━┛
2024-05-07 06:05:28 PM bar

2024-05-07 06:05:29 PM foo bar

Expected only the last entry, not the first.

OR, if we expect an "or" behavior without -and, then we should see all three entries. I'm happy to open that to discussion. Either way, the current behavior isn't expected.

@micahellison micahellison removed the 🆕 New! label May 8, 2024
eigenric added a commit to eigenric/jrnl that referenced this issue May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants