Solr 1.4:没有提交自定义UpdateRequestProcessorFactory

时间:2012-04-26 16:39:49

标签: solr processor dih

我在DIH中使用UpdateRequestProcessorChain并解决数据未提交到索引的问题。我试图调试我的处理器,它的工作原理。 full-import命令的状态为:

<response>
<lst name="responseHeader">
    <int name="status">0</int>
    <int name="QTime">1</int>
</lst>
<lst name="initArgs">
    <lst name="defaults">
        <str name="update.processor">DataImportChain</str>
        <str name="config">data-config.xml</str>
    </lst>
</lst>
<str name="command">status</str>
<str name="status">idle</str>
<str name="importResponse"/>
<lst name="statusMessages">
    <str name="Total Requests made to DataSource">0</str>
    <str name="Total Rows Fetched">7</str>
    <str name="Total Documents Skipped">0</str>
    <str name="Full Dump Started">2012-04-26 17:47:44</str>
    <str name="">Indexing completed. Added/Updated: 6 documents. Deleted 0 documents.</str>
    <str name="Committed">2012-04-26 17:47:45</str>
    <str name="Optimized">2012-04-26 17:47:45</str>
    <str name="Total Documents Processed">6</str>
    <str name="Time taken ">0:0:1.174</str>
</lst>
<str name="WARNING">This response format is experimental.  It is likely to change in the future.</str>

但catalina.out中没有提供调用提交过程的信息:

26.04.2012 17:47:44 org.apache.solr.handler.dataimport.DataImporter doFullImport
INFO: Starting Full Import
26.04.2012 17:47:44 org.apache.solr.core.SolrCore execute
INFO: [dev] webapp=/solr path=/dataimport params={clean=true&commit=true&command=full-import} status=0 QTime=20 
26.04.2012 17:47:44 org.apache.solr.handler.dataimport.SolrWriter readIndexerProperties
INFO: Read dataimport.properties
26.04.2012 17:47:45 org.apache.solr.handler.dataimport.XPathEntityProcessor initXpathReader
INFO: Using xslTransformer: com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl
26.04.2012 17:47:45 org.apache.solr.handler.dataimport.DocBuilder finish
INFO: Import completed successfully
26.04.2012 17:47:45 org.apache.solr.handler.dataimport.SolrWriter readIndexerProperties
INFO: Read dataimport.properties
26.04.2012 17:47:45 org.apache.solr.handler.dataimport.SolrWriter persist
INFO: Wrote last indexed time to dataimport.properties
26.04.2012 17:47:45 org.apache.solr.handler.dataimport.DocBuilder execute
INFO: Time taken = 0:0:1.174

日志中没有任何错误。如果我在没有UpdateRequestProcessorChain的情况下使用DIH,则提交没有问题。有谁知道这里可能出现什么问题?

以下是我的solrconfig.xml中的配置:

<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
    <lst name="defaults">
        <str name="update.processor">DataImportChain</str>
        <str name="config">data-config.xml</str>  
    </lst>
</requestHandler>

<updateRequestProcessorChain name="DataImportChain" >
    <processor class="my.package.MyProcessorFactory" />
</updateRequestProcessorChain>

1 个答案:

答案 0 :(得分:1)

你遗漏了updateRequestProcessorChain中的一些基本处理器,这就是没有任何反应的原因。试试这个配置:

<updateRequestProcessorChain name="DataImportChain" >
    <processor class="my.package.MyProcessorFactory" />
    <processor class="solr.RunUpdateProcessorFactory" />
    <processor class="solr.LogUpdateProcessorFactory" />
</updateRequestProcessorChain>

RunUpdateProcessorFactory实际上是链中的“普通东西”。如果你忘了它,你正在预处理从未编入索引的东西。