本文整理汇总了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());
}
示例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());
}
示例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());
}
示例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());
}
}
示例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");
}
}
示例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);
}