当前位置: 首页>>代码示例>>Java>>正文


Java PerFieldAnalyzerWrapper.addAnalyzer方法代码示例

本文整理汇总了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"));
}
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:23,代码来源:AnalysisParalysisTest.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:DocumentUtil.java

示例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;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:14,代码来源:IndexManager.java

示例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;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:12,代码来源:IndexManager.java

示例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;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:13,代码来源:IndexManager.java

示例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;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:9,代码来源:IndexManager.java

示例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;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:12,代码来源:IndexManager.java

示例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;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:12,代码来源:IndexManager.java

示例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));
}
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:14,代码来源:KeywordAnalyzerTest.java


注:本文中的org.apache.lucene.analysis.PerFieldAnalyzerWrapper.addAnalyzer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。