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


Java ContentStreamUpdateRequest.setCommitWithin方法代码示例

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


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

示例1: testNumberOfCommitsWithCommitAfterAdd

import org.apache.solr.client.solrj.request.ContentStreamUpdateRequest; //导入方法依赖的package包/类
private void testNumberOfCommitsWithCommitAfterAdd()
    throws SolrServerException, IOException {
  log.info("### STARTING testNumberOfCommitsWithCommitAfterAdd");
  long startCommits = getNumCommits((HttpSolrServer) clients.get(0));
  
  ContentStreamUpdateRequest up = new ContentStreamUpdateRequest("/update");
  up.addFile(getFile("books_numeric_ids.csv"), "application/csv");
  up.setCommitWithin(900000);
  up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
  NamedList<Object> result = clients.get(0).request(up);
  
  long endCommits = getNumCommits((HttpSolrServer) clients.get(0));

  assertEquals(startCommits + 1L, endCommits);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:16,代码来源:BasicDistributedZkTest.java

示例2: index

import org.apache.solr.client.solrj.request.ContentStreamUpdateRequest; //导入方法依赖的package包/类
@Override
public void index() throws SolrServerException, IOException {
    String solrID = file.toUri().toString();
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Solr: indexing file \"{}\"", file);
    }
    /* create the update request object */
    ContentStreamUpdateRequest updateRequest = new ContentStreamUpdateRequest(EXTRACT_PATH);
    updateRequest.addContentStream(getStream());

    /* set the additional parameters */
    updateRequest.setParams(getSolrParams(file, attrs));
    updateRequest.setCommitWithin(getCommitWithin());

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Solr: sending binary data ({} ({}), size is {}) to solr server.", file, solrID,
            MCRUtils.getSizeFormatted(attrs.size()));
    }
    long t = System.currentTimeMillis();
    /* actually send the request */
    getSolrClient().request(updateRequest);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Solr: sending binary data \"{} ({})\" done in {}ms", file, solrID,
            System.currentTimeMillis() - t);
    }
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:27,代码来源:MCRSolrFileIndexHandler.java

示例3: index

import org.apache.solr.client.solrj.request.ContentStreamUpdateRequest; //导入方法依赖的package包/类
public void index() throws IOException, SolrServerException {
    long tStart = System.currentTimeMillis();
    ContentStreamUpdateRequest updateRequest = new ContentStreamUpdateRequest(UPDATE_PATH);
    updateRequest.addContentStream(getStream());
    if (STYLESHEET.length() > 0) {
        updateRequest.setParam("tr", STYLESHEET);
    }
    updateRequest.setCommitWithin(getCommitWithin());
    NamedList<Object> request = getSolrClient().request(updateRequest);
    if (LOGGER.isDebugEnabled()) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("Solr: indexing data of \"");
        stringBuilder.append(this);
        stringBuilder.append("\" (");
        stringBuilder.append((System.currentTimeMillis() - tStart));
        stringBuilder.append("ms)");
        for (Map.Entry<String, Object> entry : request) {
            stringBuilder.append('\n');
            stringBuilder.append(entry.getKey());
            stringBuilder.append('=');
            stringBuilder.append(entry.getValue());
        }
        LOGGER.debug(stringBuilder.toString());
    }
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:26,代码来源:MCRSolrObjectStreamIndexHandler.java


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