@@ -95,6 +95,17 @@ func parseResponse(responses []*es.SearchResponse, targets []*Query, configuredF
9595 return & result , nil
9696}
9797
98+ func isLuceneOperator (value string ) bool {
99+ operators := []string {"or" , "and" }
100+ for _ , op := range operators {
101+ if strings .ToLower (value ) == op {
102+ return true
103+ }
104+ }
105+
106+ return false
107+ }
108+
98109func parseLuceneQuery (query string ) []string {
99110 var keywords []string
100111
@@ -109,12 +120,20 @@ func parseLuceneQuery(query string) []string {
109120
110121 keyValueMatches := keyValueRegex .FindStringSubmatch (termMatch )
111122 if len (keyValueMatches ) <= 1 {
112- keywords = append (keywords , strings .ReplaceAll (termMatch , "*" , "" ))
123+ value := strings .ReplaceAll (termMatch , "*" , "" )
124+ if isLuceneOperator (value ) {
125+ continue
126+ }
127+ keywords = append (keywords , value )
113128 continue
114129 }
115130
116131 for _ , keyValueMatch := range keyValueMatches [1 :] {
117- keywords = append (keywords , strings .ReplaceAll (keyValueMatch , "*" , "" ))
132+ value := strings .ReplaceAll (keyValueMatch , "*" , "" )
133+ if isLuceneOperator (value ) {
134+ continue
135+ }
136+ keywords = append (keywords , value )
118137 }
119138 }
120139
0 commit comments