Class AnalyzerFactoryTask
- java.lang.Object
-
- org.apache.lucene.benchmark.byTask.tasks.PerfTask
-
- org.apache.lucene.benchmark.byTask.tasks.AnalyzerFactoryTask
-
- All Implemented Interfaces:
Cloneable
public class AnalyzerFactoryTask extends PerfTask
Analyzer factory construction task. The name given to the constructed factory may be given to NewAnalyzerTask, which will call AnalyzerFactory.create().Params are in the form argname:argvalue or argname:"argvalue" or argname:'argvalue'; use backslashes to escape '"' or "'" inside a quoted value when it's used as the enclosing quotation mark,
Specify params in a comma separated list of the following, in order:
- Analyzer args:
- Required:
name:analyzer-factory-name
- Optional:
positionIncrementGap:int value
(default: 0) - Optional:
offsetGap:int value
(default: 1)
- Required:
- zero or more CharFilterFactory's, followed by
- exactly one TokenizerFactory, followed by
- zero or more TokenFilterFactory's
luceneMatchVersion
(defaults toVersion.LATEST
) and any of the args understood by the specified *Factory class, in the above-describe param format.Example:
-AnalyzerFactory(name:'strip html, fold to ascii, whitespace tokenize, max 10k tokens', positionIncrementGap:100, HTMLStripCharFilter, MappingCharFilter(mapping:'mapping-FoldToASCII.txt'), WhitespaceTokenizer(luceneMatchVersion:LUCENE_5_0_0), TokenLimitFilter(maxTokenCount:10000, consumeAllTokens:false)) [...] -NewAnalyzer('strip html, fold to ascii, whitespace tokenize, max 10k tokens')
AnalyzerFactory will direct analysis component factories to look for resources under the directory specified in the "work.dir" property.
-
-
Constructor Summary
Constructors Constructor Description AnalyzerFactoryTask(PerfRunData runData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
doLogic()
Perform the task once (ignoring repetitions specification) Return number of work items done by this task.int
lineno(StreamTokenizer stok)
Returns the current line in the algorithm file<T> Class<? extends T>
lookupAnalysisClass(String className, Class<T> expectedType)
This method looks up a class with its fully qualified name (FQN), or a short-name class-simplename, or with a package suffix, assuming "org.apache.lucene.analysis." as the package prefix (e.g.void
setParams(String params)
Sets the params.boolean
supportsParams()
Sub classes that support parameters must override this method to return true.-
Methods inherited from class org.apache.lucene.benchmark.byTask.tasks.PerfTask
clone, close, getAlgLineNum, getBackgroundDeltaPriority, getDepth, getLogMessage, getName, getParams, getRunData, getRunInBackground, isDisableCounting, runAndMaybeStats, setAlgLineNum, setDepth, setDisableCounting, setName, setRunInBackground, setup, shouldNeverLogAtStart, shouldNotRecordStats, stopNow, tearDown, toString
-
-
-
-
Constructor Detail
-
AnalyzerFactoryTask
public AnalyzerFactoryTask(PerfRunData runData)
-
-
Method Detail
-
doLogic
public int doLogic()
Description copied from class:PerfTask
Perform the task once (ignoring repetitions specification) Return number of work items done by this task. For indexing that can be number of docs added. For warming that can be number of scanned items, etc.
-
setParams
public void setParams(String params)
Sets the params. Analysis component factory names may optionally include the "Factory" suffix.
-
lookupAnalysisClass
public <T> Class<? extends T> lookupAnalysisClass(String className, Class<T> expectedType) throws ClassNotFoundException
This method looks up a class with its fully qualified name (FQN), or a short-name class-simplename, or with a package suffix, assuming "org.apache.lucene.analysis." as the package prefix (e.g. "standard.ClassicTokenizerFactory" -> "org.apache.lucene.analysis.standard.ClassicTokenizerFactory").If className contains a period, the class is first looked up as-is, assuming that it is an FQN. If this fails, lookup is retried after prepending the Lucene analysis package prefix to the class name.
If className does not contain a period, the analysis SPI *Factory.lookupClass() methods are used to find the class.
- Parameters:
className
- The name or the short name of the class.expectedType
- The superclass className is expected to extend- Returns:
- the loaded class.
- Throws:
ClassNotFoundException
- if lookup fails
-
supportsParams
public boolean supportsParams()
Description copied from class:PerfTask
Sub classes that support parameters must override this method to return true.- Overrides:
supportsParams
in classPerfTask
- Returns:
- true iff this task supports command line params.
-
lineno
public int lineno(StreamTokenizer stok)
Returns the current line in the algorithm file
-
-