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