Package org.alfresco.solr.component
Class AsyncBuildSuggestComponent
- java.lang.Object
-
- org.apache.solr.handler.component.SearchComponent
-
- org.alfresco.solr.component.AsyncBuildSuggestComponent
-
- All Implemented Interfaces:
org.apache.lucene.util.Accountable,org.apache.solr.core.SolrInfoMBean,org.apache.solr.spelling.suggest.SuggesterParams,org.apache.solr.util.plugin.NamedListInitializedPlugin,org.apache.solr.util.plugin.SolrCoreAware
public class AsyncBuildSuggestComponent extends org.apache.solr.handler.component.SearchComponent implements org.apache.solr.util.plugin.SolrCoreAware, org.apache.solr.spelling.suggest.SuggesterParams, org.apache.lucene.util.AccountableOriginally taken fromSuggestComponentand modified, this class provides aSearchComponentthat buildsSolrSuggesterobjects asynchronously to avoid blocking search requests or increasing startup time of the servlet container.- See Also:
SuggestComponent
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOMPONENT_NAMEName used to identify whether the user query concerns this componentprotected org.apache.solr.common.util.NamedListinitParamsprotected java.util.Map<java.lang.String,org.alfresco.solr.component.AsyncBuildSuggestComponent.SuggesterCache>suggestersKey is the dictionary name used in SolrConfig, value is the correspondingSolrSuggesterprotected static TempFileWarningLoggertempFileWarningLogger
-
Constructor Summary
Constructors Constructor Description AsyncBuildSuggestComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdistributedProcess(org.apache.solr.handler.component.ResponseBuilder rb)Dispatch shard request inSTAGE_EXECUTE_QUERYstagevoidfinishStage(org.apache.solr.handler.component.ResponseBuilder rb)Used in Distributed Search, merges the suggestion results from every shardjava.util.Collection<org.apache.lucene.util.Accountable>getChildResources()java.lang.StringgetDescription()java.lang.StringgetSource()org.apache.solr.common.util.NamedList<java.lang.String>getStatistics()voidinform(org.apache.solr.core.SolrCore core)voidinit(org.apache.solr.common.util.NamedList args)voidprepare(org.apache.solr.handler.component.ResponseBuilder rb)Responsible for issuing build and rebload command to the specifiedSolrSuggestervoidprocess(org.apache.solr.handler.component.ResponseBuilder rb)Responsible for using the specified suggester to get the suggestions for the query and write the resultslongramBytesUsed()
-
-
-
Field Detail
-
COMPONENT_NAME
public static final java.lang.String COMPONENT_NAME
Name used to identify whether the user query concerns this component- See Also:
- Constant Field Values
-
tempFileWarningLogger
protected static TempFileWarningLogger tempFileWarningLogger
-
initParams
protected org.apache.solr.common.util.NamedList initParams
-
suggesters
protected java.util.Map<java.lang.String,org.alfresco.solr.component.AsyncBuildSuggestComponent.SuggesterCache> suggesters
Key is the dictionary name used in SolrConfig, value is the correspondingSolrSuggester
-
-
Method Detail
-
init
public void init(org.apache.solr.common.util.NamedList args)
- Specified by:
initin interfaceorg.apache.solr.util.plugin.NamedListInitializedPlugin- Overrides:
initin classorg.apache.solr.handler.component.SearchComponent
-
inform
public void inform(org.apache.solr.core.SolrCore core)
- Specified by:
informin interfaceorg.apache.solr.util.plugin.SolrCoreAware
-
prepare
public void prepare(org.apache.solr.handler.component.ResponseBuilder rb) throws java.io.IOExceptionResponsible for issuing build and rebload command to the specifiedSolrSuggester- Specified by:
preparein classorg.apache.solr.handler.component.SearchComponent- Throws:
java.io.IOException
-
distributedProcess
public int distributedProcess(org.apache.solr.handler.component.ResponseBuilder rb)
Dispatch shard request inSTAGE_EXECUTE_QUERYstage- Overrides:
distributedProcessin classorg.apache.solr.handler.component.SearchComponent
-
process
public void process(org.apache.solr.handler.component.ResponseBuilder rb) throws java.io.IOExceptionResponsible for using the specified suggester to get the suggestions for the query and write the results- Specified by:
processin classorg.apache.solr.handler.component.SearchComponent- Throws:
java.io.IOException
-
finishStage
public void finishStage(org.apache.solr.handler.component.ResponseBuilder rb)
Used in Distributed Search, merges the suggestion results from every shard- Overrides:
finishStagein classorg.apache.solr.handler.component.SearchComponent
-
getDescription
public java.lang.String getDescription()
- Specified by:
getDescriptionin interfaceorg.apache.solr.core.SolrInfoMBean- Specified by:
getDescriptionin classorg.apache.solr.handler.component.SearchComponent
-
getSource
public java.lang.String getSource()
- Specified by:
getSourcein interfaceorg.apache.solr.core.SolrInfoMBean- Overrides:
getSourcein classorg.apache.solr.handler.component.SearchComponent
-
getStatistics
public org.apache.solr.common.util.NamedList<java.lang.String> getStatistics()
- Specified by:
getStatisticsin interfaceorg.apache.solr.core.SolrInfoMBean- Overrides:
getStatisticsin classorg.apache.solr.handler.component.SearchComponent
-
ramBytesUsed
public long ramBytesUsed()
- Specified by:
ramBytesUsedin interfaceorg.apache.lucene.util.Accountable
-
getChildResources
public java.util.Collection<org.apache.lucene.util.Accountable> getChildResources()
- Specified by:
getChildResourcesin interfaceorg.apache.lucene.util.Accountable
-
-