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


Java ReverseStringFilter类代码示例

本文整理汇总了Java中org.apache.lucene.analysis.reverse.ReverseStringFilter的典型用法代码示例。如果您正苦于以下问题:Java ReverseStringFilter类的具体用法?Java ReverseStringFilter怎么用?Java ReverseStringFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ReverseStringFilter类属于org.apache.lucene.analysis.reverse包,在下文中一共展示了ReverseStringFilter类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testBackwardsCompatibilityEdgeNgramTokenFilter

import org.apache.lucene.analysis.reverse.ReverseStringFilter; //导入依赖的package包/类
public void testBackwardsCompatibilityEdgeNgramTokenFilter() throws Exception {
    int iters = scaledRandomIntBetween(20, 100);
    for (int i = 0; i < iters; i++) {
        final Index index = new Index("test", "_na_");
        final String name = "ngr";
        Version v = randomVersion(random());
        Builder builder = newAnalysisSettingsBuilder().put("min_gram", 2).put("max_gram", 3);
        boolean reverse = random().nextBoolean();
        if (reverse) {
            builder.put("side", "back");
        }
        Settings settings = builder.build();
        Settings indexSettings = newAnalysisSettingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, v.id).build();
        Tokenizer tokenizer = new MockTokenizer();
        tokenizer.setReader(new StringReader("foo bar"));
        TokenStream edgeNGramTokenFilter = new EdgeNGramTokenFilterFactory(IndexSettingsModule.newIndexSettings(index, indexSettings), null, name, settings).create(tokenizer);
        if (reverse) {
            assertThat(edgeNGramTokenFilter, instanceOf(ReverseStringFilter.class));
        } else {
            assertThat(edgeNGramTokenFilter, instanceOf(EdgeNGramTokenFilter.class));
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:NGramTokenizerFactoryTests.java

示例2: create

import org.apache.lucene.analysis.reverse.ReverseStringFilter; //导入依赖的package包/类
@Override
public ReverseStringFilter create(TokenStream in) {
  if (luceneMatchVersion == null) {
    return new ReverseStringFilter(in);
  }
  return new ReverseStringFilter(luceneMatchVersion,in);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:ReverseStringFilterFactory.java

示例3: create

import org.apache.lucene.analysis.reverse.ReverseStringFilter; //导入依赖的package包/类
@Override
public TokenStream create(TokenStream tokenStream) {
    return new ReverseStringFilter(tokenStream);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:ReverseTokenFilterFactory.java

示例4: createComponents

import org.apache.lucene.analysis.reverse.ReverseStringFilter; //导入依赖的package包/类
@Override
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
  final Tokenizer tokenizer = new KeywordTokenizer(reader);
  return new TokenStreamComponents(tokenizer, new ReverseStringFilter(new EdgeNGramTokenFilter(new ReverseStringFilter(tokenizer), 10, 20)));
}
 
开发者ID:europeana,项目名称:search,代码行数:6,代码来源:SimpleNaiveBayesClassifierTest.java

示例5: create

import org.apache.lucene.analysis.reverse.ReverseStringFilter; //导入依赖的package包/类
@Override
public ReverseStringFilter create(TokenStream in) {
  assureMatchVersion();
  return new ReverseStringFilter(luceneMatchVersion,in);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:6,代码来源:ReverseStringFilterFactory.java

示例6: create

import org.apache.lucene.analysis.reverse.ReverseStringFilter; //导入依赖的package包/类
@Override
public ReverseStringFilter create(TokenStream in) {
  return new ReverseStringFilter(luceneMatchVersion,in);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:5,代码来源:ReverseStringFilterFactory.java

示例7: createComponents

import org.apache.lucene.analysis.reverse.ReverseStringFilter; //导入依赖的package包/类
@Override
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
  final Tokenizer tokenizer = new KeywordTokenizer(reader);
  return new TokenStreamComponents(tokenizer, new ReverseStringFilter(TEST_VERSION_CURRENT, new EdgeNGramTokenFilter(TEST_VERSION_CURRENT, new ReverseStringFilter(TEST_VERSION_CURRENT, tokenizer), 10, 20)));
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:6,代码来源:SimpleNaiveBayesClassifierTest.java


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