Open mikemccand opened 5 years ago
I don't think this is the case? QueryVisitor is for arbitrary collection of information about a query tree, whereas rewrite is always query-specific.
[Legacy Jira: Alan Woodward (@romseygeek) on Jun 26 2019]
@romseygeek Agreed, however, we could use QueryVisitor's recursion mechanism to get query specific rewrites done (please see my PR to add metadata state to QueryVisitor). We could add a boolean property saying DO_REWRITE=true and fire a visitor, and each query checks for that property.
My main point is that it seems incorrect for two query tree traversal mechanisms to exist independently. This Jira is primarily opened to trade thoughts on that front, and maybe see if we can draw a common baseline between the two existing mechanisms. WDYT?
[Legacy Jira: Atri Sharma (@atris) on Jun 27 2019]
Now that we have QueryVisitor, the rewrite functionality should belong there, since rewrite is essentially a recursive visitation of underlying queries, which sounds exactly as what QueryVisitor is designed to be.
Legacy Jira details
LUCENE-8881 by Atri Sharma (@atris) on Jun 25 2019, updated Jun 27 2019