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


Java SolrConfig.get方法代码示例

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


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

示例1: SolrIndexConfig

import org.apache.solr.core.SolrConfig; //导入方法依赖的package包/类
/**
 * Constructs a SolrIndexConfig which parses the Lucene related config params in solrconfig.xml
 * @param solrConfig the overall SolrConfig object
 * @param prefix the XPath prefix for which section to parse (mandatory)
 * @param def a SolrIndexConfig instance to pick default values from (optional)
 */
@SuppressWarnings("deprecation")
public SolrIndexConfig(SolrConfig solrConfig, String prefix, SolrIndexConfig def)  {
  if (prefix == null) {
    prefix = "indexConfig";
    log.debug("Defaulting to prefix \""+prefix+"\" for index configuration");
  }
  
  if (def == null) {
    def = new SolrIndexConfig(solrConfig);
  }

  // sanity check: this will throw an error for us if there is more then one
  // config section
  Object unused = solrConfig.getNode(prefix, false);

  luceneVersion = solrConfig.luceneMatchVersion;

  // Assert that end-of-life parameters or syntax is not in our config.
  // Warn for luceneMatchVersion's before LUCENE_3_6, fail fast above
  assertWarnOrFail("The <mergeScheduler>myclass</mergeScheduler> syntax is no longer supported in solrconfig.xml. Please use syntax <mergeScheduler class=\"myclass\"/> instead.",
      !((solrConfig.getNode(prefix+"/mergeScheduler",false) != null) && (solrConfig.get(prefix+"/mergeScheduler/@class",null) == null)),
      true);
  assertWarnOrFail("The <mergePolicy>myclass</mergePolicy> syntax is no longer supported in solrconfig.xml. Please use syntax <mergePolicy class=\"myclass\"/> instead.",
      !((solrConfig.getNode(prefix+"/mergePolicy",false) != null) && (solrConfig.get(prefix+"/mergePolicy/@class",null) == null)),
      true);
  assertWarnOrFail("The <luceneAutoCommit>true|false</luceneAutoCommit> parameter is no longer valid in solrconfig.xml.",
      solrConfig.get(prefix+"/luceneAutoCommit", null) == null,
      true);

  defaultMergePolicyClassName = def.defaultMergePolicyClassName;
  useCompoundFile=solrConfig.getBool(prefix+"/useCompoundFile", def.useCompoundFile);
  effectiveUseCompountFileSetting = useCompoundFile;
  maxBufferedDocs=solrConfig.getInt(prefix+"/maxBufferedDocs",def.maxBufferedDocs);
  maxMergeDocs=solrConfig.getInt(prefix+"/maxMergeDocs",def.maxMergeDocs);
  maxIndexingThreads=solrConfig.getInt(prefix+"/maxIndexingThreads",def.maxIndexingThreads);
  mergeFactor=solrConfig.getInt(prefix+"/mergeFactor",def.mergeFactor);
  ramBufferSizeMB = solrConfig.getDouble(prefix+"/ramBufferSizeMB", def.ramBufferSizeMB);

  writeLockTimeout=solrConfig.getInt(prefix+"/writeLockTimeout", def.writeLockTimeout);
  lockType=solrConfig.get(prefix+"/lockType", def.lockType);

  mergeSchedulerInfo = getPluginInfo(prefix + "/mergeScheduler", solrConfig, def.mergeSchedulerInfo);
  mergePolicyInfo = getPluginInfo(prefix + "/mergePolicy", solrConfig, def.mergePolicyInfo);
  
  termIndexInterval = solrConfig.getInt(prefix + "/termIndexInterval", def.termIndexInterval);

  boolean infoStreamEnabled = solrConfig.getBool(prefix + "/infoStream", false);
  if(infoStreamEnabled) {
    String infoStreamFile = solrConfig.get(prefix + "/infoStream/@file", null);
    if (infoStreamFile == null) {
      log.info("IndexWriter infoStream solr logging is enabled");
      infoStream = new LoggingInfoStream();
    } else {
      log.warn("IndexWriter infoStream file log is enabled: " + infoStreamFile +
               "\nThis feature is deprecated. Remove @file from <infoStream> to output messages to solr's logfile");
      File f = new File(infoStreamFile);
      File parent = f.getParentFile();
      if (parent != null) parent.mkdirs();
      try {
        FileOutputStream fos = new FileOutputStream(f, true);
        infoStream = new PrintStreamInfoStream(new PrintStream(fos, true, "UTF-8"));
      } catch (Exception e) {
        log.error("Could not create info stream for file " + infoStreamFile, e);
      }
    }
  }
  mergedSegmentWarmerInfo = getPluginInfo(prefix + "/mergedSegmentWarmer", solrConfig, def.mergedSegmentWarmerInfo);
  if (mergedSegmentWarmerInfo != null && solrConfig.nrtMode == false) {
    throw new IllegalArgumentException("Supplying a mergedSegmentWarmer will do nothing since nrtMode is false");
  }

  checkIntegrityAtMerge = solrConfig.getBool(prefix + "/checkIntegrityAtMerge", def.checkIntegrityAtMerge);
}
 
