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


Java UpdateRequest.clear方法代码示例

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


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

示例1: testMergeIndexesByDirName

import org.apache.solr.client.solrj.request.UpdateRequest; //导入方法依赖的package包/类
public void testMergeIndexesByDirName() throws Exception {
  UpdateRequest up = setupCores();

  // Now get the index directory of core1 and merge with core0
  CoreAdminRequest.mergeIndexes("core0", new String[] {getIndexDirCore1()}, new String[0], getSolrAdmin());

  // Now commit the merged index
  up.clear(); // just do commit
  up.process(getSolrCore0());

  assertEquals(1,
      getSolrCore0().query(new SolrQuery("id:AAA")).getResults().size());
  assertEquals(1,
      getSolrCore0().query(new SolrQuery("id:BBB")).getResults().size());
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:MergeIndexesExampleTestBase.java

示例2: testMergeIndexesByCoreName

import org.apache.solr.client.solrj.request.UpdateRequest; //导入方法依赖的package包/类
public void testMergeIndexesByCoreName() throws Exception {
  UpdateRequest up = setupCores();
  CoreAdminRequest.mergeIndexes("core0", new String[0], new String[] {"core1"}, getSolrAdmin());

  // Now commit the merged index
  up.clear(); // just do commit
  up.process(getSolrCore0());

  assertEquals(1,
      getSolrCore0().query(new SolrQuery("id:AAA")).getResults().size());
  assertEquals(1,
      getSolrCore0().query(new SolrQuery("id:BBB")).getResults().size());
}
 
开发者ID:europeana,项目名称:search,代码行数:14,代码来源:MergeIndexesExampleTestBase.java

示例3: setupCores

import org.apache.solr.client.solrj.request.UpdateRequest; //导入方法依赖的package包/类
private UpdateRequest setupCores() throws SolrServerException, IOException {
  UpdateRequest up = new UpdateRequest();
  up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
  up.deleteByQuery("*:*");
  up.process(getSolrCore0());
  up.process(getSolrCore1());
  up.clear();

  // Add something to each core
  SolrInputDocument doc = new SolrInputDocument();
  doc.setField("id", "AAA");
  doc.setField("name", "core0");

  // Add to core0
  up.add(doc);
  up.process(getSolrCore0());

  // Add to core1
  doc.setField("id", "BBB");
  doc.setField("name", "core1");
  up.add(doc);
  up.process(getSolrCore1());

  // Now Make sure AAA is in 0 and BBB in 1
  SolrQuery q = new SolrQuery();
  QueryRequest r = new QueryRequest(q);
  q.setQuery("id:AAA");
  assertEquals(1, r.process(getSolrCore0()).getResults().size());
  assertEquals(0, r.process(getSolrCore1()).getResults().size());

  assertEquals(1,
      getSolrCore0().query(new SolrQuery("id:AAA")).getResults().size());
  assertEquals(0,
      getSolrCore0().query(new SolrQuery("id:BBB")).getResults().size());

  assertEquals(0,
      getSolrCore1().query(new SolrQuery("id:AAA")).getResults().size());
  assertEquals(1,
      getSolrCore1().query(new SolrQuery("id:BBB")).getResults().size());

  return up;
}
 
开发者ID:europeana,项目名称:search,代码行数:43,代码来源:MergeIndexesExampleTestBase.java


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