私はSolrの中に新たなんだ、それは私のschema.xml言うように、私はこれは必須ですが、IDフィールドが含まれていないいくつかのXMLデータをインポートするために苦労しています:DataImportHandlerを使用してIdを生成する方法は?
XMLの例:
<results>
<estacions>
<estacio id="72400" nom="Aeroport"/>
<estacio id="79600" nom="Arenys de Mar"/>
...
</estacions>
</results>
のSchema.xml:
<uniqueKey>id</uniqueKey>
この時点では、私はその後、私はDataimportHandlerを使用し、フェッチのhttpから、このXMLをインポートする必要があります。 これは
<dataConfig>
<dataSource type="URLDataSource" />
<document>
<entity name="renfe"
url="http://host_url/myexample.xml"
processor="XPathEntityProcessor"
forEach="/results/estacions/estacio"
transformer="script:generateCustomId">
<field column="idestacio" xpath="/results/estacions/estacio/@id" commonField="true" />
<field column="nomestacio" xpath="/results/estacions/estacio/@nom" commonField="true" />
</entity>
</document>
その後
は、正常に動作しているように私のデータ-config.xmlのですが、私は次のエラーを得た: org.apache.solr.common.SolrException:[DOC =ヌルを]必須フィールドがありません:
これは、インポート時に自動IDを生成し、data-config.xmlを使用する必要があると思いますが、どうやってそれを行うかはわかりません。
どうすればよいですか? ScriptTransformerを使用していますか?任意のアイデアは感謝しています
もう1つの質問:インポート中に値を強制できますか? EXのために
:<field column="site" value="estacions"/>
(明らかにこれは動作しません)
グレート!今はとても簡単です... – larrytron