本文整理汇总了Java中org.apache.solr.core.SolrConfig.getNode方法的典型用法代码示例。如果您正苦于以下问题:Java SolrConfig.getNode方法的具体用法?Java SolrConfig.getNode怎么用?Java SolrConfig.getNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.core.SolrConfig
的用法示例。
在下文中一共展示了SolrConfig.getNode方法的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);
}
示例2: getConfig
import org.apache.solr.core.SolrConfig; //导入方法依赖的package包/类
public static CacheConfig getConfig(SolrConfig solrConfig, String xpath) {
Node node = solrConfig.getNode(xpath, false);
return getConfig(solrConfig, node);
}
示例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");
}
}