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


Java ConcurrentUpdateSolrServer.add方法代码示例

本文整理汇总了Java中org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer.add方法的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentUpdateSolrServer.add方法的具体用法?Java ConcurrentUpdateSolrServer.add怎么用?Java ConcurrentUpdateSolrServer.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer的用法示例。


在下文中一共展示了ConcurrentUpdateSolrServer.add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: concurrentUpdateSolrServer

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入方法依赖的package包/类
/**
 * Uses the {@link HttpSolrServer} to index some data to Solr.
 * 
 * @throws Exception in case of I/O or index failure.
 */
@Test
public void concurrentUpdateSolrServer() throws Exception {
	final int bufferSize = 2; // commit each 2 albums
	final int threadsNo = 2; // Use two indexer threads
	
	// 1. Create a new instance of HttpSolrServer 
	// Note that we are simply repeating the same server three times, in order to "simulate" a
	// scenario with three searchers.
	// In a real context we would have three different urls.
	solr = new ConcurrentUpdateSolrServer(SOLR_URI, bufferSize, threadsNo);		
	
	// 2. Create some data
	final List<SolrInputDocument> albums = sampleData();
	
	// 3. Add those data
	solr.add(albums);
	
	// 4. Commit
	solr.commit();
	
	// 5. Verify
	verify();
}
 
开发者ID:agazzarini,项目名称:apache-solr-essentials,代码行数:29,代码来源:SolrServersITCase.java

示例2: indexData

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入方法依赖的package包/类
/**
 * Indexes a set of sample documents.
 * 
 * @throws SolrServerException in case of Solr internal failure,
 * @throws IOException in case of I/O failure.
 */
@BeforeClass
public static void indexData() throws SolrServerException, IOException {
	// 1. Create a proxy indexer 
	INDEXER = new ConcurrentUpdateSolrServer(SOLR_URI, 2, 1);

	// 2. Index sample data
	INDEXER.add(sampleData());
	
	// 3. Commit changes
	INDEXER.commit();
	
	// 4. Create a proxy searcher
	SEARCHER = new HttpSolrServer(SOLR_URI);
}
 
开发者ID:agazzarini,项目名称:apache-solr-essentials,代码行数:21,代码来源:SearchITCase.java


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