• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java MultiTermAwareComponent类的典型用法和代码示例

java 3次浏览

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

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

示例1: doTestTokenizer

点赞 3

import org.apache.lucene.analysis.util.MultiTermAwareComponent; //导入依赖的package包/类
private void doTestTokenizer(String tokenizer) throws IOException {
  Class<? extends TokenizerFactory> factoryClazz = TokenizerFactory.lookupClass(tokenizer);
  TokenizerFactory factory = (TokenizerFactory) initialize(factoryClazz);
  if (factory != null) {
    // we managed to fully create an instance. check a few more things:
    
    // if it implements MultiTermAware, sanity check its impl
    if (factory instanceof MultiTermAwareComponent) {
      AbstractAnalysisFactory mtc = ((MultiTermAwareComponent) factory).getMultiTermComponent();
      assertNotNull(mtc);
      // its not ok to return e.g. a charfilter here: but a tokenizer could wrap a filter around it
      assertFalse(mtc instanceof CharFilterFactory);
    }
    
    // beast it just a little, it shouldnt throw exceptions:
    // (it should have thrown them in initialize)
    checkRandomData(random(), new FactoryAnalyzer(factory, null, null), 100, 20, false, false);
  }
}
 

开发者ID:europeana,
项目名称:search,
代码行数:20,
代码来源:TestFactories.java

示例2: doTestTokenFilter

点赞 3

import org.apache.lucene.analysis.util.MultiTermAwareComponent; //导入依赖的package包/类
private void doTestTokenFilter(String tokenfilter) throws IOException {
  Class<? extends TokenFilterFactory> factoryClazz = TokenFilterFactory.lookupClass(tokenfilter);
  TokenFilterFactory factory = (TokenFilterFactory) initialize(factoryClazz);
  if (factory != null) {
    // we managed to fully create an instance. check a few more things:
    
    // if it implements MultiTermAware, sanity check its impl
    if (factory instanceof MultiTermAwareComponent) {
      AbstractAnalysisFactory mtc = ((MultiTermAwareComponent) factory).getMultiTermComponent();
      assertNotNull(mtc);
      // its not ok to return a charfilter or tokenizer here, this makes no sense
      assertTrue(mtc instanceof TokenFilterFactory);
    }
    
    // beast it just a little, it shouldnt throw exceptions:
    // (it should have thrown them in initialize)
    checkRandomData(random(), new FactoryAnalyzer(assertingTokenizer, factory, null), 100, 20, false, false);
  }
}
 

开发者ID:europeana,
项目名称:search,
代码行数:20,
代码来源:TestFactories.java

示例3: doTestCharFilter

点赞 3

import org.apache.lucene.analysis.util.MultiTermAwareComponent; //导入依赖的package包/类
private void doTestCharFilter(String charfilter) throws IOException {
  Class<? extends CharFilterFactory> factoryClazz = CharFilterFactory.lookupClass(charfilter);
  CharFilterFactory factory = (CharFilterFactory) initialize(factoryClazz);
  if (factory != null) {
    // we managed to fully create an instance. check a few more things:
    
    // if it implements MultiTermAware, sanity check its impl
    if (factory instanceof MultiTermAwareComponent) {
      AbstractAnalysisFactory mtc = ((MultiTermAwareComponent) factory).getMultiTermComponent();
      assertNotNull(mtc);
      // its not ok to return a tokenizer or tokenfilter here, this makes no sense
      assertTrue(mtc instanceof CharFilterFactory);
    }
    
    // beast it just a little, it shouldnt throw exceptions:
    // (it should have thrown them in initialize)
    checkRandomData(random(), new FactoryAnalyzer(assertingTokenizer, null, factory), 100, 20, false, false);
  }
}
 

开发者ID:europeana,
项目名称:search,
代码行数:20,
代码来源:TestFactories.java

示例4: doTestTokenizer

点赞 3

