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.Accountable
Originally taken from SuggestComponent and modified, this class provides a SearchComponent that builds SolrSuggester objects asynchronously to avoid blocking search requests or increasing startup time of the servlet container.
See Also:
  • SuggestComponent
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoMBean

    org.apache.solr.core.SolrInfoMBean.Category, org.apache.solr.core.SolrInfoMBean.Group
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Name used to identify whether the user query concerns this component
    protected org.apache.solr.common.util.NamedList
     
    protected Map<String,org.alfresco.solr.component.AsyncBuildSuggestComponent.SuggesterCache>
    Key is the dictionary name used in SolrConfig, value is the corresponding SolrSuggester
    protected static TempFileWarningLogger
     

    Fields inherited from class org.apache.solr.handler.component.SearchComponent

    standard_components

    Fields inherited from interface org.apache.solr.spelling.suggest.SuggesterParams

    SUGGEST_ALL_TERMS_REQUIRED, SUGGEST_BUILD, SUGGEST_BUILD_ALL, SUGGEST_CONTEXT_FILTER_QUERY, SUGGEST_COUNT, SUGGEST_DICT, SUGGEST_HIGHLIGHT, SUGGEST_PREFIX, SUGGEST_Q, SUGGEST_RELOAD, SUGGEST_RELOAD_ALL
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    distributedProcess(org.apache.solr.handler.component.ResponseBuilder rb)
    Dispatch shard request in STAGE_EXECUTE_QUERY stage
    void
    finishStage(org.apache.solr.handler.component.ResponseBuilder rb)
    Used in Distributed Search, merges the suggestion results from every shard
    Collection<org.apache.lucene.util.Accountable>
     
     
     
    org.apache.solr.common.util.NamedList<String>
     
    void
    inform(org.apache.solr.core.SolrCore core)
     
    void
    init(org.apache.solr.common.util.NamedList args)
     
    void
    prepare(org.apache.solr.handler.component.ResponseBuilder rb)
    Responsible for issuing build and rebload command to the specified SolrSuggester
    void
    process(org.apache.solr.handler.component.ResponseBuilder rb)
    Responsible for using the specified suggester to get the suggestions for the query and write the results
    long
     

    Methods inherited from class org.apache.solr.handler.component.SearchComponent

    getCategory, getDocs, getName, getVersion, handleResponses, modifyRequest, setName

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • COMPONENT_NAME

      public static final String COMPONENT_NAME
      Name used to identify whether the user query concerns this component
      See Also:
    • tempFileWarningLogger

      protected static TempFileWarningLogger tempFileWarningLogger
    • initParams

      protected org.apache.solr.common.util.NamedList initParams
    • suggesters

      protected Map<String,org.alfresco.solr.component.AsyncBuildSuggestComponent.SuggesterCache> suggesters
      Key is the dictionary name used in SolrConfig, value is the corresponding SolrSuggester
  • Constructor Details

    • AsyncBuildSuggestComponent

      public AsyncBuildSuggestComponent()
  • Method Details

    • init

      public void init(org.apache.solr.common.util.NamedList args)
      Specified by:
      init in interface org.apache.solr.util.plugin.NamedListInitializedPlugin
      Overrides:
      init in class org.apache.solr.handler.component.SearchComponent
    • inform

      public void inform(org.apache.solr.core.SolrCore core)
      Specified by:
      inform in interface org.apache.solr.util.plugin.SolrCoreAware
    • prepare

      public void prepare(org.apache.solr.handler.component.ResponseBuilder rb) throws IOException
      Responsible for issuing build and rebload command to the specified SolrSuggester
      Specified by:
      prepare in class org.apache.solr.handler.component.SearchComponent
      Throws:
      IOException
    • distributedProcess

      public int distributedProcess(org.apache.solr.handler.component.ResponseBuilder rb)
      Dispatch shard request in STAGE_EXECUTE_QUERY stage
      Overrides:
      distributedProcess in class org.apache.solr.handler.component.SearchComponent
    • process

      public void process(org.apache.solr.handler.component.ResponseBuilder rb) throws IOException
      Responsible for using the specified suggester to get the suggestions for the query and write the results
      Specified by:
      process in class org.apache.solr.handler.component.SearchComponent
      Throws:
      IOException
    • finishStage

      public void finishStage(org.apache.solr.handler.component.ResponseBuilder rb)
      Used in Distributed Search, merges the suggestion results from every shard
      Overrides:
      finishStage in class org.apache.solr.handler.component.SearchComponent
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface org.apache.solr.core.SolrInfoMBean
      Specified by:
      getDescription in class org.apache.solr.handler.component.SearchComponent
    • getSource

      public String getSource()
      Specified by:
      getSource in interface org.apache.solr.core.SolrInfoMBean
      Overrides:
      getSource in class org.apache.solr.handler.component.SearchComponent
    • getStatistics

      public org.apache.solr.common.util.NamedList<String> getStatistics()
      Specified by:
      getStatistics in interface org.apache.solr.core.SolrInfoMBean
      Overrides:
      getStatistics in class org.apache.solr.handler.component.SearchComponent
    • ramBytesUsed

      public long ramBytesUsed()
      Specified by:
      ramBytesUsed in interface org.apache.lucene.util.Accountable
    • getChildResources

      public Collection<org.apache.lucene.util.Accountable> getChildResources()
      Specified by:
      getChildResources in interface org.apache.lucene.util.Accountable