-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
-contains doesn't accept multiple search terms, doesn't work with -and #1877
Comments
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:
It's not particularly well-documented, but I would expect the same behavior without the Repro steps:
Expected only the last entry, not the first. OR, if we expect an "or" behavior without |
…added (#1890) * Store multiple -contains arguments (OR default). Allow multiple occurrences of the -contains argument to be stored in a list. Previously, only the last occurrence was considered. Additionally, the behavior has been modified to default to OR logic, meaning that if multiple -contains arguments are provided, entries matching any of them will be included in the results. * Solved issue #1877 "-and" flag with multiple instances of the -contains option. * Run poe format * Fix unit test for contains to allow list instead of single value * Add BDD tests for multiple contains with and without -and * Black version updated. * Revert pyproject.toml to appease poetry --------- Co-authored-by: Micah Jerome Ellison <[email protected]>
Documenting the fix here for now: with #1890 merged in, |
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
The text was updated successfully, but these errors were encountered: