search: remove parse tree reference in query type
Created by: rvantonder
The main change is that the ParseTree
reference is removed from our current Query
type:
type Query struct {
- ParseTree syntax.ParseTree // the query parse tree
Fields map[string][]*Value // map of field name -> values
}
The motivation is that we should keep this Query
type, which represents a parsed and validated query, pure. References to the parse tree should be bundled in other types, or kept around by the process that needs it, instead of dragging it along everywhere query is referenced.
For our search functionality, we still need a reference to the parse tree for other reasons. For now, I'm returning the parse tree from query.Process(...)
and keeping the reference in the resolver. In time, it may make sense to have a dedicated type. The most important thing right now is just that we don't reference the parse tree inside this query type, but rather with or alongside it, as needed.