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
Version:
$Id: AnalysisRequestHandlerBase.java 1143785 2011-07-07 11:59:59Z uschindler $

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
 
Fields inherited from class org.apache.solr.handler.RequestHandlerBase
appends, defaults, httpCaching, initArgs, invariants
 
Constructor Summary
AnalysisRequestHandlerBase()
           
 
Method Summary
protected  org.apache.solr.common.util.NamedList<List<org.apache.solr.common.util.NamedList>> analyzeValue(String value, AnalysisRequestHandlerBase.AnalysisContext context)
          Analyzes the given value using the given Analyzer.
protected  List<AttributeSource> analyzeValue(String value, Analyzer analyzer)
          Deprecated. This method is no longer used by Solr
protected abstract  org.apache.solr.common.util.NamedList doAnalysis(SolrQueryRequest req)
          Performs the analysis based on the given solr request and returns the analysis result as a named list.
protected  Set<String> 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, getSourceId, getStatistics, getVersion, handleRequest, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 org.apache.solr.common.util.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 org.apache.solr.common.util.NamedList<List<org.apache.solr.common.util.NamedList>> 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

analyzeValue

@Deprecated
protected List<AttributeSource> analyzeValue(String value,
                                                        Analyzer analyzer)
Deprecated. This method is no longer used by Solr

Analyzes the given text using the given analyzer and returns the produced tokens.

Parameters:
value - The value to analyze.
analyzer - The analyzer to use.
Returns:
The produces token list.
See Also:
getQueryTokenSet(java.lang.String, org.apache.lucene.analysis.Analyzer)

getQueryTokenSet

protected Set<String> 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.