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


Java ConcurrentUpdateSolrServer类代码示例

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


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

示例1: getXMLFilter

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Override
public XMLFilter getXMLFilter(ArgFactory arf, InputCommandFactory.InputCommand inputBase, CommandType maxType) {
    if (!init(parser.parse(arf.getArgs(parser.recognizedOptions().keySet())), inputBase)) {
        return null;
    }
    CommandFactory.conditionalInit(first, inputBase, EXPECT_INPUT);
    SAXSolrPoster ssp = new SAXSolrPoster();
    ssp.setServer(new ConcurrentUpdateSolrServer(solrURL, queueSize, threadCount));
    if (first && inputBase.getFilesFrom() != null) {
        ssp.setInputType(QueueSourceXMLFilter.InputType.indirect);
        if (inputBase.getDelim() != null) {
            ssp.setDelimiterPattern(Pattern.compile(inputBase.getDelim(), Pattern.LITERAL));
        }
    }
    return ssp;
}
 
开发者ID:upenn-libraries,项目名称:xmlaminar,代码行数:17,代码来源:SolrPostCommandFactory.java

示例2: testIndexingWithSuss

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
private long testIndexingWithSuss(long docId) throws Exception {
  ConcurrentUpdateSolrServer suss = new ConcurrentUpdateSolrServer(
      ((HttpSolrServer) clients.get(0)).getBaseURL(), 10, 2);
  QueryResponse results = query(cloudClient);
  long beforeCount = results.getResults().getNumFound();
  int cnt = TEST_NIGHTLY ? 2933 : 313;
  try {
    suss.setConnectionTimeout(120000);
    for (int i = 0; i < cnt; i++) {
      index_specific(suss, id, docId++, "text_t", "some text so that it not's negligent work to parse this doc, even though it's still a pretty short doc");
    }
    suss.blockUntilFinished();
    
    commit();

    checkShardConsistency();
    assertDocCounts(VERBOSE);
  } finally {
    suss.shutdown();
  }
  results = query(cloudClient);
  assertEquals(beforeCount + cnt, results.getResults().getNumFound());
  return docId;
}
 
开发者ID:europeana,项目名称:search,代码行数:25,代码来源:FullSolrCloudDistribCmdsTest.java

示例3: FullThrottleStopableIndexingThread

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
public FullThrottleStopableIndexingThread(List<SolrServer> clients,
    String id, boolean doDeletes) {
  super(controlClient, cloudClient, id, doDeletes);
  setName("FullThrottleStopableIndexingThread");
  setDaemon(true);
  this.clients = clients;
  HttpClientUtil.setConnectionTimeout(httpClient, 15000);
  HttpClientUtil.setSoTimeout(httpClient, 15000);
  suss = new ConcurrentUpdateSolrServer(
      ((HttpSolrServer) clients.get(0)).getBaseURL(), httpClient, 8,
      2) {
    @Override
    public void handleError(Throwable ex) {
      log.warn("suss error", ex);
    }
  };
}
 
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:ChaosMonkeyNothingIsSafeTest.java

