本文整理汇总了Java中org.apache.solr.update.processor.UpdateRequestProcessorChain类的典型用法代码示例。如果您正苦于以下问题:Java UpdateRequestProcessorChain类的具体用法?Java UpdateRequestProcessorChain怎么用?Java UpdateRequestProcessorChain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UpdateRequestProcessorChain类属于org.apache.solr.update.processor包,在下文中一共展示了UpdateRequestProcessorChain类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testMultiMap
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
@Test
public void testMultiMap() {
SolrCore core = h.getCore();
UpdateRequestProcessorChain chained = core.getUpdateProcessingChain("uima-multi-map");
assertNotNull(chained);
UIMAUpdateRequestProcessorFactory factory = (UIMAUpdateRequestProcessorFactory) chained
.getFactories()[0];
assertNotNull(factory);
UpdateRequestProcessor processor = factory.getInstance(req(), null, null);
assertTrue(processor instanceof UIMAUpdateRequestProcessor);
SolrUIMAConfiguration conf = ((UIMAUpdateRequestProcessor)processor).solrUIMAConfiguration;
Map<String, Map<String, MapField>> map = conf.getTypesFeaturesFieldsMapping();
Map<String, MapField> subMap = map.get("a-type-which-can-have-multiple-features");
assertEquals(2, subMap.size());
assertEquals("1", subMap.get("A").getFieldName(null));
assertEquals("2", subMap.get("B").getFieldName(null));
}
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:UIMAUpdateRequestProcessorTest.java
示例2: testXInclude
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
public void testXInclude() throws Exception {
SolrCore core = h.getCore();
assertNotNull("includedHandler is null",
core.getRequestHandler("includedHandler"));
UpdateRequestProcessorChain chain
= core.getUpdateProcessingChain("special-include");
assertNotNull("chain is missing included processor", chain);
assertEquals("chain with inclued processor is wrong size",
1, chain.getFactories().length);
assertEquals("chain has wrong included processor",
RegexReplaceProcessorFactory.class,
chain.getFactories()[0].getClass());
assertNotNull("ft-included is null",
core.getSchema().getFieldTypeByName("ft-included"));
assertNotNull("field-included is null",
core.getSchema().getFieldOrNull("field-included"));
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:21,代码来源:TestXIncludeConfig.java
示例3: handleRequestBody
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
@Override
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
formatResponseAsJson(req);
if (req.getContentStreams() == null) {
LOGGER.warn("no content stream");
rsp.add("error", "No content stream");
return;
}
boolean commit = Boolean.parseBoolean(req.getParams().get("commit", "true"));
InputStream stream = req.getContentStreams().iterator().next().getStream();
stream = detectGzip(stream);
MetricTimeSeriesConverter converter = new MetricTimeSeriesConverter();
UpdateRequestProcessorChain processorChain = req.getCore().getUpdateProcessorChain(req.getParams());
UpdateRequestProcessor processor = processorChain.createProcessor(req, rsp);
try {
for (MetricTimeSeries series : formatParser.parse(stream)) {
SolrInputDocument document = new SolrInputDocument();
converter.to(series).getFields().forEach(document::addField);
storeDocument(document, processor, req);
}
if (commit) {
LOGGER.debug("Committing transaction...");
processor.processCommit(new CommitUpdateCommand(req, false));
LOGGER.debug("Committed transaction");
} else {
LOGGER.debug("Only adding documents.");
}
} finally {
processor.finish();
}
}
开发者ID:ChronixDB,项目名称:chronix.server,代码行数:39,代码来源:AbstractIngestionHandler.java
示例4: testProcessorConfiguration
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
@Test
public void testProcessorConfiguration() {
SolrCore core = h.getCore();
UpdateRequestProcessorChain chained = core.getUpdateProcessingChain("uima");
assertNotNull(chained);
UIMAUpdateRequestProcessorFactory factory = (UIMAUpdateRequestProcessorFactory) chained
.getFactories()[0];
assertNotNull(factory);
UpdateRequestProcessor processor = factory.getInstance(req(), null, null);
assertTrue(processor instanceof UIMAUpdateRequestProcessor);
}
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:UIMAUpdateRequestProcessorTest.java
示例5: handleRequestBody
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
SolrParams params = req.getParams();
UpdateRequestProcessorChain processorChain =
req.getCore().getUpdateProcessingChain(params.get(UpdateParams.UPDATE_CHAIN));
UpdateRequestProcessor processor = processorChain.createProcessor(req, rsp);
try {
ContentStreamLoader documentLoader = newLoader(req, processor);
Iterable<ContentStream> streams = req.getContentStreams();
if (streams == null) {
if (!RequestHandlerUtils.handleCommit(req, processor, params, false) && !RequestHandlerUtils.handleRollback(req, processor, params, false)) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "missing content stream");
}
} else {
for (ContentStream stream : streams) {
documentLoader.load(req, rsp, stream, processor);
}
// Perhaps commit from the parameters
RequestHandlerUtils.handleCommit(req, processor, params, false);
RequestHandlerUtils.handleRollback(req, processor, params, false);
}
} finally {
// finish the request
processor.finish();
}
}
开发者ID:europeana,项目名称:search,代码行数:33,代码来源:ContentStreamHandlerBase.java
示例6: getUpdateProcessingChain
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
/**
* @return an update processor registered to the given name. Throw an exception if this chain is undefined
*/
public UpdateRequestProcessorChain getUpdateProcessingChain( final String name )
{
UpdateRequestProcessorChain chain = updateProcessorChains.get( name );
if( chain == null ) {
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
"unknown UpdateRequestProcessorChain: "+name );
}
return chain;
}
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:SolrCore.java
示例7: processAdd
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
/**
* Runs a document through the specified chain, and returns the final
* document used when the chain is completed (NOTE: some chains may
* modify the document in place
*/
SolrInputDocument processAdd(final String chain,
final SolrInputDocument docIn)
throws IOException {
SolrCore core = h.getCore();
UpdateRequestProcessorChain pc = core.getUpdateProcessingChain(chain);
assertNotNull("No Chain named: " + chain, pc);
SolrQueryResponse rsp = new SolrQueryResponse();
SolrQueryRequest req = new LocalSolrQueryRequest
(core, new ModifiableSolrParams());
try {
SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req,rsp));
AddUpdateCommand cmd = new AddUpdateCommand(req);
cmd.solrDoc = docIn;
UpdateRequestProcessor processor = pc.createProcessor(req, rsp);
processor.processAdd(cmd);
return cmd.solrDoc;
} finally {
SolrRequestInfo.clearRequestInfo();
req.close();
}
}
开发者ID:europeana,项目名称:search,代码行数:32,代码来源:DefaultValueUpdateProcessorTest.java
示例8: testXInclude
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
public void testXInclude() throws Exception {
SolrCore core = h.getCore();
assertNotNull("includedHandler is null",
core.getRequestHandler("includedHandler"));
UpdateRequestProcessorChain chain
= core.getUpdateProcessingChain("special-include");
assertNotNull("chain is missing included processor", chain);
assertEquals("chain with inclued processor is wrong size",
1, chain.getFactories().length);
assertEquals("chain has wrong included processor",
RegexReplaceProcessorFactory.class,
chain.getFactories()[0].getClass());
IndexSchema schema = core.getLatestSchema();
// xinclude
assertNotNull("ft-included is null", schema.getFieldTypeByName("ft-included"));
assertNotNull("field-included is null", schema.getFieldOrNull("field-included"));
// entity include
assertNotNull("ft-entity-include1 is null",
schema.getFieldTypeByName("ft-entity-include1"));
assertNotNull("ft-entity-include2 is null",
schema.getFieldTypeByName("ft-entity-include2"));
// sanity check
assertNull("ft-entity-include3 is not null", // Does Not Exist Anywhere
schema.getFieldTypeByName("ft-entity-include3"));
}
开发者ID:europeana,项目名称:search,代码行数:33,代码来源:TestXIncludeConfig.java
示例9: setUpBase
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
@Before
public void setUpBase() throws Exception
{
coreContainer = new CoreContainer();
coreDescriptor = new CoreDescriptor(coreContainer, "name", "instanceDir");
when(resourceLoader.getCoreProperties()).thenReturn(new Properties());
// SolrCore is final, we can't mock with mockito
core = new SolrCore("name", coreDescriptor);
FieldUtils.writeField(core, "updateHandler", updateHandler, true);
FieldUtils.writeField(core, "resourceLoader", resourceLoader, true);
infoRegistry = new HashMap<String, SolrInfoMBean>();
FieldUtils.writeField(core, "infoRegistry", infoRegistry, true);
reqHandlers = new RequestHandlers(core);
reqHandlers.register("/select", selectRequestHandler);
reqHandlers.register("/afts", aftsRequestHandler);
FieldUtils.writeField(core, "reqHandlers", reqHandlers, true);
Map<String, UpdateRequestProcessorChain> map = new HashMap<>();
UpdateRequestProcessorFactory[] factories = new UpdateRequestProcessorFactory[] { runUpdateProcessorFactory };
when(runUpdateProcessorFactory.getInstance(any(SolrQueryRequest.class), any(SolrQueryResponse.class),
any(UpdateRequestProcessor.class))).thenReturn(processor);
UpdateRequestProcessorChain def = new UpdateRequestProcessorChain(factories, core);
map.put(null, def);
map.put("", def);
FieldUtils.writeField(core, "updateProcessorChains", map, true);
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:28,代码来源:SolrCoreTestBase.java
示例10: getUpdateProcessingChain
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
/**
* @return an update processor registered to the given name. Throw an exception if this chain is
* undefined
*/
public UpdateRequestProcessorChain getUpdateProcessingChain(final String name) {
UpdateRequestProcessorChain chain = updateProcessorChains.get(name);
if(chain == null) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "unknown UpdateRequestProcessorChain: " + name);
}
return chain;
}
开发者ID:netboynb,项目名称:search-core,代码行数:12,代码来源:SolrCore.java
示例11: handleRequestBody
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
// TODO Auto-generated method stub
SolrParams params = req.getParams();
String recordUrl = params.get("url");
String searchLogDocId = params.get("searchLogDocId");
String clickLogDocId = generateClickLogDocId(recordUrl, searchLogDocId);
String collectionName = params.get("collectionName");
String displayUrl = params.toString();
SolrInputDocument doc = new SolrInputDocument();
doc.setField(StatsConstants.INDEX_FIELD_ID, clickLogDocId);
doc.setField(StatsConstants.INDEX_FIELD_COLLECTION_NAME, collectionName);
doc.setField(StatsConstants.INDEX_FIELD_SEARCH_LOG_DOC_ID, searchLogDocId);
doc.setField(StatsConstants.INDEX_FIELD_RECORD_URL, recordUrl);
doc.setField(StatsConstants.INDEX_FIELD_DISPLAY_URL, displayUrl);
doc.setField(StatsConstants.INDEX_FIELD_CLICK_DATE, new Date());
UpdateRequestProcessorChain processorChain = req.getCore().getUpdateProcessingChain(params.get(UpdateParams.UPDATE_CHAIN));
UpdateRequestProcessor processor = processorChain.createProcessor(req, rsp);
try {
AddUpdateCommand addCmd = new AddUpdateCommand(req);
addCmd.commitWithin = params.getInt(UpdateParams.COMMIT_WITHIN, -1);
addCmd.overwrite = params.getBool(UpdateParams.OVERWRITE, true);
addCmd.solrDoc = doc;
processor.processAdd(addCmd);
// Perhaps commit from the parameters
RequestHandlerUtils.handleCommit(req, processor, params, false);
RequestHandlerUtils.handleRollback(req, processor, params, false);
} finally {
// finish the request
processor.finish();
}
}
开发者ID:BassJel,项目名称:Jouve-Project,代码行数:38,代码来源:ComputeClickRequestHandler.java
示例12: testAutomaticDeletes
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
public void testAutomaticDeletes() throws Exception {
// get a handle on our recorder
UpdateRequestProcessorChain chain =
h.getCore().getUpdateProcessingChain("scheduled-delete");
assertNotNull(chain);
UpdateRequestProcessorFactory[] factories = chain.getFactories();
assertEquals("did number of processors configured in chain get changed?",
5, factories.length);
assertTrue("Expected [1] RecordingUpdateProcessorFactory: " + factories[1].getClass(),
factories[1] instanceof RecordingUpdateProcessorFactory);
RecordingUpdateProcessorFactory recorder =
(RecordingUpdateProcessorFactory) factories[1];
// now start recording, and monitor for the expected commands
try {
recorder.startRecording();
// more then one iter to verify it's recurring
final int numItersToCheck = 1 + RANDOM_MULTIPLIER;
for (int i = 0; i < numItersToCheck; i++) {
UpdateCommand tmp;
// be generous in how long we wait, some jenkins machines are slooooow
tmp = recorder.commandQueue.poll(30, TimeUnit.SECONDS);
// we can be confident in the order because DocExpirationUpdateProcessorFactory
// uses the same request for both the delete & the commit -- and both
// RecordingUpdateProcessorFactory's getInstance & startRecording methods are
// synchronized. So it should not be possible to start recording in the
// middle of the two commands
assertTrue("expected DeleteUpdateCommand: " + tmp.getClass(),
tmp instanceof DeleteUpdateCommand);
DeleteUpdateCommand delete = (DeleteUpdateCommand) tmp;
assertFalse(delete.isDeleteById());
assertNotNull(delete.getQuery());
assertTrue(delete.getQuery(),
delete.getQuery().startsWith("{!cache=false}eXpField_tdt:[* TO "));
// commit should be immediately after the delete
tmp = recorder.commandQueue.poll(5, TimeUnit.SECONDS);
assertTrue("expected CommitUpdateCommand: " + tmp.getClass(),
tmp instanceof CommitUpdateCommand);
CommitUpdateCommand commit = (CommitUpdateCommand) tmp;
assertTrue(commit.softCommit);
assertTrue(commit.openSearcher);
}
} finally {
recorder.stopRecording();
}
}
开发者ID:europeana,项目名称:search,代码行数:59,代码来源:DocExpirationUpdateProcessorFactoryTest.java
示例13: createIndex2
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
void createIndex2(int nDocs, String... fields) throws IOException {
Set<String> fieldSet = new HashSet<>(Arrays.asList(fields));
SolrQueryRequest req = lrf.makeRequest();
SolrQueryResponse rsp = new SolrQueryResponse();
UpdateRequestProcessorChain processorChain = req.getCore().getUpdateProcessingChain(null);
UpdateRequestProcessor processor = processorChain.createProcessor(req, rsp);
boolean foomany_s = fieldSet.contains("foomany_s");
boolean foo1_s = fieldSet.contains("foo1_s");
boolean foo2_s = fieldSet.contains("foo2_s");
boolean foo4_s = fieldSet.contains("foo4_s");
boolean foo8_s = fieldSet.contains("foo8_s");
boolean t10_100_ws = fieldSet.contains("t10_100_ws");
for (int i=0; i<nDocs; i++) {
SolrInputDocument doc = new SolrInputDocument();
doc.addField("id",Float.toString(i));
if (foomany_s) {
doc.addField("foomany_s",t(r.nextInt(nDocs*10)));
}
if (foo1_s) {
doc.addField("foo1_s",t(0));
}
if (foo2_s) {
doc.addField("foo2_s",r.nextInt(2));
}
if (foo4_s) {
doc.addField("foo4_s",r.nextInt(4));
}
if (foo8_s) {
doc.addField("foo8_s",r.nextInt(8));
}
if (t10_100_ws) {
StringBuilder sb = new StringBuilder(9*100);
for (int j=0; j<100; j++) {
sb.append(' ');
sb.append(t(r.nextInt(10)));
}
doc.addField("t10_100_ws", sb.toString());
}
AddUpdateCommand cmd = new AddUpdateCommand(req);
cmd.solrDoc = doc;
processor.processAdd(cmd);
}
processor.finish();
req.close();
assertU(commit());
req = lrf.makeRequest();
assertEquals(nDocs, req.getSearcher().maxDoc());
req.close();
}
开发者ID:europeana,项目名称:search,代码行数:57,代码来源:TestSearchPerf.java
示例14: getProcessorChain
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
public UpdateRequestProcessorChain getProcessorChain() {
return this.processorChain;
}
开发者ID:lucidworks,项目名称:solr-couchbase-plugin,代码行数:4,代码来源:CouchbaseRequestHandler.java
示例15: createIndex2
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
void createIndex2(int nDocs, String... fields) throws IOException {
Set<String> fieldSet = new HashSet<String>(Arrays.asList(fields));
SolrQueryRequest req = lrf.makeRequest();
SolrQueryResponse rsp = new SolrQueryResponse();
UpdateRequestProcessorChain processorChain = req.getCore().getUpdateProcessingChain(null);
UpdateRequestProcessor processor = processorChain.createProcessor(req, rsp);
boolean foomany_s = fieldSet.contains("foomany_s");
boolean foo1_s = fieldSet.contains("foo1_s");
boolean foo2_s = fieldSet.contains("foo2_s");
boolean foo4_s = fieldSet.contains("foo4_s");
boolean foo8_s = fieldSet.contains("foo8_s");
boolean t10_100_ws = fieldSet.contains("t10_100_ws");
for (int i=0; i<nDocs; i++) {
SolrInputDocument doc = new SolrInputDocument();
doc.addField("id",Float.toString(i));
if (foomany_s) {
doc.addField("foomany_s",t(r.nextInt(nDocs*10)));
}
if (foo1_s) {
doc.addField("foo1_s",t(0));
}
if (foo2_s) {
doc.addField("foo2_s",r.nextInt(2));
}
if (foo4_s) {
doc.addField("foo4_s",r.nextInt(4));
}
if (foo8_s) {
doc.addField("foo8_s",r.nextInt(8));
}
if (t10_100_ws) {
StringBuilder sb = new StringBuilder(9*100);
for (int j=0; j<100; j++) {
sb.append(' ');
sb.append(t(r.nextInt(10)));
}
doc.addField("t10_100_ws", sb.toString());
}
AddUpdateCommand cmd = new AddUpdateCommand(req);
cmd.solrDoc = doc;
processor.processAdd(cmd);
}
processor.finish();
req.close();
assertU(commit());
req = lrf.makeRequest();
assertEquals(nDocs, req.getSearcher().maxDoc());
req.close();
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:57,代码来源:TestSearchPerf.java
示例16: getProcessor
import org.apache.solr.update.processor.UpdateRequestProcessorChain; //导入依赖的package包/类
/**
* Gets the processor build from the processor update chain(UpdateParams.UPDATE_CHAIN)
*
* @param req - the solr query request information
* @param rsp - the solr query response information
* @return the update request processor
*/
private UpdateRequestProcessor getProcessor(SolrQueryRequest req, SolrQueryResponse rsp) {
UpdateRequestProcessorChain processorChain =
req.getCore().getUpdateProcessingChain(req.getParams().get(UpdateParams.UPDATE_CHAIN));
return processorChain.createProcessor(req, rsp);
}
开发者ID:ChronixDB,项目名称:chronix.server,代码行数:13,代码来源:ChronixRetentionHandler.java
注:本文中的org.apache.solr.update.processor.UpdateRequestProcessorChain类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论