Query parser does not apply case to Not tokens
keegancsmith opened this issue · comments
I was playing around with the query parser and noticed this inconsistency. When you specify case:yes
, it applies to all the query.Q
. But that doesn't seem to apply to a not query. Concretely
query.Parse(`content:foo case:yes f:\.go$ f:\.yaml$ -f:\bvendor\b`)
got (and case_content_substr:"foo" case_file_regex:"\\.go(?m:$)" case_file_regex:"\\.yaml(?m:$)" (not file_regex:"\\bvendor\\b"))
want (and case_content_substr:"foo" case_file_regex:"\\.go(?m:$)" case_file_regex:"\\.yaml(?m:$)" (not case_file_regex:"\\bvendor\\b"))
is this expected behaviour when being explicit about case?
good question! I don't know :)
the query language was modeled on google's internal code search, and I don't know what that does.
I guess it is reasonable that the case operator, when encountered in a conjuction, recursively applies to the conjunction's subexpressions.
Would you be interested in a patch to change the behaviour?
yes!