开发者ID:europeana,项目名称:search,代码行数:80,代码来源:SolrIndexConfig.java

示例2: SolrIndexConfig

import org.apache.solr.core.SolrConfig; //导入方法依赖的package包/类
/**
 * Constructs a SolrIndexConfig which parses the Lucene related config params in solrconfig.xml
 * @param solrConfig the overall SolrConfig object
 * @param prefix the XPath prefix for which section to parse (mandatory)
 * @param def a SolrIndexConfig instance to pick default values from (optional)
 */
@SuppressWarnings("deprecation")
public SolrIndexConfig(SolrConfig solrConfig, String prefix, SolrIndexConfig def)  {
  if (prefix == null) {
    prefix = "indexConfig";
    log.debug("Defaulting to prefix \""+prefix+"\" for index configuration");
  }
  
  if (def == null) {
    def = new SolrIndexConfig(solrConfig);
  }

  luceneVersion = solrConfig.luceneMatchVersion;

  // Assert that end-of-life parameters or syntax is not in our config.
  // Warn for luceneMatchVersion's before LUCENE_36, fail fast above
  assertWarnOrFail("The <mergeScheduler>myclass</mergeScheduler> syntax is no longer supported in solrconfig.xml. Please use syntax <mergeScheduler class=\"myclass\"/> instead.",
      !((solrConfig.get(prefix+"/mergeScheduler/text()",null) != null) && (solrConfig.get(prefix+"/mergeScheduler/@class",null) == null)),
      true);
  assertWarnOrFail("The <mergePolicy>myclass</mergePolicy> syntax is no longer supported in solrconfig.xml. Please use syntax <mergePolicy class=\"myclass\"/> instead.",
      !((solrConfig.get(prefix+"/mergePolicy/text()",null) != null) && (solrConfig.get(prefix+"/mergePolicy/@class",null) == null)),
      true);
  assertWarnOrFail("The <luceneAutoCommit>true|false</luceneAutoCommit> parameter is no longer valid in solrconfig.xml.",
      solrConfig.get(prefix+"/luceneAutoCommit", null) == null,
      true);

  defaultMergePolicyClassName = def.defaultMergePolicyClassName;
  useCompoundFile=solrConfig.getBool(prefix+"/useCompoundFile", def.useCompoundFile);
  maxBufferedDocs=solrConfig.getInt(prefix+"/maxBufferedDocs",def.maxBufferedDocs);
  maxMergeDocs=solrConfig.getInt(prefix+"/maxMergeDocs",def.maxMergeDocs);
  maxIndexingThreads=solrConfig.getInt(prefix+"/maxIndexingThreads",def.maxIndexingThreads);
  mergeFactor=solrConfig.getInt(prefix+"/mergeFactor",def.mergeFactor);
  ramBufferSizeMB = solrConfig.getDouble(prefix+"/ramBufferSizeMB", def.ramBufferSizeMB);

  writeLockTimeout=solrConfig.getInt(prefix+"/writeLockTimeout", def.writeLockTimeout);
  lockType=solrConfig.get(prefix+"/lockType", def.lockType);

  mergeSchedulerInfo = getPluginInfo(prefix + "/mergeScheduler", solrConfig, def.mergeSchedulerInfo);
  mergePolicyInfo = getPluginInfo(prefix + "/mergePolicy", solrConfig, def.mergePolicyInfo);
  
  termIndexInterval = solrConfig.getInt(prefix + "/termIndexInterval", def.termIndexInterval);
  
  boolean infoStreamEnabled = solrConfig.getBool(prefix + "/infoStream", false);
  if(infoStreamEnabled) {
    infoStreamFile= solrConfig.get(prefix + "/infoStream/@file", null);
    log.info("IndexWriter infoStream debug log is enabled: " + infoStreamFile);
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:54,代码来源:SolrIndexConfig.java

示例3: SolrIndexConfig

import org.apache.solr.core.SolrConfig; //导入方法依赖的package包/类
/**
 * Constructs a SolrIndexConfig which parses the Lucene related config params in solrconfig.xml
 * @param solrConfig the overall SolrConfig object
 * @param prefix the XPath prefix for which section to parse (mandatory)
 * @param def a SolrIndexConfig instance to pick default values from (optional)
 */
@SuppressWarnings("deprecation")
public SolrIndexConfig(SolrConfig solrConfig, String prefix, SolrIndexConfig def)  {
  if (prefix == null) {
    prefix = "indexConfig";
    log.debug("Defaulting to prefix \""+prefix+"\" for index configuration");
  }
  
  if (def == null) {
    def = new SolrIndexConfig(solrConfig);
  }

  // sanity check: this will throw an error for us if there is more then one
  // config section
  Object unused = solrConfig.getNode(prefix, false);

  luceneVersion = solrConfig.luceneMatchVersion;

  // Assert that end-of-life parameters or syntax is not in our config.
  // Warn for luceneMatchVersion's before LUCENE_36, fail fast above
  assertWarnOrFail("The <mergeScheduler>myclass</mergeScheduler> syntax is no longer supported in solrconfig.xml. Please use syntax <mergeScheduler class=\"myclass\"/> instead.",
      !((solrConfig.getNode(prefix+"/mergeScheduler",false) != null) && (solrConfig.get(prefix+"/mergeScheduler/@class",null) == null)),
      true);
  assertWarnOrFail("The <mergePolicy>myclass</mergePolicy> syntax is no longer supported in solrconfig.xml. Please use syntax <mergePolicy class=\"myclass\"/> instead.",
      !((solrConfig.getNode(prefix+"/mergePolicy",false) != null) && (solrConfig.get(prefix+"/mergePolicy/@class",null) == null)),
      true);
  assertWarnOrFail("The <luceneAutoCommit>true|false</luceneAutoCommit> parameter is no longer valid in solrconfig.xml.",
      solrConfig.get(prefix+"/luceneAutoCommit", null) == null,
      true);

  defaultMergePolicyClassName = def.defaultMergePolicyClassName;
  useCompoundFile=solrConfig.getBool(prefix+"/useCompoundFile", def.useCompoundFile);
  effectiveUseCompountFileSetting = useCompoundFile;
  maxBufferedDocs=solrConfig.getInt(prefix+"/maxBufferedDocs",def.maxBufferedDocs);
  maxMergeDocs=solrConfig.getInt(prefix+"/maxMergeDocs",def.maxMergeDocs);
  maxIndexingThreads=solrConfig.getInt(prefix+"/maxIndexingThreads",def.maxIndexingThreads);
  mergeFactor=solrConfig.getInt(prefix+"/mergeFactor",def.mergeFactor);
  ramBufferSizeMB = solrConfig.getDouble(prefix+"/ramBufferSizeMB", def.ramBufferSizeMB);

  writeLockTimeout=solrConfig.getInt(prefix+"/writeLockTimeout", def.writeLockTimeout);
  lockType=solrConfig.get(prefix+"/lockType", def.lockType);

  mergeSchedulerInfo = getPluginInfo(prefix + "/mergeScheduler", solrConfig, def.mergeSchedulerInfo);
  mergePolicyInfo = getPluginInfo(prefix + "/mergePolicy", solrConfig, def.mergePolicyInfo);
  
  termIndexInterval = solrConfig.getInt(prefix + "/termIndexInterval", def.termIndexInterval);

  boolean infoStreamEnabled = solrConfig.getBool(prefix + "/infoStream", false);
  if(infoStreamEnabled) {
    String infoStreamFile = solrConfig.get(prefix + "/infoStream/@file", null);
    if (infoStreamFile == null) {
      log.info("IndexWriter infoStream solr logging is enabled");
      infoStream = new LoggingInfoStream();
    } else {
      log.warn("IndexWriter infoStream file log is enabled: " + infoStreamFile +
               "\nThis feature is deprecated. Remove @file from <infoStream> to output messages to solr's logfile");
      File f = new File(infoStreamFile);
      File parent = f.getParentFile();
      if (parent != null) parent.mkdirs();
      try {
        FileOutputStream fos = new FileOutputStream(f, true);
        infoStream = new PrintStreamInfoStream(new PrintStream(fos, true, "UTF-8"));
      } catch (Exception e) {
        log.error("Could not create info stream for file " + infoStreamFile, e);
      }
    }
  }
  mergedSegmentWarmerInfo = getPluginInfo(prefix + "/mergedSegmentWarmer", solrConfig, def.mergedSegmentWarmerInfo);
  if (mergedSegmentWarmerInfo != null && solrConfig.nrtMode == false) {
    throw new IllegalArgumentException("Supplying a mergedSegmentWarmer will do nothing since nrtMode is false");
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:78,代码来源:SolrIndexConfig.java


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