I got this working but had to make a custom package copy of
CurrencyFieldType.

I think the package instantiation is failing since after
CurrencyFieldType.inform(loader) the threadlocal variable is removed in
SolrResourceLoader, so class from SolrResourceLoader.getPackageClass is
skipped and null returned, and then pkg:class is not a valid class.

 The other way is to use <lib> in solrconfig instead of package manager and
can then use existing CurrencyFieldType


On Mon, 16 Jun 2025 at 16:37, Dan Rosher <rosh...@gmail.com> wrote:

> Hi All,Should package manager enable a custom providerClass for
> CurrencyFieldType ?I've added the custom jar with package manager like so:
>
> # upload jar with sig
> curl --data-binary @./lib/solr-mypkg-1.0-SNAPSHOT.jar -X PUT  
> 'http://localhost:8983/api/cluster/files/mypkg/1.0/mypkg.jar?sig=...'
>
> # register plugin
> curl  http://localhost:8983/api/cluster/package -H 
> 'Content-type:application/json' -d  ' {"add": { "package" : 
> "mypkg","version":"1.0", "files" :["/mypkg/1.0/mypkg.jar"]}}'
>
> But I get java.lang.ClassNotFoundException with either of these when I
> try to create a collection with a ClassicIndexSchemaFactory:
>
>   <fieldType name="custom_currency"
>              class="solr.CurrencyFieldType"
>              providerClass="mypkg:path.to.CustomExchangeRateProvider"
>              ratesFileLocation="http://internal.exchange"/>
>
>   <fieldType name="custom_currency"
>              class="solr.CurrencyFieldType"
>              providerClass="path.to.CustomExchangeRateProvider"
>              ratesFileLocation="http://internal.exchange"/>
>
> Maybe this only works with managed schema ? Which I'll try next, but we
> prefer to know the schema upfront and have that immutable.
>
> Thanks
> Dan
>
>

Reply via email to