Resource Loading
Solr components can be configured using resources: data stored in external files that may be referred to in a location-independent fashion.
Examples of resources include: files needed by schema components, e.g., a stopword list for Stop Filter; and machine-learned models for Learning To Rank. Resources are typically resolved from the configSet but there are other options too.
Solr’s resources are generally only loaded initially when the Solr collection or Solr core is loaded. After you update a resource, you’ll typically need to reload the affected collections when running SolrCloud, or the cores when running a user-managed cluster or single-node installation. Restarting all affected Solr nodes also works. Managed Resources can be manipulated via APIs and do not need an explicit reload.
Resources in Configsets
Configsets are the directories containing solrconfig.xml
, the schema, and resources referenced by them.
In SolrCloud they are stored in ZooKeeper.
In a user-managed cluster and a single-node installation they are stored on the file system.
In any mode, resources may be shared or may be dedicated to a configSet.
Prefer to put resources here.
Resources in Other Places
Resources can also be placed in an arbitrary directory and referenced from a <lib />
directive in solrconfig.xml
, provided the directive refers to a directory and not the actual resource file.
Example: <lib path="/volume/models/" />
This choice may make sense if the resource is too large for a configset in ZooKeeper.
However it’s up to you to somehow ensure that all nodes in your cluster have access to these resources.
Finally, and this is very unusual, resources can also be packaged inside .jar
files from which they will be referenced.
That might make sense for default resources wherein a plugin user can override it via placing the same-named file in a configSet.