本文整理汇总了Java中org.apache.lucene.analysis.PerFieldAnalyzerWrapper.addAnalyzer方法的典型用法代码示例。如果您正苦于以下问题:Java PerFieldAnalyzerWrapper.addAnalyzer方法的具体用法?Java PerFieldAnalyzerWrapper.addAnalyzer怎么用?Java PerFieldAnalyzerWrapper.addAnalyzer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.analysis.PerFieldAnalyzerWrapper
的用法示例。
在下文中一共展示了PerFieldAnalyzerWrapper.addAnalyzer方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAnalyzer
import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入方法依赖的package包/类
public void testAnalyzer() throws Exception {
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_41);
String queryString = "category:/philosophy/eastern";
Query query = new QueryParser(Version.LUCENE_41,
"contents",
analyzer).parse(queryString);
assertEquals("path got split, yikes!",
"category:\"philosophy eastern\"",
query.toString("contents"));
PerFieldAnalyzerWrapper perFieldAnalyzer =
new PerFieldAnalyzerWrapper(analyzer);
perFieldAnalyzer.addAnalyzer("category",
new WhitespaceAnalyzer(Version.LUCENE_41));
query = new QueryParser(Version.LUCENE_41,
"contents",
perFieldAnalyzer).parse(queryString);
assertEquals("leave category field alone",
"category:/philosophy/eastern",
query.toString("contents"));
}
示例2: createAnalyzer
import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入方法依赖的package包/类
public static Analyzer createAnalyzer() {
final PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new KeywordAnalyzer());
analyzer.addAnalyzer(DocumentUtil.FIELD_IDENTS, new WhitespaceAnalyzer());
analyzer.addAnalyzer(DocumentUtil.FIELD_FEATURE_IDENTS, new WhitespaceAnalyzer());
analyzer.addAnalyzer(DocumentUtil.FIELD_CASE_INSENSITIVE_FEATURE_IDENTS, new DocumentUtil.LCWhitespaceAnalyzer());
return analyzer;
}
示例3: getServerAnalyzer
import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入方法依赖的package包/类
private Analyzer getServerAnalyzer() {
PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new
NGramAnalyzer(min_ngram, max_ngram));
analyzer.addAnalyzer("checkin", new KeywordAnalyzer());
analyzer.addAnalyzer("registered", new KeywordAnalyzer());
analyzer.addAnalyzer("ram", new KeywordAnalyzer());
analyzer.addAnalyzer("swap", new KeywordAnalyzer());
analyzer.addAnalyzer("cpuMHz", new KeywordAnalyzer());
analyzer.addAnalyzer("cpuNumberOfCpus", new KeywordAnalyzer());
return analyzer;
}
示例4: getErrataAnalyzer
import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入方法依赖的package包/类
private Analyzer getErrataAnalyzer() {
PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new
NGramAnalyzer(min_ngram, max_ngram));
analyzer.addAnalyzer("advisoryName", new KeywordAnalyzer());
analyzer.addAnalyzer("synopsis", new StandardAnalyzer());
analyzer.addAnalyzer("description", new StandardAnalyzer());
analyzer.addAnalyzer("topic", new StandardAnalyzer());
analyzer.addAnalyzer("solution", new StandardAnalyzer());
return analyzer;
}
示例5: getSnapshotTagAnalyzer
import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入方法依赖的package包/类
private Analyzer getSnapshotTagAnalyzer() {
PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new
NGramAnalyzer(min_ngram, max_ngram));
analyzer.addAnalyzer("id", new KeywordAnalyzer());
analyzer.addAnalyzer("snapshotId", new KeywordAnalyzer());
analyzer.addAnalyzer("orgId", new KeywordAnalyzer());
analyzer.addAnalyzer("serverId", new KeywordAnalyzer());
analyzer.addAnalyzer("tagNameId", new KeywordAnalyzer());
analyzer.addAnalyzer("created", new KeywordAnalyzer());
analyzer.addAnalyzer("modified", new KeywordAnalyzer());
return analyzer;
}
示例6: getHardwareDeviceAnalyzer
import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入方法依赖的package包/类
private Analyzer getHardwareDeviceAnalyzer() {
PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new
NGramAnalyzer(min_ngram, max_ngram));
analyzer.addAnalyzer("id", new KeywordAnalyzer());
analyzer.addAnalyzer("serverId", new KeywordAnalyzer());
analyzer.addAnalyzer("pciType", new KeywordAnalyzer());
return analyzer;
}
示例7: getServerCustomInfoAnalyzer
import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入方法依赖的package包/类
private Analyzer getServerCustomInfoAnalyzer() {
PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new
NGramAnalyzer(min_ngram, max_ngram));
analyzer.addAnalyzer("id", new KeywordAnalyzer());
analyzer.addAnalyzer("serverId", new KeywordAnalyzer());
analyzer.addAnalyzer("created", new KeywordAnalyzer());
analyzer.addAnalyzer("modified", new KeywordAnalyzer());
analyzer.addAnalyzer("createdBy", new KeywordAnalyzer());
analyzer.addAnalyzer("lastModifiedBy", new KeywordAnalyzer());
return analyzer;
}
示例8: getDefaultAnalyzer
import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入方法依赖的package包/类
private Analyzer getDefaultAnalyzer() {
PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(new
NGramAnalyzer(min_ngram, max_ngram));
analyzer.addAnalyzer("id", new KeywordAnalyzer());
analyzer.addAnalyzer("arch", new KeywordAnalyzer());
analyzer.addAnalyzer("epoch", new KeywordAnalyzer());
analyzer.addAnalyzer("version", new KeywordAnalyzer());
analyzer.addAnalyzer("release", new KeywordAnalyzer());
analyzer.addAnalyzer("filename", new KeywordAnalyzer());
return analyzer;
}
示例9: testPerFieldAnalyzer
import org.apache.lucene.analysis.PerFieldAnalyzerWrapper; //导入方法依赖的package包/类
public void testPerFieldAnalyzer() throws Exception {
PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(
new SimpleAnalyzer());
analyzer.addAnalyzer("partnum", new KeywordAnalyzer());
Query query = new QueryParser(Version.LUCENE_41,
"description", analyzer).parse(
"partnum:Q36 AND SPACE");
assertEquals("Q36 kept as-is",
"+partnum:Q36 +space", query.toString("description"));
assertEquals("doc found!", 1, TestUtil.hitCount(searcher, query));
}