Mix complex and simple queries
- Dominant language
- Elm
- Stars
- 2.3k
- Forks
- 184
- Avg merge
- 8h 2m
- Merged PRs (30d)
- 4
Description
Somewhat related to #2324, this feature request is also about the usability of the search box. At the moment, Docspell either has you in "simple" query mode, and you can choose in the UI whether to search file names, or full-text. Or you enable "advanced" query mode, and now you must provide properly-formatted queries using the complex query syntax. You can now type `name:*foo*` for filename searching, and `content:*bar*` for full-text searches. You can even combine the two, and it's unclear on whether the result sorting will be chronological, or by relevance.
The advanced search is probably not suitable for most normal users, who will be thrown off by the tooltip, which is helpful to those knowing what they're doing, but probably more than anything confusing to everyone else:

I look to [notmuch](https://notmuchmail.org) and their queries (using Xapian), which I find very intuitive, and I wonder whether Docspell couldn't/shouldn't evolve more in this direction, with the goal being that complex queries can be turned off by default, but most users won't end up using them, because simple queries work just the same.
The syntax/logic could be: if it's just a word, then look for it in a set of pre-defined fields, e.g. content and name. But as soon as a special character like `:` or `>` appears in a word, it limits the search to the field, just like complex queries do right now. So if you type, e.g.: `invoice date>2023-01-01 !tag=paid` it gives you all unpaid invoices of 2023 because they contain the string "invoice" in either the filename or the full-text index.
Searches should be case-insensitive, unless maybe the input contains a capital letter (like Vim does it), and unlike notmuch, I think that substring searching should be the default, rather than expecting the user to include the asterisk, e.g. `Rechnung*` to get "Rechnung" and "Rechnungen".
Contributor guide
Assessment
This issue has not been assessed yet.