use of org.apache.solr.update.processor.UpdateRequestProcessorChain in project lucene-solr by apache.
the class UIMAUpdateRequestProcessorTest method testProcessorConfiguration.
@Test
public void testProcessorConfiguration() {
SolrCore core = h.getCore();
UpdateRequestProcessorChain chained = core.getUpdateProcessingChain(UIMA_CHAIN);
assertNotNull(chained);
UIMAUpdateRequestProcessorFactory factory = (UIMAUpdateRequestProcessorFactory) chained.getProcessors().get(0);
assertNotNull(factory);
UpdateRequestProcessor processor = factory.getInstance(req(), null, null);
assertTrue(processor instanceof UIMAUpdateRequestProcessor);
}
use of org.apache.solr.update.processor.UpdateRequestProcessorChain in project lucene-solr by apache.
the class SolrCore method loadUpdateProcessorChains.
/**
* Load the request processors
*/
private Map<String, UpdateRequestProcessorChain> loadUpdateProcessorChains() {
Map<String, UpdateRequestProcessorChain> map = new HashMap<>();
UpdateRequestProcessorChain def = initPlugins(map, UpdateRequestProcessorChain.class, UpdateRequestProcessorChain.class.getName());
if (def == null) {
def = map.get(null);
}
if (def == null) {
log.debug("no updateRequestProcessorChain defined as default, creating implicit default");
// construct the default chain
UpdateRequestProcessorFactory[] factories = new UpdateRequestProcessorFactory[] { new LogUpdateProcessorFactory(), new DistributedUpdateProcessorFactory(), new RunUpdateProcessorFactory() };
def = new UpdateRequestProcessorChain(Arrays.asList(factories), this);
}
map.put(null, def);
map.put("", def);
return map;
}
use of org.apache.solr.update.processor.UpdateRequestProcessorChain in project lucene-solr by apache.
the class SolrCore method getUpdateProcessorChain.
public UpdateRequestProcessorChain getUpdateProcessorChain(SolrParams params) {
String chainName = params.get(UpdateParams.UPDATE_CHAIN);
UpdateRequestProcessorChain defaultUrp = getUpdateProcessingChain(chainName);
ProcessorInfo processorInfo = new ProcessorInfo(params);
if (processorInfo.isEmpty())
return defaultUrp;
return UpdateRequestProcessorChain.constructChain(defaultUrp, processorInfo, this);
}
use of org.apache.solr.update.processor.UpdateRequestProcessorChain in project lucene-solr by apache.
the class DefaultValueUpdateProcessorTest method processAdd.
/**
* 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();
}
}
use of org.apache.solr.update.processor.UpdateRequestProcessorChain in project lucene-solr by apache.
the class TestXIncludeConfig method testXInclude.
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.getProcessors().size());
assertEquals("chain has wrong included processor", RegexReplaceProcessorFactory.class, chain.getProcessors().get(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(// Does Not Exist Anywhere
"ft-entity-include3 is not null", schema.getFieldTypeByName("ft-entity-include3"));
}
Aggregations