|
DLESE Tools v1.6.0 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.lucene.analysis.Analyzer
org.dlese.dpc.index.analysis.PerFieldAnalyzer
public class PerFieldAnalyzer
This Analyzer is used to facilitate scenarios where different fields require different analysis
techniques. Use #addAnalyzer to add a non-default Analyzer or addAnalyzersInBundle(java.util.ResourceBundle) to
provide a ResourceBundle to configure Analyzers on a field name basis. The ResourceBundle should contain
className=field1,field2,... pairs, where the field names are a comma-separated list, for example:
org.dlese.dpc.index.analysis.SnowballAnalyzer=stems,titlestems
| Field Summary | |
|---|---|
static String |
KEYWORD_ANALYZER
|
static String |
STEMS_ANALYZER
|
static String |
TEXT_ANALYZER
|
| Fields inherited from class org.apache.lucene.analysis.Analyzer |
|---|
overridesTokenStreamMethod |
| Constructor Summary | |
|---|---|
PerFieldAnalyzer()
Constructs using a StandardAnalyzer as the default for fields
not otherwise configured. |
|
PerFieldAnalyzer(org.apache.lucene.analysis.Analyzer defaultAnalyzer)
Constructs with the given Analyzer to use as a default for fields not otherwise configured. |
|
| Method Summary | |
|---|---|
void |
addAnalyzersInBundle(ResourceBundle fieldAnalyzerBundle)
Adds the Analyzers to use for given fields, using the field=className pairs provided in the ResourceBundle, overrridding any previous ones if they existed. |
boolean |
containsAnalyzer(String fieldName)
Determines if an Analyzer is configured for the given field. |
org.apache.lucene.analysis.Analyzer |
getAnalyzer(String fieldName)
Gets the Analyzer configured for the given field, or null if none exists. |
org.apache.lucene.analysis.Analyzer |
getDefaultAnalyzer()
Gets the default Analyzer being used. |
org.apache.lucene.analysis.Analyzer |
removeAnalyzer(String fieldName)
Removes the Analyzer that is configured for the given field, if one exists. |
void |
setAnalyzer(String fieldName,
String analyzerClassName)
Sets the Analyzer to use for the specified search field, overridding the previous one if it existed. |
void |
setDefaultAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
Sets the default Analyzer to use from here forth. |
org.apache.lucene.analysis.TokenStream |
tokenStream(String fieldName,
Reader reader)
Generates a token stream for the given field. |
String |
toString()
|
| Methods inherited from class org.apache.lucene.analysis.Analyzer |
|---|
close, getOffsetGap, getPositionIncrementGap, getPreviousTokenStream, reusableTokenStream, setOverridesTokenStreamMethod, setPreviousTokenStream |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String TEXT_ANALYZER
public static final String KEYWORD_ANALYZER
public static final String STEMS_ANALYZER
| Constructor Detail |
|---|
public PerFieldAnalyzer(org.apache.lucene.analysis.Analyzer defaultAnalyzer)
StandardAnalyzer will be used as the default.
defaultAnalyzer - Any fields not specifically defined to use a different analyzer will use the one
provided here.public PerFieldAnalyzer()
StandardAnalyzer as the default for fields
not otherwise configured.
| Method Detail |
|---|
public void setAnalyzer(String fieldName,
String analyzerClassName)
throws ClassNotFoundException,
InstantiationException,
IllegalAccessException
fieldName - field name requiring a non-default analyzer.analyzerClassName - Name of Analyzer class to use for the field
ClassNotFoundException - If error
InstantiationException - If error
IllegalAccessException - If errorpublic String toString()
toString in class Object
public void addAnalyzersInBundle(ResourceBundle fieldAnalyzerBundle)
throws ClassNotFoundException,
InstantiationException,
IllegalAccessException
org.dlese.dpc.index.analysis.SnowballAnalyzer=stems,titlestems
fieldAnalyzerBundle - A resource bundle containing className=field1,field2,etc. pairs
ClassNotFoundException - If error
InstantiationException - If error
IllegalAccessException - If errorpublic org.apache.lucene.analysis.Analyzer getAnalyzer(String fieldName)
fieldName - The field name
public org.apache.lucene.analysis.Analyzer getDefaultAnalyzer()
public void setDefaultAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
analyzer - The new default Analyzerpublic boolean containsAnalyzer(String fieldName)
fieldName - The field name
public org.apache.lucene.analysis.Analyzer removeAnalyzer(String fieldName)
fieldName - The field name
public org.apache.lucene.analysis.TokenStream tokenStream(String fieldName,
Reader reader)
tokenStream in class org.apache.lucene.analysis.AnalyzerfieldName - The field namereader - The Reader
|
DLESE Tools v1.6.0 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||