diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2017-08-11 00:07:18 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2017-08-11 00:07:18 +0900 |
commit | a09e411936244aa515519134dbbd938ae3cadcd4 (patch) | |
tree | 714ab2fdcd3c37adeb90c5e1bf9484f7aa5b7ded /src/pattern.go | |
parent | 02a7b96f33036192abb5816b5860e546e6b4e64e (diff) |
Treat | as proper query when it can't be an OR operator
Diffstat (limited to 'src/pattern.go')
-rw-r--r-- | src/pattern.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pattern.go b/src/pattern.go index 8029fd0c..dbb3983f 100644 --- a/src/pattern.go +++ b/src/pattern.go @@ -152,6 +152,7 @@ func parseTerms(fuzzy bool, caseMode Case, normalize bool, str string) []termSet sets := []termSet{} set := termSet{} switchSet := false + afterBar := false for _, token := range tokens { typ, inv, text := termFuzzy, false, strings.Replace(token, "\t", " ", -1) lowerText := strings.ToLower(text) @@ -164,10 +165,12 @@ func parseTerms(fuzzy bool, caseMode Case, normalize bool, str string) []termSet typ = termExact } - if text == "|" { + if len(set) > 0 && !afterBar && text == "|" { switchSet = false + afterBar = true continue } + afterBar = false if strings.HasPrefix(text, "!") { inv = true |