0
XML有一些描述性字段,我想用它們來選擇特定的字段。有沒有辦法讓數據導入處理程序只使用「code = 34089-3」作爲關鍵字來選擇「文本塊A」和「文本塊B」?代碼字段沒有數據,但它對於我想要選擇的信息類型是唯一的。當我使用xpath =「/ document/component/section/text/paragraph」時,我最終得到了文本塊A,B,C和D.理想情況下,我希望能夠只選擇文本塊A.這甚至可能嗎?如何使用Solr DIH根據描述值選擇XML?
<component>
<section>
<id root="f915965e-fe3b-44eb-a2ed-c11f807e7f23"/>
<code code="34089-3"/>
<title>Title A</title>
<text>
<paragraph>Text Block A</paragraph>
<paragraph>Text Block B</paragraph>
</text>
</section>
</component>
<component>
<section>
<id root="80b7e2f1-f49f-4309-a340-210536705d4a"/>
<code code="34090-1"/>
<title>Title B</title>
<text>
<paragraph>Text Block C</paragraph>
<paragraph>Text Block D</paragraph>
</text>
</section>
</component>
<entity
name="IUPAC"
processor="XPathEntityProcessor"
forEach="/document"
url="${f.fileAbsolutePath}">
<field column="chemical_name" xpath="/document/component/section/code[@code='34089-3']/access below values???" />
</entity>
謝謝...但沒有奏效。我認爲這可能是solr中xpath實現的限制。我正在嘗試瞭解如何在這種情況下應用「xsl」選項,但尚未成功。 –
如何處理所有部分,並告訴Solr跳過代碼不正確的地方? https://cwiki.apache.org/confluence/display/solr/Uploading+Structured+Data+Store+Data+with+the+Data+Import+Handler#UploadingStructuredDataStoreDatawiththeDataImportHandler-SpecialCommandsfortheDataImportHandler與一些變壓器? – Fuxi