search: track applied heuristics in and/or queries
Created by: rvantonder
I need to add information to the parser that tracks whether a heuristic was applied for a query. This information:
- can drive logic about how to interpret queries afterward in a cleaner way than alternatives (e.g., regex versus literal for when queries are quoted, see up the stack #11060)
- is useful for figuring out what queries to suggest, and how to rank these suggestions later
- great for "why?"-style debugging
Implementation detail
The same heuristics generally correspond to both an option (allowing the heuristic to run), and whether they were applied. So I've reorganized the types to reflect this and introduce two maps (sets) that record:
- (a) whether a heuristic option is set
- (b) whether a heuristic was applied--this is instrumented in the places where the heuristic fires.
I choose maps rather than structs because (a) I want to use the same type/label to identify heuristics since they correspond, and (b) I later want to iterate over the data structure of set heuristics, rather than inspect each possible field set in a struct. See inline comments for more.