org.apache.solr.handler
Class AnalysisRequestHandlerBase

java.lang.Object
  extended by org.apache.solr.handler.RequestHandlerBase
      extended by org.apache.solr.handler.AnalysisRequestHandlerBase
All Implemented Interfaces:
SolrInfoMBean, 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
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
static Set<BytesRef> EMPTY_BYTES_SET
           
 
Fields inherited from class org.apache.solr.handler.RequestHandlerBase
appends, defaults, httpCaching, initArgs, invariants
 
Constructor Summary
AnalysisRequestHandlerBase()
           
 
Method Summary
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, getSource, getStatistics, getVersion, handleRequest, init
 
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-2014 Apache Software Foundation. All Rights Reserved.