2016-03-09 19 views
-1

我無法導入不包含所有必需字段的XML。因此我需要將這些字段的值作爲「NA」或其他名稱傳遞。 如何在solr中的dataimporthandler模​​塊中使用XPathEntityprocessor。 我的數據-config.xml中如下所示:在導入時使用xpath導入時添加自定義字段列

<dataConfig> 
    <dataSource type="FileDataSource" /> 
    <document> 
      <entity name="document" 
        pk="image_link" 
        url="/Users/home/file.xml" 
        processor="XPathEntityProcessor" 

        forEach="/rss/channel/item" 

        > 

        <field column="cp_id"  xpath="/rss/channel/item/productid" /> 
        <field column="title" xpath="/rss/channel/item/title" /> 
        <field column="description"  xpath="/rss/channel/item/description" /> 
        <field column="link" xpath="/rss/channel/item/link" /> 
        <field column="image_link" xpath="/rss/channel/item/imagelink" /> 
        <field column="category_name"  xpath="/rss/channel/item/categoryname" /> 
        <field column="sub_category_name"   xpath="/rss/channel/item/subcategoryname" /> 
        <field column="brand" xpath="/rss/channel/item/brand" /> 
        <field column="mrp"  xpath="/rss/channel/item/originalprice" /> 
        <field column="offer_price" xpath="/rss/channel/item/discountedprice" /> 
        <field column="source">sometext</field> 
        <field column="master_category" name="X"/> 
        <field column="master_category1" name="X"/> 
        <field column="master_category2" name="X" /> 
        <field column="discount" xpath="/rss/channel/item/availability" /> 
        <field column="comparison" name="0" /> 
      </entity> 
    </document> 

在這裏,我需要與指定的固定值加源列。

由於

回答