org.compass.core.impl
Class DefaultCompassAnalyzerHelper

java.lang.Object
  extended by org.compass.core.impl.DefaultCompassAnalyzerHelper
All Implemented Interfaces:
CompassAnalyzerHelper

public class DefaultCompassAnalyzerHelper
extends Object
implements CompassAnalyzerHelper

Author:
kimchy

Constructor Summary
DefaultCompassAnalyzerHelper(SearchEngineAnalyzerHelper analyzerHelper, InternalCompassSession session)
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCompassAnalyzerHelper

public DefaultCompassAnalyzerHelper(SearchEngineAnalyzerHelper analyzerHelper,
                                    InternalCompassSession session)
Method Detail

setAnalyzer

public CompassAnalyzerHelper setAnalyzer(String analyzerName)
                                  throws CompassException
Description copied from interface: CompassAnalyzerHelper
Sets the analyzer that will be used for the analysis of the text.

Specified by:
setAnalyzer in interface CompassAnalyzerHelper
Parameters:
analyzerName - The analyzer name that will be used.
Returns:
the analyzer helper
Throws:
CompassException

setAnalyzer

public CompassAnalyzerHelper setAnalyzer(Resource resource)
                                  throws CompassException
Description copied from interface: CompassAnalyzerHelper
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).

Specified by:
setAnalyzer in interface CompassAnalyzerHelper
Parameters:
resource - The resource to derive the analyzer from
Returns:
the analyzer helper
Throws:
CompassException

setAnalyzerByAlias

public CompassAnalyzerHelper setAnalyzerByAlias(String alias)
                                         throws CompassException
Description copied from interface: CompassAnalyzerHelper
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).

Specified by:
setAnalyzerByAlias in interface CompassAnalyzerHelper
Parameters:
alias - The alias to derive the analyzer from
Returns:
the analyzer helper
Throws:
CompassException - If the analyzer if not found

analyzeSingle

public CompassToken analyzeSingle(String text)
                           throws CompassException
Description copied from interface: CompassAnalyzerHelper
Analyzes the given text, returning the first token.

Specified by:
analyzeSingle in interface CompassAnalyzerHelper
Parameters:
text - The text to analyze
Returns:
The first token.
Throws:
CompassException

analyze

public CompassToken[] analyze(String text)
                       throws CompassException
Description copied from interface: CompassAnalyzerHelper
Analyzes the given text, returning a set of tokens.

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

analyze

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

Specified by:
analyze in interface CompassAnalyzerHelper
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

public CompassToken[] analyze(Reader textReader)
                       throws CompassException
Description copied from interface: CompassAnalyzerHelper
Analyzes the given text, returning a set of tokens.

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

analyze

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

Specified by:
analyze in interface CompassAnalyzerHelper
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-2008 The Compass Project.