I'm really confused by your question -- you start off asking about AbstractSolrEventListener and the newSearcher event, but then when you show us your solrconfig.xml & plugin snippet you are showing us a usage of ValueSourceParser -- which doesn't exitend AbstractSolrEventListener -- and your question seems to be about ValueSourceParser.init() being called w/o the arguments you expect.
Can you explain in more depth what it is you are doing and what you expect to happen? (Can you show us your full config + "working" unit test so we can understand what you _expect_ to happen in solr) Generally speaking: Solr only fires "newSearcher" events for plugins that are registered as "newSearcher listeners" in solrconfig.xml, something like this... <listener event="newSearcher" class="solr.QuerySenderListener"> <arr name="queries"> <lst><str name="q">solr</str><str name="sort">price asc</str></lst> <lst><str name="q">rocks</str><str name="sort">weight asc</str></lst> </arr> </listener> ...a custom ValueSourceParser registered via <valueSourceParser ... /> is completely ignorant of any newSearcher events -- it will be init()ed once during SolrCore init -- and should recieve the args specified in solrconfig.xml -- and the parse() will be called each time it is needed. If you need information about the SolrIndexSearcher at parse time, you can get it from the FunctionQParser (argument) via getReq().getSearcher() : Date: Tue, 16 Apr 2024 12:11:41 +0200 : From: elisabeth benoit <elisaelisael...@gmail.com> : Reply-To: users@solr.apache.org : To: users@solr.apache.org : Subject: solr 9.2.1 plugin newSearcher function not called : : Hello, : : We have a solr plugin with parameters in solrconfig.xml. : : In the plugin, we use the newSearcher function of a class overriding : : AbstractSolrEventListener : : to read parameters written in solrconfig.xml. : : The plugin is working fine but the plugin function newSearcher is not : called, so we cant read the parameters. : : In unit test it's working, but not at runtime, I cant understand why. : : I've tried another solution that I found in an example in solr source code : : in solrconfig.xml in solr source code : <valueSourceParser name="nvl" class= : "org.apache.solr.search.function.NvlValueSourceParser"> : <float name="nvlFloatValue">0.0</float> : </valueSourceParser> : <initParams path="/select"> : <lst name="defaults"> : <str name="df">text</str> : </lst> : </initParams> : : : reading the values in solr source code : : public class NvlValueSourceParser extends ValueSourceParser { : : /** Value to consider "null" when found in a ValueSource Defaults to 0.0 */ : private float nvlFloatValue = 0.0f; : : : @Override : public void init(NamedList<?> args) { : /* initialize the value to consider as null */ : Float nvlFloatValueArg = (Float) args.get("nvlFloatValue"); : if (nvlFloatValueArg != null) { : this.nvlFloatValue = nvlFloatValueArg; : } : } : } : : when I do the same in my plugin code, when (in unit tests) code enters init : function, args is empty. : : Any help would be welcome! : : Best regards, : Elisabeth : -Hoss http://www.lucidworks.com/