示例4: FullThrottleStopableIndexingThread

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
public FullThrottleStopableIndexingThread(List<SolrServer> clients,
    int startI, boolean doDeletes) {
  super(startI, doDeletes);
  setName("FullThrottleStopableIndexingThread");
  setDaemon(true);
  this.clients = clients;
  HttpClientUtil.setConnectionTimeout(httpClient, 15000);
  HttpClientUtil.setSoTimeout(httpClient, 15000);
  suss = new ConcurrentUpdateSolrServer(
      ((HttpSolrServer) clients.get(0)).getBaseURL(), httpClient, 8,
      2) {
    @Override
    public void handleError(Throwable ex) {
      log.warn("suss error", ex);
    }
  };
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:18,代码来源:ChaosMonkeyNothingIsSafeTest.java

示例5: buildUpdateSolrServer

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
/**
 * 建造更新用Server
 */
private void buildUpdateSolrServer() {
	this.validConf(); // 必须是已配置的对象
	if (this.isSingle()) { // 必须是单服务器节点
		Type type = this.conf.getType();
		// 标准SolrServer
		if (type.accept(HttpSolrServer.class)) {
			this.httpSolrServer = this.buildHttpSolrServer();
		}
		// 更新用SolrServer
		if (type.accept(ConcurrentUpdateSolrServer.class)) {
			this.updateSolrServer = this.buildConcurrentUpdateSolrServer();
		} else if (type.accept(HttpSolrServer.class)) {
			this.updateSolrServer = this.httpSolrServer;
		}
	}
	this.updateSolrServerBuilt = true;
}
 
开发者ID:dowenliu-xyz,项目名称:solrj-util,代码行数:21,代码来源:SolrServerFactory.java

示例6: accept

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Override
public boolean accept(Class<?> solrServerClass) {
	if (solrServerClass == null) {
		return false;
	}
	if (ConcurrentUpdateSolrServer.class.equals(solrServerClass)) {
		return true;
	}
	if (HttpSolrServer.class.equals(solrServerClass)) {
		return true;
	}
	if (this.accept(solrServerClass.getSuperclass())) {
		return true;
	}
	return false;
}
 
开发者ID:dowenliu-xyz,项目名称:solrj-util,代码行数:17,代码来源:SolrServerConfiguration.java

示例7: testFactory

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Test
@Ignore
public void testFactory() {
	assertNotNull(masterFactory);
	SolrServer solrServer = this.masterFactory.getUpdateSolrServer();
	assertTrue(solrServer instanceof ConcurrentUpdateSolrServer);
	solrServer = this.masterFactory.getUpdateSolrServer(true);
	assertTrue(solrServer.getClass().equals(HttpSolrServer.class));
	solrServer = this.masterFactory.getQuerySolrServer();
	assertTrue(solrServer.getClass().equals(HttpSolrServer.class));
	assertNotNull(slavesFactory);
	solrServer = this.slavesFactory.getUpdateSolrServer();
	assertTrue(solrServer == null);
	solrServer = this.slavesFactory.getUpdateSolrServer(true);
	assertTrue(solrServer == null);
	solrServer = this.slavesFactory.getQuerySolrServer();
	assertTrue(solrServer instanceof LBHttpSolrServer);
}
 
开发者ID:dowenliu-xyz,项目名称:solrj-util,代码行数:19,代码来源:SolrServerFactoryTest.java

示例8: 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

示例9: shutdown

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Override
public void shutdown() {
    if (server instanceof ConcurrentUpdateSolrServer) {
        ((ConcurrentUpdateSolrServer) server).blockUntilFinished();
    }
    server.shutdown();
}
 
开发者ID:upenn-libraries,项目名称:xmlaminar,代码行数:8,代码来源:SAXSolrPoster.java

示例10: testWaitOptions

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
public void testWaitOptions() throws Exception {
  // SOLR-3903
  final List<Throwable> failures = new ArrayList<>();
  ConcurrentUpdateSolrServer s = new ConcurrentUpdateSolrServer
    (jetty.getBaseUrl().toString() + "/collection1", 2, 2) {
      @Override
      public void handleError(Throwable ex) {
        failures.add(ex);
      }
    };
    
  int docId = 42;
  for (UpdateRequest.ACTION action : EnumSet.allOf(UpdateRequest.ACTION.class)) {
    for (boolean waitSearch : Arrays.asList(true, false)) {
      for (boolean waitFlush : Arrays.asList(true, false)) {
        UpdateRequest updateRequest = new UpdateRequest();
        SolrInputDocument document = new SolrInputDocument();
        document.addField("id", docId++ );
        updateRequest.add(document);
        updateRequest.setAction(action, waitSearch, waitFlush);
        s.request(updateRequest);
      }
    }
  }
  s.commit();
  s.blockUntilFinished();
  s.shutdown();

  if (0 != failures.size()) {
    assertEquals(failures.size() + " Unexpected Exception, starting with...", 
                 null, failures.get(0));
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:34,代码来源:SolrExampleStreamingTest.java

示例11: createNewSolrServer

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Override
public SolrServer createNewSolrServer() {
  ConcurrentUpdateSolrServer s = (ConcurrentUpdateSolrServer)super.createNewSolrServer();
  s.setParser(new BinaryResponseParser());
  s.setRequestWriter(new BinaryRequestWriter());
  return s;
}
 
开发者ID:europeana,项目名称:search,代码行数:8,代码来源:SolrExampleStreamingBinaryTest.java

示例12: commitTransaction

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Override
public void commitTransaction() throws SolrServerException, IOException {
  LOGGER.trace("commitTransaction");
  if (batch.size() > 0) {
    loadBatch();
  }
  if (numLoadedDocs > 0) {
    if (server instanceof ConcurrentUpdateSolrServer) {
      ((ConcurrentUpdateSolrServer) server).blockUntilFinished();
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:SolrServerDocumentLoader.java

示例13: afterPropertiesSet

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
    if (querySolrServer instanceof HttpSolrServer) {
        HttpSolrServer httpSolrServer = (HttpSolrServer) querySolrServer;
        this.updateSolrServer = new ConcurrentUpdateSolrServer(httpSolrServer.getBaseURL(), httpSolrServer.getHttpClient(), 20, 4);
    } else {
        this.updateSolrServer = querySolrServer;
    }
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:10,代码来源:DefaultSolrDao.java

示例14: createAndConfigure

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
@Override
public SolrServer createAndConfigure(final String role, final Configuration<Map<String, Object>> configuration) {
	return new ConcurrentUpdateSolrServer(
			configuration.getParameter(role + ADDRESS, DEFAULT_ADDRESS), 
			configuration.getParameter(role + QUEUE_SIZE, DEFAULT_QUEUE_SIZE),
			configuration.getParameter(role + THREAD_COUNT, DEFAULT_THREAD_COUNT));
}
 
开发者ID:spaziocodice,项目名称:jena-nosql,代码行数:8,代码来源:SolrStorageLayerFactory.java

示例15: init

import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer; //导入依赖的package包/类
public void init() {
	HttpClientBuilder clientBuilder = HttpClientBuilder.create(); 
	httpClient = clientBuilder.build();
	searchServer = new HttpSolrServer(solrUrl, httpClient);
	searchServer.setRequestWriter(new BinaryRequestWriter());
	updateServer = new ConcurrentUpdateSolrServer(solrUrl, 5000, 10);
	updateServer.setRequestWriter(new BinaryRequestWriter());
}
 
开发者ID:mhinters,项目名称:BannedBookUtils,代码行数:9,代码来源:SolrClient.java


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