[ https://issues.apache.org/jira/browse/SOLR-17477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17886947#comment-17886947 ]
Tim Owen commented on SOLR-17477: --------------------------------- The way I connect this into Solr is firstly changing my solrconfig.xml to declare the custom ValueSourceParser class {{<valueSourceParser name="agg_myagg" class="com.mycompany.solr.MyAggValueSourceParser" />}} And that class contains a static initialiser which registers itself with the code change I made to FacetParser: {{public class MyAggValueSourceParser extends ValueSourceParser {}} {{ static {}} {{ FacetParser.ParseHandler handler = (p, k, a) -> parseStructure(a);}} {{ FacetParser.registerParseHandler("myagg", handler);}} {{ }}} {{ @Override}} {{ public ValueSource parse(FunctionQParser fp) throws SyntaxError { ...}} {{{} public static AggValueSource parseStructure(Object arg){}}}{{{}{ ... {}}}{{}} > Allow plugin code to define custom aggregates > --------------------------------------------- > > Key: SOLR-17477 > URL: https://issues.apache.org/jira/browse/SOLR-17477 > Project: Solr > Issue Type: Improvement > Security Level: Public(Default Security Level. Issues are Public) > Components: Facet Module, Plugin system > Reporter: Tim Owen > Priority: Major > > Continuing the work done in SOLR-8673 and also addressing a TODO in the code, > I've worked on making it easier for custom plugin code to define aggregates > to be used in Json Faceting. > Currently you can mostly define a custom ValueSourceParser and AggValueSource > in plugin code (i.e. outside of the {{org.apache.solr.search.facet}} package) > but there are still some classes and fields that are not public or protected > which make it hard to write a sortable aggregate or use some of the useful > built-in SlotAcc implementations. > Another current limitation is that you can only call a custom aggregate by > using the simple functional style syntax e.g. > {{"mycalc":"myagg(somefield,2)"}} and not the json structured style e.g. it > would be good to be able to support "mycalc":{ type:myagg, f:somefield, > limit:2 } > instead. There is a TODO in the code to support the registration of these > types. > PR addresses these and has been tested using a custom plugin to check it all > works together. This allowed us to move a lot of our custom code out of our > local Solr build and into a plugin. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org