Java Code Examples for org.apache.lucene.analysis.util.TokenizerFactory#lookupClass()

The following examples show how to use org.apache.lucene.analysis.util.TokenizerFactory#lookupClass() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestFactories.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
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 (!EXCLUDE_FACTORIES_RANDOM_DATA.contains(factory.getClass())) {
      // beast it just a little, it shouldnt throw exceptions:
      // (it should have thrown them in initialize)
      Analyzer a = new FactoryAnalyzer(factory, null, null);
      checkRandomData(random(), a, 3, 20, false, false);
      a.close();
    }
  }
}
 
Example 2
Source File: TestFactories.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
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 (!EXCLUDE_FACTORIES_RANDOM_DATA.contains(factory.getClass())) {
      // beast it just a little, it shouldnt throw exceptions:
      // (it should have thrown them in initialize)
      Analyzer a = new FactoryAnalyzer(factory, null, null);
      checkRandomData(random(), a, 3, 20, false, false);
      a.close();
    }
  }
}