org.compass.core
Interface CompassAnalyzerHelper

All Known Implementing Classes:
DefaultCompassAnalyzerHelper

public interface CompassAnalyzerHelper

A set of Analyzer related helper methods. Aimed to help understand and simulate the analysis process. As well as helping build advance query building capabilities.

Author:
kimchy

Method Summary
 CompassToken[] analyze(Reader textReader)
          Analyzes the given text, returning a set of tokens.
 CompassToken[] analyze(String text)
          Analyzes the given text, returning a set of tokens.
 CompassToken[] analyze(String propertyName, Reader textReader)
          Analyzes the given text, using (if needed) the anlayzer that is bound to the supplied property.
 CompassToken[] analyze(String propertyName, String text)
          Analyzes the given text, using (if needed) the anlayzer that is bound to the supplied property.
 CompassToken analyzeSingle(String text)
          Analyzes the given text, returning the first token.
 CompassAnalyzerHelper setAnalyzer(Resource resource)
          Sets the analyzer that will be used for the analysis of the text.
 CompassAnalyzerHelper setAnalyzer(String analyzerName)
          Sets the analyzer that will be used for the analysis of the text.
 CompassAnalyzerHelper setAnalyzerByAlias(String alias)
          Sets the analyzer that will be used for the analysis of the text.
 

Method Detail

setAnalyzer

CompassAnalyzerHelper setAnalyzer(String analyzerName)
                                  throws CompassException
Sets the analyzer that will be used for the analysis of the text.

Parameters:
analyzerName - The analyzer name that will be used.
Returns:
the analyzer helper
Throws:
CompassException

setAnalyzer

CompassAnalyzerHelper setAnalyzer(Resource resource)
                                  throws CompassException
Sets the analyzer that will be used for the analysis of the text. Uses the resource to derive the analyzer that will be used (works also with per resource property analyzer).

Parameters:
resource - The resource to derive the analyzer from
Returns:
the analyzer helper
Throws:
CompassException

setAnalyzerByAlias

CompassAnalyzerHelper setAnalyzerByAlias(String alias)
                                         throws CompassException
Sets the analyzer that will be used for the analysis of the text. Uses the alias to get the mapping deinfitions and build a specific analyzer if there is a certain property that is associated with a specific analyzer (builds a per resource property analyzer).

Parameters:
alias - The alias to derive the analyzer from
Returns:
the analyzer helper
Throws:
CompassException - If the analyzer if not found

analyzeSingle

CompassToken analyzeSingle(String text)
                           throws CompassException
Analyzes the given text, returning the first token.

Parameters:
text - The text to analyze
Returns:
The first token.
Throws:
CompassException

analyze

CompassToken[] analyze(String text)
                       throws CompassException
Analyzes the given text, returning a set of tokens.

Parameters:
text - The text to analyze
Returns:
A set of tokens resulting from the analysis process.
Throws:
CompassException

analyze

CompassToken[] analyze(String propertyName,
                       String text)
                       throws CompassException
Analyzes the given text, using (if needed) the anlayzer that is bound to the supplied property. Should be used with setAnalyzer(Resource) so the analyzer can be dynamically detected from the resource.

Parameters:
propertyName - The property name for analyze bound properties
text - The text to analyze
Returns:
A set of tokens resulting from the analysis process.
Throws:
CompassException

analyze

CompassToken[] analyze(Reader textReader)
                       throws CompassException
Analyzes the given text, returning a set of tokens.

Parameters:
textReader - The text to analyze
Returns:
A set of tokens resulting from the analysis process.
Throws:
CompassException

analyze

CompassToken[] analyze(String propertyName,
                       Reader textReader)
                       throws CompassException
Analyzes the given text, using (if needed) the anlayzer that is bound to the supplied property. Should be used with setAnalyzer(Resource) so the analyzer can be dynamically detected from the resource.

Parameters:
propertyName - The property name for analyze bound properties
textReader - The text to analyze
Returns:
A set of tokens resulting from the analysis process.
Throws:
CompassException


Copyright (c) 2004-2009 The Compass Project.