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 827032 2009-10-20 11:01:47Z koji $

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
 
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<Token> analyzeValue(String value, Analyzer analyzer)
          Analyzes the given text using the given analyzer and returns the produced tokens.
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.
 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

protected List<Token> analyzeValue(String value,
                                   Analyzer analyzer)
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.


Copyright © 2010 Apache Software Foundation. All Rights Reserved.