notmuch: allow empty searches

Don't error on empty search terms, just don't filter
by anything and return all items matching the current querymap
This commit is contained in:
Kalyan Sriram 2021-11-13 06:31:16 +00:00 committed by Robin Jarry
parent dc2a2c2dfd
commit d7bda10f3e

View file

@ -435,7 +435,10 @@ func (w *worker) handleSearchDirectory(msg *types.SearchDirectory) error {
// the first item is the command (search / filter) // the first item is the command (search / filter)
s := strings.Join(msg.Argv[1:], " ") s := strings.Join(msg.Argv[1:], " ")
// we only want to search in the current query, so merge the two together // we only want to search in the current query, so merge the two together
search := fmt.Sprintf("(%v) and (%v)", w.query, s) search := w.query
if s != "" {
search = fmt.Sprintf("(%v) and (%v)", w.query, s)
}
uids, err := w.uidsFromQuery(search) uids, err := w.uidsFromQuery(search)
if err != nil { if err != nil {
return err return err