blob: 98af2269ee2dafad021cf6892123b42de602fd07 [file] [log] [blame]
= Resource Loading
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
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 <<filter-descriptions.adoc#stop-filter,Stop Filter>>; and machine-learned models for <<learning-to-rank.adoc#,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.adoc#,Managed resources>> can be manipulated via APIs and do not need an explicit reload.
== Resources in Configsets
<<config-sets.adoc#,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 <<libs.adoc#lib-directives-in-solrconfig,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.