本文整理汇总了Java中org.apache.solr.core.SolrConfig.getPluginInfo方法的典型用法代码示例。如果您正苦于以下问题:Java SolrConfig.getPluginInfo方法的具体用法?Java SolrConfig.getPluginInfo怎么用?Java SolrConfig.getPluginInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.core.SolrConfig
的用法示例。
在下文中一共展示了SolrConfig.getPluginInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getResourceNameToBeUsed
import org.apache.solr.core.SolrConfig; //导入方法依赖的package包/类
/**
* Returns the resource name that will be used: if the schema is managed, the resource
* name will be drawn from the schema factory configuration in the given SolrConfig.
* Otherwise, the given resourceName will be returned.
*
* @param resourceName The name to use if the schema is not managed
* @param config The SolrConfig from which to get the schema factory config
* @return If the schema is managed, the resource name from the given SolrConfig,
* otherwise the given resourceName.
*/
public static String getResourceNameToBeUsed(String resourceName, SolrConfig config) {
PluginInfo info = config.getPluginInfo(IndexSchemaFactory.class.getName());
final String nonManagedResourceName = null == resourceName ? IndexSchema.DEFAULT_SCHEMA_FILE : resourceName;
if (null == info) {
return nonManagedResourceName;
}
String managedSchemaResourceName
= (String)info.initArgs.get(ManagedIndexSchemaFactory.MANAGED_SCHEMA_RESOURCE_NAME);
if (null == managedSchemaResourceName) {
managedSchemaResourceName = ManagedIndexSchemaFactory.DEFAULT_MANAGED_SCHEMA_RESOURCE_NAME;
}
if ((new File(config.getResourceLoader().getConfigDir(), managedSchemaResourceName)).exists()) {
return managedSchemaResourceName;
}
return nonManagedResourceName;
}
示例2: buildIndexSchema
import org.apache.solr.core.SolrConfig; //导入方法依赖的package包/类
/** Instantiates the configured schema factory, then calls create on it. */
public static IndexSchema buildIndexSchema(String resourceName, SolrConfig config) {
PluginInfo info = config.getPluginInfo(IndexSchemaFactory.class.getName());
IndexSchemaFactory factory;
if (null != info) {
factory = config.getResourceLoader().newInstance(info.className, IndexSchemaFactory.class);
factory.init(info.initArgs);
} else {
factory = new ClassicIndexSchemaFactory();
}
IndexSchema schema = factory.create(resourceName, config);
return schema;
}