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 (SolrCloud) or the cores (standalone Solr). 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 in ZooKeeper whereas in standalone they are on the file system. In either mode, configSets might be shared or might 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.