org.apache.solr.handler

## Class AnalysisRequestHandlerBase

- java.lang.Object
- - org.apache.solr.handler.RequestHandlerBase
  - - org.apache.solr.handler.AnalysisRequestHandlerBase

- All Implemented Interfaces:
    SolrInfoMBean, NestedRequestHandler, SolrRequestHandler
  Direct Known Subclasses:
    DocumentAnalysisRequestHandler, FieldAnalysisRequestHandler

      public abstract class AnalysisRequestHandlerBase
      extends RequestHandlerBase

  A base class for all analysis request handlers.
  Since:
    solr 1.4

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `AnalysisRequestHandlerBase.AnalysisContext` Serves as the context of an analysis process.
    `protected static class` | `AnalysisRequestHandlerBase.ListBasedTokenStream` TokenStream that iterates over a list of pre-existing Tokens
    `static interface` | `AnalysisRequestHandlerBase.TokenTrackingAttribute` This is an `Attribute` used to track the positions of tokens in the analysis chain.
    `static class` | `AnalysisRequestHandlerBase.TokenTrackingAttributeImpl` Implementation of `AnalysisRequestHandlerBase.TokenTrackingAttribute`.

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

      `SolrInfoMBean.Category`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Set<BytesRef>` | `EMPTY_BYTES_SET`

    - ### Fields inherited from class org.apache.solr.handler.RequestHandlerBase

      `appends, defaults, httpCaching, initArgs, invariants`

    - ### Fields inherited from interface org.apache.solr.request.SolrRequestHandler

      `TYPE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AnalysisRequestHandlerBase()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected NamedList<? extends Object>` | `analyzeValue(String value, AnalysisRequestHandlerBase.AnalysisContext context)` Analyzes the given value using the given Analyzer.
    `protected abstract NamedList` | `doAnalysis(SolrQueryRequest req)` Performs the analysis based on the given solr request and returns the analysis result as a named list.
    `protected Set<BytesRef>` | `getQueryTokenSet(String query, Analyzer analyzer)` Analyzes the given text using the given analyzer and returns the produced tokens.
    `void` | `handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp)`

    - ### Methods inherited from class org.apache.solr.handler.RequestHandlerBase

      `getCategory, getDescription, getDocs, getInitArgs, getName, getPluginInfo, getRequestHandler, getSolrParamsFromNamedList, getSource, getStatistics, getSubHandler, getVersion, handleRequest, init, setPluginInfo`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### EMPTY_BYTES_SET

          public static final Set<BytesRef> EMPTY_BYTES_SET

  - ### Constructor Detail

    - #### AnalysisRequestHandlerBase

          public AnalysisRequestHandlerBase()

  - ### Method Detail

    - #### handleRequestBody

          public void handleRequestBody(SolrQueryRequest req,
                                        SolrQueryResponse rsp)
                                 throws Exception

      Specified by:
        `handleRequestBody` in class `RequestHandlerBase`
      Throws:
        `Exception`

    - #### doAnalysis

          protected abstract NamedList doAnalysis(SolrQueryRequest req)
                                           throws Exception

      Performs the analysis based on the given solr request and returns the analysis result as a named list.
      Parameters:
        `req` - The solr request.
      Returns:
        The analysis result as a named list.
      Throws:
        `Exception` - When analysis fails.

    - #### analyzeValue

          protected NamedList<? extends Object> analyzeValue(String value,
                                                             AnalysisRequestHandlerBase.AnalysisContext context)

      Analyzes the given value using the given Analyzer.
      Parameters:
        `value` - Value to analyze
        `context` - The `analysis context`.
      Returns:
        NamedList containing the tokens produced by analyzing the given value

    - #### getQueryTokenSet

          protected Set<BytesRef> getQueryTokenSet(String query,
                                                   Analyzer analyzer)

      Analyzes the given text using the given analyzer and returns the produced tokens.
      Parameters:
        `query` - The query to analyze.
        `analyzer` - The analyzer to use.

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.