You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by elisabeth benoit <el...@gmail.com> on 2024/04/16 10:08:51 UTC

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