timatbw commented on PR #2742: URL: https://github.com/apache/solr/pull/2742#issuecomment-2441360783
I've just realised the registration part of this work is not necessary! All that's really needed is the public modifier changes. I'm going to simplify the PR down to just that bit. The reason the registration isn't needed is because you can already achieve the desired results using the existing mechanism `type:func` which lets you access the structured json args via local params. So a ValueSourceParser you might have in your plugin code can be configured this way by pulling values from the local params accessible in the `FunctionQParser` object, instead of positional arguments. All you do is declare your json facet like so ``` { mycalculation:{ type:func, func:myaggregate, myfield:something, mylimit:2 } } ``` then all those key-value params are available inside your implementation of `ValueSourceParser` ``` @Override public ValueSource parse(FunctionQParser fp) throws SyntaxError { if (fp.getLocalParams() != null) { String fieldName = fp.getLocalParams().get("myfield"); Integer limit = fp.getLocalParams().getInt("mylimit"); return new MyAgg(fieldName, limit); } else { return new MyAgg(fp.parseArg(), fp.parseArg()); } } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org