: public static FunctionQuery parseFunction(String func, IndexSchema schema) : throws ParseException { : SolrCore core = SolrCore.getSolrCore(); : return (FunctionQuery)(QParser.getParser(func,"func",new : LocalSolrQueryRequest(core,new HashMap())).parse()); : // return new FunctionQuery(parseValSource(new StrParser(func), schema)); : }
Ugh. I don't think there's any easy way to fix that so it satisfies every imaginable usecase. The sanest thing to do would probably be to make parseFunction construct a local instance of FunctionQParser (with a null SolrQueryRequest) instead of using QParser.getParser(...). that should be fairly close to the way it worked in older versions (hmmm... except FunctionQParser does something similar to get a ValueSourceParser ... a new constructor for FunctionQParser that explicitly tells it to use ValueSourceParser.standardValueSourceParsers might be in order). I think it goes without saying that QueryParsing.parseFunction should be deprecated as well ... fortunately it's only used in a few places in the core code ... unfortunately those places also don't currently have access to a SolrQueryRequest at the moment: 1) SolrPluginUtils.parseFuncs -- should probably be deprecated, callers of it should start using the QParser APIs. 2) SolrQueryParser.getFieldQuery -- it's only used if the SolrQueryParser was constructed with an IndexSchema and not with a QParser (in which case it can ask the QParser for a subParser) .. the IndexSchema constructor should probably be deprecated as well (but i haven't dug in to see how far down the rabit hole that change would go) -Hoss