public final class AnalyzerUtils extends Object
Taken and modified from Lucene in Action.
Modifier and Type | Field and Description |
---|---|
static org.hibernate.search.util.logging.impl.Log |
log |
Modifier and Type | Method and Description |
---|---|
static void |
displayTokens(org.apache.lucene.analysis.Analyzer analyzer,
String field,
String text) |
static void |
displayTokensWithFullDetails(org.apache.lucene.analysis.Analyzer analyzer,
String field,
String text) |
static void |
displayTokensWithPositions(org.apache.lucene.analysis.Analyzer analyzer,
String field,
String text,
PrintStream printTo)
Utility to print out the tokens generated by a specific Analyzer on an example text.
|
static String |
getTermText(org.apache.lucene.analysis.Token token) |
static List<String> |
tokenizedTermValues(org.apache.lucene.analysis.Analyzer analyzer,
String field,
String text) |
static org.apache.lucene.analysis.Token[] |
tokensFromAnalysis(org.apache.lucene.analysis.Analyzer analyzer,
String field,
String text) |
public static List<String> tokenizedTermValues(org.apache.lucene.analysis.Analyzer analyzer, String field, String text) throws IOException
IOException
public static org.apache.lucene.analysis.Token[] tokensFromAnalysis(org.apache.lucene.analysis.Analyzer analyzer, String field, String text) throws IOException
IOException
public static void displayTokens(org.apache.lucene.analysis.Analyzer analyzer, String field, String text) throws IOException
IOException
public static void displayTokensWithPositions(org.apache.lucene.analysis.Analyzer analyzer, String field, String text, PrintStream printTo) throws IOException
analyzer
- the Analyzer to usefield
- the name of the field: might affect the Analyzer behaviourtext
- some sample inputprintTo
- Human readable text will be printed to this output. Passing System.out
might be a good idea.IOException
- if an I/O error occurspublic static void displayTokensWithFullDetails(org.apache.lucene.analysis.Analyzer analyzer, String field, String text) throws IOException
IOException
public static String getTermText(org.apache.lucene.analysis.Token token)
Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.