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


Java SolrConfig.getPluginInfo方法代码示例

本文整理汇总了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;
}
 
开发者ID:europeana,项目名称:search,代码行数:27,代码来源:IndexSchemaFactory.java

示例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;
}
 
开发者ID:europeana,项目名称:search,代码行数:14,代码来源:IndexSchemaFactory.java


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