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


Java ClusteringEngine类代码示例

本文整理汇总了Java中org.apache.solr.handler.clustering.ClusteringEngine的典型用法代码示例。如果您正苦于以下问题:Java ClusteringEngine类的具体用法?Java ClusteringEngine怎么用?Java ClusteringEngine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ClusteringEngine类属于org.apache.solr.handler.clustering包,在下文中一共展示了ClusteringEngine类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testDefaultEngineOrder

import org.apache.solr.handler.clustering.ClusteringEngine; //导入依赖的package包/类
@Test
public void testDefaultEngineOrder() throws Exception {
  ClusteringComponent comp = (ClusteringComponent) h.getCore().getSearchComponent("clustering-name-default");
  Map<String,SearchClusteringEngine> engines = getSearchClusteringEngines(comp);
  assertEquals(
      Lists.newArrayList("stc", "default", "mock"),
      Lists.newArrayList(engines.keySet()));
  assertEquals(
      LingoClusteringAlgorithm.class,
      ((CarrotClusteringEngine) engines.get(ClusteringEngine.DEFAULT_ENGINE_NAME)).getClusteringAlgorithmClass());
}
 
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:CarrotClusteringEngineTest.java

示例2: testDeclarationEngineOrder

import org.apache.solr.handler.clustering.ClusteringEngine; //导入依赖的package包/类
@Test
public void testDeclarationEngineOrder() throws Exception {
  ClusteringComponent comp = (ClusteringComponent) h.getCore().getSearchComponent("clustering-name-decl-order");
  Map<String,SearchClusteringEngine> engines = getSearchClusteringEngines(comp);
  assertEquals(
      Lists.newArrayList("lingo", "stc", "mock", "default"),
      Lists.newArrayList(engines.keySet()));
  assertEquals(
      LingoClusteringAlgorithm.class,
      ((CarrotClusteringEngine) engines.get(ClusteringEngine.DEFAULT_ENGINE_NAME)).getClusteringAlgorithmClass());
}
 
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:CarrotClusteringEngineTest.java

示例3: testDeclarationNameDuplicates

import org.apache.solr.handler.clustering.ClusteringEngine; //导入依赖的package包/类
@Test
public void testDeclarationNameDuplicates() throws Exception {
  ClusteringComponent comp = (ClusteringComponent) h.getCore().getSearchComponent("clustering-name-dups");
  Map<String,SearchClusteringEngine> engines = getSearchClusteringEngines(comp);
  assertEquals(
      Lists.newArrayList("", "default"),
      Lists.newArrayList(engines.keySet()));
  assertEquals(
      MockClusteringAlgorithm.class,
      ((CarrotClusteringEngine) engines.get(ClusteringEngine.DEFAULT_ENGINE_NAME)).getClusteringAlgorithmClass());
}
 
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:CarrotClusteringEngineTest.java

示例4: setupDefaultEngine

import org.apache.solr.handler.clustering.ClusteringEngine; //导入依赖的package包/类
/**
 * Setup the default clustering engine.
 * @see "https://issues.apache.org/jira/browse/SOLR-5219"
 */
private static <T extends ClusteringEngine> void setupDefaultEngine(String type, LinkedHashMap<String,T> map) {
  // If there's already a default algorithm, leave it as is.
  if (map.containsKey(ClusteringEngine.DEFAULT_ENGINE_NAME)) {
    return;
  }

  // If there's no default algorithm, and there are any algorithms available, 
  // the first definition becomes the default algorithm.
  if (!map.isEmpty()) {
    Entry<String,T> first = map.entrySet().iterator().next();
    map.put(ClusteringEngine.DEFAULT_ENGINE_NAME, first.getValue());
    log.info("Default engine for " + type + ": " + first.getKey());
  }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:19,代码来源:AlfrescoSolrClusteringComponent.java

示例5: inform

import org.apache.solr.handler.clustering.ClusteringEngine; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void inform(SolrCore core) {
  if (initParams != null) {
    log.info("Initializing Clustering Engines");

    // Our target list of engines, split into search-results and document clustering.
    SolrResourceLoader loader = core.getResourceLoader();

    for (Map.Entry<String,Object> entry : initParams) {
      if ("engine".equals(entry.getKey())) {
        NamedList<Object> engineInitParams = (NamedList<Object>) entry.getValue();
        
        String engineClassName = StringUtils.defaultIfBlank( 
            (String) engineInitParams.get("classname"),
            CarrotClusteringEngine.class.getName()); 

        // Instantiate the clustering engine and split to appropriate map. 
        final ClusteringEngine engine = loader.newInstance(engineClassName, ClusteringEngine.class);
        final String name = StringUtils.defaultIfBlank(engine.init(engineInitParams, core), "");
        final ClusteringEngine previousEntry;
        if (engine instanceof SearchClusteringEngine) {
          previousEntry = searchClusteringEngines.put(name, (SearchClusteringEngine) engine);
        } else if (engine instanceof DocumentClusteringEngine) {
          previousEntry = documentClusteringEngines.put(name, (DocumentClusteringEngine) engine);
        } else {
          log.warn("Unknown type of a clustering engine for class: " + engineClassName);
          continue;
        }
        if (previousEntry != null) {
          log.warn("Duplicate clustering engine component named '" + name + "'.");
        }
      }
    }

    // Set up the default engine key for both types of engines.
    setupDefaultEngine("search results clustering", searchClusteringEngines);
    setupDefaultEngine("document clustering", documentClusteringEngines);

    log.info("Finished Initializing Clustering Engines");
  }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:43,代码来源:AlfrescoSolrClusteringComponent.java

示例6: getClusteringEngineName

import org.apache.solr.handler.clustering.ClusteringEngine; //导入依赖的package包/类
private String getClusteringEngineName(ResponseBuilder rb){
  return rb.req.getParams().get(ClusteringParams.ENGINE_NAME, ClusteringEngine.DEFAULT_ENGINE_NAME);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:4,代码来源:AlfrescoSolrClusteringComponent.java


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