本文整理汇总了Java中org.apache.solr.common.params.UpdateParams类的典型用法代码示例。如果您正苦于以下问题:Java UpdateParams类的具体用法?Java UpdateParams怎么用?Java UpdateParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UpdateParams类属于org.apache.solr.common.params包,在下文中一共展示了UpdateParams类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: indexDocumentsToCSVUpdateHandlerWithoutParameters
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
@Test
public void indexDocumentsToCSVUpdateHandlerWithoutParameters() throws Exception {
solrEndpoint.setRequestHandler("/update/csv");
Exchange exchange = createExchangeWithBody(new File("src/test/resources/data/books.csv"));
exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
exchange.getIn().setHeader(SolrConstants.PARAM + UpdateParams.ASSUME_CONTENT_TYPE, "text/csv");
template.send("direct:start", exchange);
solrCommit();
QueryResponse response = executeSolrQuery("*:*");
assertEquals(0, response.getStatus());
assertEquals(10, response.getResults().getNumFound());
response = executeSolrQuery("id:0553573403");
SolrDocument doc = response.getResults().get(0);
assertEquals("A Game of Thrones", doc.getFieldValue("name"));
assertEquals(7.99f, doc.getFieldValue("price"));
}
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:SolrUpdateTest.java
示例2: indexDocumentsToCSVUpdateHandlerWithParameters
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
@Test
public void indexDocumentsToCSVUpdateHandlerWithParameters() throws Exception {
solrEndpoint.setRequestHandler("/update/csv");
Exchange exchange = createExchangeWithBody(new File("src/test/resources/data/books.csv"));
exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
exchange.getIn().setHeader(SolrConstants.PARAM + UpdateParams.ASSUME_CONTENT_TYPE, "text/csv");
exchange.getIn().setHeader("SolrParam.fieldnames", "id,cat,name,price,inStock,author_t,series_t,sequence_i,genre_s");
exchange.getIn().setHeader("SolrParam.skip", "cat,sequence_i,genre_s");
exchange.getIn().setHeader("SolrParam.skipLines", 1);
template.send("direct:start", exchange);
solrCommit();
QueryResponse response = executeSolrQuery("*:*");
assertEquals(0, response.getStatus());
assertEquals(10, response.getResults().getNumFound());
SolrDocument doc = response.getResults().get(0);
assertFalse(doc.getFieldNames().contains("cat"));
}
开发者ID:HydAu,项目名称:Camel,代码行数:22,代码来源:SolrUpdateTest.java
示例3: ExtractingDocumentLoader
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
public ExtractingDocumentLoader(SolrQueryRequest req, UpdateRequestProcessor processor,
TikaConfig config, SolrContentHandlerFactory factory) {
this.params = req.getParams();
this.core = req.getCore();
this.config = config;
this.processor = processor;
templateAdd = new AddUpdateCommand(req);
templateAdd.overwrite = params.getBool(UpdateParams.OVERWRITE, true);
templateAdd.commitWithin = params.getInt(UpdateParams.COMMIT_WITHIN, -1);
//this is lightweight
autoDetectParser = new AutoDetectParser(config);
this.factory = factory;
ignoreTikaException = params.getBool(ExtractingParams.IGNORE_TIKA_EXCEPTION, false);
}
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:ExtractingDocumentLoader.java
示例4: testCommitWithin
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
@Test
public void testCommitWithin() throws Exception {
DirectXmlRequest req = new DirectXmlRequest("/dataimport", xml);
ModifiableSolrParams params = params("command", "full-import",
"clean", "false", UpdateParams.COMMIT, "false",
UpdateParams.COMMIT_WITHIN, "1000");
req.setParams(params);
HttpSolrServer solrServer = new HttpSolrServer(buildUrl(jetty.getLocalPort(), "/solr"));
solrServer.request(req);
Thread.sleep(100);
ModifiableSolrParams queryAll = params("q", "*");
QueryResponse qres = solrServer.query(queryAll);
SolrDocumentList results = qres.getResults();
assertEquals(0, results.getNumFound());
Thread.sleep(1000);
for (int i = 0; i < 10; i++) {
qres = solrServer.query(queryAll);
results = qres.getResults();
if (2 == results.getNumFound()) {
solrServer.shutdown();
return;
}
Thread.sleep(500);
}
fail("Commit should have occured but it did not");
}
开发者ID:europeana,项目名称:search,代码行数:27,代码来源:TestContentStreamDataSource.java
示例5: load
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
@Override
public void load(SolrQueryRequest req, SolrQueryResponse rsp,
ContentStream stream, UpdateRequestProcessor processor) throws Exception {
String type = req.getParams().get(UpdateParams.ASSUME_CONTENT_TYPE);
if(type == null) {
type = stream.getContentType();
}
if( type == null ) { // Normal requests will not get here.
throw new SolrException(ErrorCode.UNSUPPORTED_MEDIA_TYPE, "Missing ContentType");
}
int idx = type.indexOf(';');
if(idx>0) {
type = type.substring(0,idx);
}
ContentStreamLoader loader = loaders.get(type);
if(loader==null) {
throw new SolrException(ErrorCode.UNSUPPORTED_MEDIA_TYPE, "Unsupported ContentType: "
+type+ " Not in: "+loaders.keySet());
}
if(loader.getDefaultWT()!=null) {
setDefaultWT(req,loader);
}
loader.load(req, rsp, stream, processor);
}
开发者ID:europeana,项目名称:search,代码行数:26,代码来源:UpdateRequestHandler.java
示例6: testDistribOpenSearcher
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
private void testDistribOpenSearcher() {
SolrCmdDistributor cmdDistrib = new SolrCmdDistributor(updateShardHandler);
UpdateRequest updateRequest = new UpdateRequest();
CommitUpdateCommand ccmd = new CommitUpdateCommand(null, false);
//test default value (should be true)
cmdDistrib.addCommit(updateRequest, ccmd);
boolean openSearcher = updateRequest.getParams().getBool(UpdateParams.OPEN_SEARCHER,false);
assertTrue(openSearcher);
//test openSearcher = false
ccmd.openSearcher = false;
cmdDistrib.addCommit(updateRequest, ccmd);
openSearcher = updateRequest.getParams().getBool(UpdateParams.OPEN_SEARCHER,true);
assertFalse(openSearcher);
}
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:SolrCmdDistributorTest.java
示例7: addDoc
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
static void addDoc(String doc, String chain) throws Exception {
Map<String, String[]> params = new HashMap<>();
MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
params.put(UpdateParams.UPDATE_CHAIN, new String[] { chain });
SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(),
(SolrParams) mmparams) {
};
UpdateRequestHandler handler = new UpdateRequestHandler();
handler.init(null);
ArrayList<ContentStream> streams = new ArrayList<>(2);
streams.add(new ContentStreamBase.StringStream(doc));
req.setContentStreams(streams);
handler.handleRequestBody(req, new SolrQueryResponse());
req.close();
}
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:SignatureUpdateProcessorFactoryTest.java
示例8: addDoc
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
private void addDoc(String doc) throws Exception {
Map<String, String[]> params = new HashMap<>();
MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
params.put(UpdateParams.UPDATE_CHAIN, new String[] { "uniq-fields" });
SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(),
(SolrParams) mmparams) {
};
UpdateRequestHandler handler = new UpdateRequestHandler();
handler.init(null);
ArrayList<ContentStream> streams = new ArrayList<>(2);
streams.add(new ContentStreamBase.StringStream(doc));
req.setContentStreams(streams);
handler.handleRequestBody(req, new SolrQueryResponse());
req.close();
}
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:UniqFieldsUpdateProcessorFactoryTest.java
示例9: indexDocumentAndWaitForSync
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
private void indexDocumentAndWaitForSync(String docId) {
final SolrInputDocument doc = new SolrInputDocument();
doc.setField("id", docId);
final UpdateRequest docUpdate = new UpdateRequest();
docUpdate.add(doc);
docUpdate.setParam(UpdateParams.COLLECTION, COLLECTION_NAME);
docUpdate.setWaitSearcher(true);
docUpdate.setParam(UpdateParams.SOFT_COMMIT, Boolean.TRUE.toString());
try {
final UpdateResponse response = docUpdate.process(solrClient);
assertThat(response.getStatus()).isEqualTo(0);
SolrCloudUtils.waitForReplicasToSync(COLLECTION_NAME, solrClient, WAIT_TIMEOUT_SECONDS);
} catch (SolrServerException | IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:shaie,项目名称:lucenelab,代码行数:17,代码来源:MiniSolrCloudClusterTest.java
示例10: indexDocumentAndWaitForSync
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
private void indexDocumentAndWaitForSync(String docId, String collectionName) {
final SolrInputDocument doc = new SolrInputDocument();
doc.setField("id", docId);
final UpdateRequest docUpdate = new UpdateRequest();
docUpdate.add(doc);
docUpdate.setParam(UpdateParams.COLLECTION, collectionName);
docUpdate.setWaitSearcher(true);
docUpdate.setParam(UpdateParams.SOFT_COMMIT, Boolean.TRUE.toString());
try {
final UpdateResponse response = docUpdate.process(solrClient);
assertThat(response.getStatus()).isEqualTo(0);
SolrCloudUtils.waitForReplicasToSync(collectionName, solrClient, WAIT_TIMEOUT_SECONDS);
} catch (SolrServerException | IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:shaie,项目名称:lucenelab,代码行数:17,代码来源:AutoAddReplicaTest.java
示例11: ExtractingDocumentLoader
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
public ExtractingDocumentLoader(SolrQueryRequest req, UpdateRequestProcessor processor,
TikaConfig config, SolrContentHandlerFactory factory) {
this.params = req.getParams();
schema = req.getSchema();
this.config = config;
this.processor = processor;
templateAdd = new AddUpdateCommand(req);
templateAdd.overwrite = params.getBool(UpdateParams.OVERWRITE, true);
templateAdd.commitWithin = params.getInt(UpdateParams.COMMIT_WITHIN, -1);
//this is lightweight
autoDetectParser = new AutoDetectParser(config);
this.factory = factory;
ignoreTikaException = params.getBool(ExtractingParams.IGNORE_TIKA_EXCEPTION, false);
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:18,代码来源:ExtractingDocumentLoader.java
示例12: testCommitWithin
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
@Test
public void testCommitWithin() throws Exception {
DirectXmlRequest req = new DirectXmlRequest("/dataimport", xml);
ModifiableSolrParams params = params("command", "full-import",
"clean", "false", UpdateParams.COMMIT, "false",
UpdateParams.COMMIT_WITHIN, "1000");
req.setParams(params);
String url = "http://127.0.0.1:" + jetty.getLocalPort() + "/solr";
HttpSolrServer solrServer = new HttpSolrServer(url);
solrServer.request(req);
Thread.sleep(100);
ModifiableSolrParams queryAll = params("q", "*");
QueryResponse qres = solrServer.query(queryAll);
SolrDocumentList results = qres.getResults();
assertEquals(0, results.getNumFound());
Thread.sleep(1000);
for (int i = 0; i < 10; i++) {
qres = solrServer.query(queryAll);
results = qres.getResults();
if (2 == results.getNumFound()) {
return;
}
Thread.sleep(500);
}
fail("Commit should have occured but it did not");
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:27,代码来源:TestContentStreamDataSource.java
示例13: load
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
@Override
public void load(SolrQueryRequest req, SolrQueryResponse rsp,
ContentStream stream, UpdateRequestProcessor processor) throws Exception {
String type = req.getParams().get(UpdateParams.ASSUME_CONTENT_TYPE);
if(type == null) {
type = stream.getContentType();
}
if( type == null ) { // Normal requests will not get here.
throw new SolrException(ErrorCode.BAD_REQUEST, "Missing ContentType");
}
int idx = type.indexOf(';');
if(idx>0) {
type = type.substring(0,idx);
}
ContentStreamLoader loader = loaders.get(type);
if(loader==null) {
throw new SolrException(ErrorCode.BAD_REQUEST, "Unsupported ContentType: "
+type+ " Not in: "+loaders.keySet());
}
if(loader.getDefaultWT()!=null) {
setDefaultWT(req,loader);
}
loader.load(req, rsp, stream, processor);
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:26,代码来源:UpdateRequestHandler.java
示例14: addDoc
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
static void addDoc(String doc, String chain) throws Exception {
Map<String, String[]> params = new HashMap<String, String[]>();
MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
params.put(UpdateParams.UPDATE_CHAIN, new String[] { chain });
SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(),
(SolrParams) mmparams) {
};
UpdateRequestHandler handler = new UpdateRequestHandler();
handler.init(null);
ArrayList<ContentStream> streams = new ArrayList<ContentStream>(2);
streams.add(new ContentStreamBase.StringStream(doc));
req.setContentStreams(streams);
handler.handleRequestBody(req, new SolrQueryResponse());
req.close();
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:17,代码来源:SignatureUpdateProcessorFactoryTest.java
示例15: addDoc
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
private void addDoc(String doc) throws Exception {
Map<String, String[]> params = new HashMap<String, String[]>();
MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
params.put(UpdateParams.UPDATE_CHAIN, new String[] { "uniq-fields" });
SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(),
(SolrParams) mmparams) {
};
UpdateRequestHandler handler = new UpdateRequestHandler();
handler.init(null);
ArrayList<ContentStream> streams = new ArrayList<ContentStream>(2);
streams.add(new ContentStreamBase.StringStream(doc));
req.setContentStreams(streams);
handler.handleRequestBody(req, new SolrQueryResponse());
req.close();
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:17,代码来源:UniqFieldsUpdateProcessorFactoryTest.java
示例16: load
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
@Override
public void load(SolrQueryRequest req, SolrQueryResponse rsp,
ContentStream stream, UpdateRequestProcessor processor) throws Exception {
String type = req.getParams().get(UpdateParams.ASSUME_CONTENT_TYPE);
if(type == null) {
type = stream.getContentType();
}
if( type == null ) { // Normal requests will not get here.
throw new SolrException(ErrorCode.UNSUPPORTED_MEDIA_TYPE, "Missing ContentType");
}
int idx = type.indexOf(';');
if(idx>0) {
type = type.substring(0,idx);
}
ContentStreamLoader loader = loaders.get(type);
if(loader==null) {
throw new SolrException(ErrorCode.UNSUPPORTED_MEDIA_TYPE, "Unsupported ContentType: "
+type+ " Not in: "+loaders.keySet());
}
if(loader.getDefaultWT()!=null) {
setDefaultWT(req,loader);
}
loader.load(req, rsp, stream, processor);
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:26,代码来源:UpdateRequestHandler.java
示例17: addDoc
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
private void addDoc(String chain, String doc) throws Exception {
Map<String, String[]> params = new HashMap<>();
params.put(UpdateParams.UPDATE_CHAIN, new String[] { chain });
MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
SolrQueryRequestBase req = new SolrQueryRequestBase(h.getCore(), (SolrParams) mmparams) {
};
UpdateRequestHandler handler = new UpdateRequestHandler();
handler.init(null);
ArrayList<ContentStream> streams = new ArrayList<>(2);
streams.add(new ContentStreamBase.StringStream(doc));
req.setContentStreams(streams);
handler.handleRequestBody(req, new SolrQueryResponse());
}
开发者ID:europeana,项目名称:search,代码行数:15,代码来源:UIMAUpdateRequestProcessorTest.java
示例18: DistributedUpdateProcessor
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
public DistributedUpdateProcessor(SolrQueryRequest req,
SolrQueryResponse rsp, UpdateRequestProcessor next) {
super(next);
this.rsp = rsp;
this.next = next;
this.idField = req.getSchema().getUniqueKeyField();
// version init
this.updateHandler = req.getCore().getUpdateHandler();
this.ulog = updateHandler.getUpdateLog();
this.vinfo = ulog == null ? null : ulog.getVersionInfo();
versionsStored = this.vinfo != null && this.vinfo.getVersionField() != null;
returnVersions = req.getParams().getBool(UpdateParams.VERSIONS ,false);
// TODO: better way to get the response, or pass back info to it?
SolrRequestInfo reqInfo = returnVersions ? SolrRequestInfo.getRequestInfo() : null;
this.req = req;
CoreDescriptor coreDesc = req.getCore().getCoreDescriptor();
this.zkEnabled = coreDesc.getCoreContainer().isZooKeeperAware();
zkController = req.getCore().getCoreDescriptor().getCoreContainer().getZkController();
if (zkEnabled) {
cmdDistrib = new SolrCmdDistributor(coreDesc.getCoreContainer().getUpdateShardHandler());
}
//this.rsp = reqInfo != null ? reqInfo.getRsp() : null;
cloudDesc = coreDesc.getCloudDescriptor();
if (cloudDesc != null) {
collection = cloudDesc.getCollectionName();
} else {
collection = null;
}
}
开发者ID:europeana,项目名称:search,代码行数:38,代码来源:DistributedUpdateProcessor.java
示例19: SingleThreadedJsonLoader
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
public SingleThreadedJsonLoader(SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor processor) {
this.processor = processor;
this.req = req;
this.rsp = rsp;
commitWithin = req.getParams().getInt(UpdateParams.COMMIT_WITHIN, -1);
overwrite = req.getParams().getBool(UpdateParams.OVERWRITE, true);
}
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:JsonLoader.java
示例20: getAddCommand
import org.apache.solr.common.params.UpdateParams; //导入依赖的package包/类
private AddUpdateCommand getAddCommand(SolrQueryRequest req, SolrParams params) {
AddUpdateCommand addCmd = new AddUpdateCommand(req);
addCmd.overwrite = params.getBool(UpdateParams.OVERWRITE, true);
addCmd.commitWithin = params.getInt(UpdateParams.COMMIT_WITHIN, -1);
return addCmd;
}
开发者ID:europeana,项目名称:search,代码行数:8,代码来源:JavabinLoader.java
注:本文中的org.apache.solr.common.params.UpdateParams类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论