本文整理汇总了Java中org.apache.solr.core.SolrCore.getUpdateProcessingChain方法的典型用法代码示例。如果您正苦于以下问题:Java SolrCore.getUpdateProcessingChain方法的具体用法?Java SolrCore.getUpdateProcessingChain怎么用?Java SolrCore.getUpdateProcessingChain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.core.SolrCore
的用法示例。
在下文中一共展示了SolrCore.getUpdateProcessingChain方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMultiMap
import org.apache.solr.core.SolrCore; //导入方法依赖的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));
}
示例2: inform
import org.apache.solr.core.SolrCore; //导入方法依赖的package包/类
@Override
public void inform(SolrCore core) {
this.core = core;
if (null == core.getLatestSchema().getFieldTypeNoEx(expireField)) {
// TODO: check for managed schema and auto-add as a date field?
throw confErr(EXP_FIELD_NAME_CONF + " does not exist in schema: " + expireField);
}
if (0 < deletePeriodSeconds) {
// validate that we have a chain we can work with
try {
Object ignored = core.getUpdateProcessingChain(deleteChainName);
} catch (SolrException e) {
throw confErr(DEL_CHAIN_NAME_CONF + " does not exist: " + deleteChainName, e);
}
// schedule recuring deletion
initDeleteExpiredDocsScheduler(core);
}
}
示例3: processCommit
import org.apache.solr.core.SolrCore; //导入方法依赖的package包/类
protected void processCommit(final String chain) 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());
CommitUpdateCommand cmd = new CommitUpdateCommand(req,false);
UpdateRequestProcessor processor = pc.createProcessor(req, rsp);
try {
processor.processCommit(cmd);
} finally {
req.close();
}
}
示例4: processDeleteById
import org.apache.solr.core.SolrCore; //导入方法依赖的package包/类
protected void processDeleteById(final String chain, String id) 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());
DeleteUpdateCommand cmd = new DeleteUpdateCommand(req);
cmd.setId(id);
UpdateRequestProcessor processor = pc.createProcessor(req, rsp);
try {
processor.processDelete(cmd);
} finally {
req.close();
}
}
示例5: testDupeAllFieldsDetection
import org.apache.solr.core.SolrCore; //导入方法依赖的package包/类
@Test
public void testDupeAllFieldsDetection() throws Exception {
this.chain = "dedupe-allfields";
SolrCore core = h.getCore();
UpdateRequestProcessorChain chained = core.getUpdateProcessingChain(this.chain);
SignatureUpdateProcessorFactory factory = ((SignatureUpdateProcessorFactory) chained
.getFactories()[0]);
factory.setEnabled(true);
assertNotNull(chained);
addDoc(adoc("v_t", "Hello Dude man!"));
addDoc(adoc("v_t", "Hello Dude man!", "name", "name1'"));
addDoc(adoc("v_t", "Hello Dude man!", "name", "name2'"));
addDoc(commit());
checkNumDocs(3);
factory.setEnabled(false);
}
示例6: beforeClass
import org.apache.solr.core.SolrCore; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
initCore("solrconfig-languageidentifier.xml", "schema.xml", getFile("langid/solr").getAbsolutePath());
SolrCore core = h.getCore();
UpdateRequestProcessorChain chained = core.getUpdateProcessingChain("lang_id");
assertNotNull(chained);
}
示例7: testProcessorConfiguration
import org.apache.solr.core.SolrCore; //导入方法依赖的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);
}
示例8: testSingleScript
import org.apache.solr.core.SolrCore; //导入方法依赖的package包/类
public void testSingleScript() throws Exception {
SolrCore core = h.getCore();
UpdateRequestProcessorChain chained = core.getUpdateProcessingChain("single-script");
final StatelessScriptUpdateProcessorFactory factory = ((StatelessScriptUpdateProcessorFactory) chained.getFactories()[0]);
final List<String> functionMessages = new ArrayList<>();
factory.setScriptEngineCustomizer(new ScriptEngineCustomizer() {
@Override
public void customize(ScriptEngine engine) {
engine.put("functionMessages", functionMessages);
}
});
assertNotNull(chained);
SolrInputDocument d = processAdd("single-script",
doc(f("id", "1"),
f("name", " foo "),
f("subject", "bar")));
processCommit("run-no-scripts");
assertQ("couldn't find doc by id",
req("q","id:1")
, "//result[@numFound=1]");
processDeleteById("single-script","1");
processCommit("single-script");
assertQ("found deleted doc",
req("q","id:1")
, "//result[@numFound=0]");
assertEquals(3, functionMessages.size());
assertTrue(functionMessages.contains("processAdd0"));
assertTrue(functionMessages.contains("processDelete0"));
assertTrue(functionMessages.contains("processCommit0"));
}
示例9: processAdd
import org.apache.solr.core.SolrCore; //导入方法依赖的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
*/
protected SolrInputDocument processAdd(final String chain,
final SolrParams requestParams,
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, requestParams);
try {
SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req, rsp));
AddUpdateCommand cmd = new AddUpdateCommand(req);
cmd.solrDoc = docIn;
UpdateRequestProcessor processor = pc.createProcessor(req, rsp);
if (null != processor) {
// test chain might be empty or short circuted.
processor.processAdd(cmd);
}
return cmd.solrDoc;
} finally {
SolrRequestInfo.clearRequestInfo();
req.close();
}
}
示例10: finish
import org.apache.solr.core.SolrCore; //导入方法依赖的package包/类
protected void finish(final String chain) 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());
UpdateRequestProcessor processor = pc.createProcessor(req, rsp);
try {
processor.finish();
} finally {
req.close();
}
}
示例11: testConfiguration
import org.apache.solr.core.SolrCore; //导入方法依赖的package包/类
public void testConfiguration() throws Exception
{
SolrCore core = h.getCore();
// make sure it loaded the factories
UpdateRequestProcessorChain chained = core.getUpdateProcessingChain( "standard" );
// Make sure it got 3 items (4 configured, 1 is enable=false)
assertEquals("wrong number of (enabled) factories in chain",
3, chained.getFactories().length );
// first one should be log, and it should be configured properly
UpdateRequestProcessorFactory first = chained.getFactories()[0];
assertEquals("wrong factory at front of chain",
LogUpdateProcessorFactory.class, first.getClass());
LogUpdateProcessorFactory log = (LogUpdateProcessorFactory)first;
assertEquals("wrong config for LogUpdateProcessorFactory",
100, log.maxNumToLog );
UpdateRequestProcessorChain custom = core.getUpdateProcessingChain( null );
CustomUpdateRequestProcessorFactory link = (CustomUpdateRequestProcessorFactory) custom.getFactories()[0];
assertEquals( custom, core.getUpdateProcessingChain( "" ) );
assertEquals( custom, core.getUpdateProcessingChain( "custom" ) );
// Make sure the NamedListArgs got through ok
assertEquals( "{name={n8=88,n9=99}}", link.args.toString() );
}
示例12: processAdd
import org.apache.solr.core.SolrCore; //导入方法依赖的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();
}
}
示例13: testMultipleScripts
import org.apache.solr.core.SolrCore; //导入方法依赖的package包/类
public void testMultipleScripts() throws Exception {
SolrCore core = h.getCore();
for (final String chain : new String[] {"dual-scripts-arr",
"dual-scripts-strs"}) {
UpdateRequestProcessorChain chained = core.getUpdateProcessingChain(chain);
final StatelessScriptUpdateProcessorFactory factory =
((StatelessScriptUpdateProcessorFactory) chained.getFactories()[0]);
final List<String> functionMessages = new ArrayList<>();
ScriptEngineCustomizer customizer = new ScriptEngineCustomizer() {
@Override
public void customize(ScriptEngine engine) {
engine.put("functionMessages", functionMessages);
}
};
factory.setScriptEngineCustomizer(customizer);
assertNotNull(chained);
SolrInputDocument d = processAdd(chain,
doc(f("id", "2"),
f("name", " foo "),
f("subject", "bar")));
assertEquals(chain + " didn't add Double field",
42.3d, d.getFieldValue("script_added_d"));
assertEquals(chain + " didn't add integer field",
new Integer(42), d.getFieldValue("script_added_i"));
processCommit("run-no-scripts");
assertQ(chain + ": couldn't find doc by id",
req("q","id:2")
, "//result[@numFound=1]");
processDeleteById(chain, "2");
processCommit(chain);
assertEquals(chain, 6, functionMessages.size());
assertTrue(chain, functionMessages.contains("processAdd0"));
assertTrue(chain, functionMessages.contains("processAdd1"));
assertTrue(chain + ": script order doesn't match conf order",
functionMessages.indexOf("processAdd0")
< functionMessages.indexOf("processAdd1"));
assertTrue(chain, functionMessages.contains("processDelete0"));
assertTrue(chain, functionMessages.contains("processDelete1"));
assertTrue(chain + ": script order doesn't match conf order",
functionMessages.indexOf("processDelete0")
< functionMessages.indexOf("processDelete1"));
assertTrue(chain, functionMessages.contains("processCommit0"));
assertTrue(chain, functionMessages.contains("processCommit1"));
assertTrue(chain + ": script order doesn't match conf order",
functionMessages.indexOf("processCommit0")
< functionMessages.indexOf("processCommit1"));
finish(chain);
assertEquals(chain, 8, functionMessages.size());
assertTrue(chain, functionMessages.contains("finish0"));
assertTrue(chain, functionMessages.contains("finish1"));
assertTrue(chain + ": script order doesn't match conf order",
functionMessages.indexOf("finish0")
< functionMessages.indexOf("finish1"));
assertQ(chain + ": found deleted doc",
req("q","id:2")
, "//result[@numFound=0]");
}
}
示例14: testUpdateDistribChainSkipping
import org.apache.solr.core.SolrCore; //导入方法依赖的package包/类
public void testUpdateDistribChainSkipping() throws Exception {
SolrCore core = h.getCore();
for (final String name : Arrays.asList("distrib-chain-explicit",
"distrib-chain-implicit",
"distrib-chain-noop")) {
UpdateRequestProcessor proc;
UpdateRequestProcessorChain chain = core.getUpdateProcessingChain(name);
assertNotNull(name, chain);
// either explicitly, or because of injection
assertEquals(name + " chain length", 5,
chain.getFactories().length);
// Custom comes first in all three of our chains
proc = chain.createProcessor(req(), new SolrQueryResponse());
assertTrue(name + " first processor isn't a CustomUpdateRequestProcessor: "
+ proc.getClass().getName(),
proc instanceof CustomUpdateRequestProcessor);
// varies depending on chain, but definitely shouldn't be Custom
proc = chain.createProcessor(req(DISTRIB_UPDATE_PARAM, "non_blank_value"),
new SolrQueryResponse());
assertFalse(name + " post distrib proc should not be a CustomUpdateRequestProcessor: "
+ proc.getClass().getName(),
proc instanceof CustomUpdateRequestProcessor);
int n=0;
boolean foundLog = false;
for (;;) {
n++;
if (proc instanceof LogUpdateProcessor) {
foundLog = true;
}
proc = proc.next;
if (proc == null) break;
}
assertTrue( n < chain.getFactories().length ); // some processors should have been dropped
assertTrue( foundLog ); // make sure the marker interface was successful in keeping the log processor
}
}
示例15: testUniqFields
import org.apache.solr.core.SolrCore; //导入方法依赖的package包/类
@Test
public void testUniqFields() throws Exception {
SolrCore core = h.getCore();
UpdateRequestProcessorChain chained = core
.getUpdateProcessingChain("uniq-fields");
UniqFieldsUpdateProcessorFactory factory = ((UniqFieldsUpdateProcessorFactory) chained
.getFactories()[0]);
assertNotNull(chained);
addDoc(adoc("id", "1a",
"uniq", "value1",
"uniq", "value1",
"uniq", "value2"));
addDoc(adoc("id", "2a",
"uniq2", "value1",
"uniq2", "value2",
"uniq2", "value1",
"uniq2", "value3",
"uniq", "value1",
"uniq", "value1"));
addDoc(adoc("id", "1b",
"uniq3", "value1",
"uniq3", "value1"));
addDoc(adoc("id", "1c",
"nouniq", "value1",
"nouniq", "value1",
"nouniq", "value2"));
addDoc(adoc("id", "2c",
"nouniq", "value1",
"nouniq", "value1",
"nouniq", "value2",
"uniq2", "value1",
"uniq2", "value1"));
assertU(commit());
assertQ(req("id:1a"), "count(//*[@name='uniq']/*)=2",
"//arr[@name='uniq']/str[1][.='value1']",
"//arr[@name='uniq']/str[2][.='value2']");
assertQ(req("id:2a"), "count(//*[@name='uniq2']/*)=3",
"//arr[@name='uniq2']/str[1][.='value1']",
"//arr[@name='uniq2']/str[2][.='value2']",
"//arr[@name='uniq2']/str[3][.='value3']");
assertQ(req("id:2a"), "count(//*[@name='uniq']/*)=1");
assertQ(req("id:1b"), "count(//*[@name='uniq3'])=1");
assertQ(req("id:1c"), "count(//*[@name='nouniq']/*)=3");
assertQ(req("id:2c"), "count(//*[@name='nouniq']/*)=3");
assertQ(req("id:2c"), "count(//*[@name='uniq2']/*)=1");
}