search: apply hoist-or heuristic for likely ambiguous queries
Created by: rvantonder
Stacked on #9760.
Deciding whether to play the or-heuristic depends on detecting whether a query contains explicit parentheses. All explicit parentheses are discarded by the time we finish parsing, so detecting explicit parentheses (and importantly, those that refer to expression groups and not patterns) can only happen during parsing.
This PR adds a signal in the parser state to indicate an observation of explicit parentheses, which drives application of the heuristic.
Up the stack: #9762.