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


Java ResourceLoader.newInstance方法代码示例

本文整理汇总了Java中org.apache.lucene.analysis.util.ResourceLoader.newInstance方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceLoader.newInstance方法的具体用法?Java ResourceLoader.newInstance怎么用?Java ResourceLoader.newInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.analysis.util.ResourceLoader的用法示例。


在下文中一共展示了ResourceLoader.newInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadRewriteChain

import org.apache.lucene.analysis.util.ResourceLoader; //导入方法依赖的package包/类
/**
 * Loads the whole {@link RewriteChain}s from the args and returns a list of
 * them.
 */
private RewriteChain loadRewriteChain(ResourceLoader loader) throws IOException {

   NamedList<?> chainConfig = (NamedList<?>) initArgs.get("rewriteChain");
   List<RewriterFactory> factories = new LinkedList<>();

   if (chainConfig != null) {

      @SuppressWarnings("unchecked")
      List<NamedList<?>> rewriterConfigs = (List<NamedList<?>>) chainConfig.getAll("rewriter");
      if (rewriterConfigs != null) {
         for (NamedList<?> config : rewriterConfigs) {
            RewriterFactoryAdapter factory = loader.newInstance((String) config.get("class"),
                  RewriterFactoryAdapter.class);
            factories.add(factory.createRewriterFactory(config, loader));
         }
      }
   }
   
   return new RewriteChain(factories);
   
}
 
开发者ID:renekrie,项目名称:querqy,代码行数:26,代码来源:AbstractQuerqyDismaxQParserPlugin.java

示例2: createRewriterFactory

import org.apache.lucene.analysis.util.ResourceLoader; //导入方法依赖的package包/类
@Override
public RewriterFactory createRewriterFactory(NamedList<?> args,
      ResourceLoader resourceLoader) throws IOException {
   String rulesResourceName = (String) args.get("rules");
   if (rulesResourceName == null) {
      throw new IllegalArgumentException("Property 'rules' not configured");
   }
   
   Boolean ignoreCase = args.getBooleanArg("ignoreCase");

   // querqy parser for queries that are part of the instructions in the
   // rules
   String rulesQuerqyParser = (String) args.get("querqyParser");
   QuerqyParserFactory querqyParser = null;
   if (rulesQuerqyParser != null) {
      rulesQuerqyParser = rulesQuerqyParser.trim();
      if (rulesQuerqyParser.length() > 0) {
         querqyParser = resourceLoader.newInstance(rulesQuerqyParser, QuerqyParserFactory.class);
      }
   }
   
   return new querqy.rewrite.commonrules.SimpleCommonRulesRewriterFactory(
         new InputStreamReader(resourceLoader.openResource(rulesResourceName), "UTF-8"), querqyParser, ignoreCase != null && ignoreCase);
}
 
开发者ID:renekrie,项目名称:querqy,代码行数:25,代码来源:SimpleCommonRulesRewriterFactory.java

示例3: inform

import org.apache.lucene.analysis.util.ResourceLoader; //导入方法依赖的package包/类
@Override
public void inform(ResourceLoader loader) {
  if (encoderClass.equals("float")){
    encoder = new FloatEncoder();
  } else if (encoderClass.equals("integer")){
    encoder = new IntegerEncoder();
  } else if (encoderClass.equals("identity")){
    encoder = new IdentityEncoder();
  } else {
    encoder = loader.newInstance(encoderClass, PayloadEncoder.class);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:DelimitedPayloadTokenFilterFactory.java

示例4: inform

import org.apache.lucene.analysis.util.ResourceLoader; //导入方法依赖的package包/类
@Override
public void inform(ResourceLoader loader) throws IOException {

    NamedList<?> parserConfig = (NamedList<?>) initArgs.get("parser");
    if (parserConfig == null) {
        throw new IOException("Missing querqy parser configuration");
    }

    String className = (String) parserConfig.get("factory");
    if (className == null) {
        throw new IOException("Missing attribute 'factory' in querqy parser configuration");
    }

    SolrQuerqyParserFactory factory = loader.newInstance(className, SolrQuerqyParserFactory.class);
    factory.init(parserConfig, loader);

    rewriteChain = loadRewriteChain(loader);
  
    termQueryCacheName = (String) initArgs.get(CONF_CACHE_NAME);
    
    Boolean updateCache = initArgs.getBooleanArg(CONF_CACHE_UPDATE);
    if (termQueryCacheName == null && updateCache != null) {
        throw new IOException("Configuration property " + CONF_CACHE_NAME + " required if " + CONF_CACHE_UPDATE + " is set");
    }

    ignoreTermQueryCacheUpdates = (updateCache != null) && !updateCache;
    
    this.querqyParserFactory = factory;
}
 
开发者ID:renekrie,项目名称:querqy,代码行数:30,代码来源:AbstractQuerqyDismaxQParserPlugin.java

示例5: inform

import org.apache.lucene.analysis.util.ResourceLoader; //导入方法依赖的package包/类
public void inform(ResourceLoader loader) {

        String className = "org.apache.lucene.morphology." + language.toLowerCase() + "." + language + "LuceneMorphology";
        luceneMorphology = loader.newInstance(className, LuceneMorphology.class);
    }
 
开发者ID:AKuznetsov,项目名称:russianmorphology,代码行数:6,代码来源:MorphologyFilterFactory.java


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