public class ExternalFileFieldReloader extends AbstractSolrEventListener
ExternalFileField. By default, these caches are reloaded lazily
by the first search that uses them. For large external files, this can
slow down searches unacceptably.
To reload the caches when the searcher is first opened, set up event
listeners in your solrconfig.xml:
<listener event="newSearcher" class="org.apache.solr.schema.ExternalFileFieldReloader"/> <listener event="firstSearcher" class="org.apache.solr.schema.ExternalFileFieldReloader"/>The caches will be reloaded for all ExternalFileFields in your schema after each commit.
| Constructor and Description |
|---|
ExternalFileFieldReloader(SolrCore core) |
| Modifier and Type | Method and Description |
|---|---|
void |
cacheFieldSources(IndexSchema schema)
Caches FileFloatSource's from all ExternalFileField instances in the schema
|
void |
init(NamedList args) |
void |
newSearcher(SolrIndexSearcher newSearcher,
SolrIndexSearcher currentSearcher)
The searchers passed here are only guaranteed to be valid for the duration
of this method call, so care should be taken not to spawn threads or asynchronous
tasks with references to these searchers.
|
addEventParms, getArgs, getCore, postCommit, postSoftCommit, toStringpublic ExternalFileFieldReloader(SolrCore core)
public void init(NamedList args)
init in interface NamedListInitializedPlugininit in class AbstractSolrEventListenerpublic void newSearcher(SolrIndexSearcher newSearcher, SolrIndexSearcher currentSearcher)
SolrEventListener
Implementations should add the EventParams.EVENT parameter and set it to a value of either:
EventParams.FIRST_SEARCHER - First Searcher eventEventParams.NEW_SEARCHER - New Searcher event
if (currentSearcher != null) {
nlst.add(CommonParams.EVENT, CommonParams.NEW_SEARCHER);
} else {
nlst.add(CommonParams.EVENT, CommonParams.FIRST_SEARCHER);
}
newSearcher in interface SolrEventListenernewSearcher in class AbstractSolrEventListenernewSearcher - The new SolrIndexSearcher to usecurrentSearcher - The existing SolrIndexSearcher. null if this is a firstSearcher event.AbstractSolrEventListener.addEventParms(org.apache.solr.search.SolrIndexSearcher, org.apache.solr.common.util.NamedList)public void cacheFieldSources(IndexSchema schema)
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.