import org.apache.lucene.analysis.util.MultiTermAwareComponent; //导入依赖的package包/类
private void doTestTokenizer(String tokenizer) throws IOException {
  TokenizerFactory factory = TokenizerFactory.forName(tokenizer);
  if (initialize(factory)) {
    // we managed to fully create an instance. check a few more things:
    
    // if it implements MultiTermAware, sanity check its impl
    if (factory instanceof MultiTermAwareComponent) {
      AbstractAnalysisFactory mtc = ((MultiTermAwareComponent) factory).getMultiTermComponent();
      assertNotNull(mtc);
      // its not ok to return e.g. a charfilter here: but a tokenizer could wrap a filter around it
      assertFalse(mtc instanceof CharFilterFactory);
    }
    
    // beast it just a little, it shouldnt throw exceptions:
    // (it should have thrown them in initialize)
    checkRandomData(random(), new FactoryAnalyzer(factory, null, null), 100, 20, false, false);
  }
}
 

开发者ID:pkarmstr,
项目名称:NYBC,
代码行数:19,
代码来源:TestFactories.java

示例5: doTestTokenFilter

点赞 3

import org.apache.lucene.analysis.util.MultiTermAwareComponent; //导入依赖的package包/类
private void doTestTokenFilter(String tokenfilter) throws IOException {
  TokenFilterFactory factory = TokenFilterFactory.forName(tokenfilter);
  if (initialize(factory)) {
    // we managed to fully create an instance. check a few more things:
    
    // if it implements MultiTermAware, sanity check its impl
    if (factory instanceof MultiTermAwareComponent) {
      AbstractAnalysisFactory mtc = ((MultiTermAwareComponent) factory).getMultiTermComponent();
      assertNotNull(mtc);
      // its not ok to return a charfilter or tokenizer here, this makes no sense
      assertTrue(mtc instanceof TokenFilterFactory);
    }
    
    // beast it just a little, it shouldnt throw exceptions:
    // (it should have thrown them in initialize)
    checkRandomData(random(), new FactoryAnalyzer(assertingTokenizer, factory, null), 100, 20, false, false);
  }
}
 

开发者ID:pkarmstr,
项目名称:NYBC,
代码行数:19,
代码来源:TestFactories.java

示例6: doTestCharFilter

点赞 3

import org.apache.lucene.analysis.util.MultiTermAwareComponent; //导入依赖的package包/类
private void doTestCharFilter(String charfilter) throws IOException {
  CharFilterFactory factory = CharFilterFactory.forName(charfilter);
  if (initialize(factory)) {
    // we managed to fully create an instance. check a few more things:
    
    // if it implements MultiTermAware, sanity check its impl
    if (factory instanceof MultiTermAwareComponent) {
      AbstractAnalysisFactory mtc = ((MultiTermAwareComponent) factory).getMultiTermComponent();
      assertNotNull(mtc);
      // its not ok to return a tokenizer or tokenfilter here, this makes no sense
      assertTrue(mtc instanceof CharFilterFactory);
    }
    
    // beast it just a little, it shouldnt throw exceptions:
    // (it should have thrown them in initialize)
    checkRandomData(random(), new FactoryAnalyzer(assertingTokenizer, null, factory), 100, 20, false, false);
  }
}
 

开发者ID:pkarmstr,
项目名称:NYBC,
代码行数:19,
代码来源:TestFactories.java

示例7: add

点赞 2

import org.apache.lucene.analysis.util.MultiTermAwareComponent; //导入依赖的package包/类
public void add(Object current)
{
    if (!(current instanceof MultiTermAwareComponent))
        return;
    AbstractAnalysisFactory newComponent = ((MultiTermAwareComponent) current).getMultiTermComponent();
    if (newComponent instanceof TokenFilterFactory)
    {
        if (filters == null)
        {
            filters = new ArrayList<TokenFilterFactory>(2);
        }
        filters.add((TokenFilterFactory) newComponent);
    }
    else if (newComponent instanceof TokenizerFactory)
    {
        tokenizer = (TokenizerFactory) newComponent;
    }
    else if (newComponent instanceof CharFilterFactory)
    {
        if (charFilters == null)
        {
            charFilters = new ArrayList<CharFilterFactory>(1);
        }
        charFilters.add((CharFilterFactory) newComponent);

    }
    else
    {
        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown analysis component from MultiTermAwareComponent: " + newComponent);
    }
}
 

开发者ID:Alfresco,
项目名称:community-edition-old,
代码行数:32,
代码来源:AlfrescoFieldType.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)