mikemccand / stargazers-migration-test

Testing Lucene's Jira -> GitHub issues migration
0 stars 0 forks source link

Query.rewrite Should Move To QueryVisitor [LUCENE-8881] #878

Open mikemccand opened 5 years ago

mikemccand commented 5 years ago

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

mikemccand commented 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]

mikemccand commented 5 years ago

@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]