solr で xml ファイルのインデックスを作成するのに問題があります。XMLをインポートするためにDIHハンドルを使用しています。
以下は私のxmlデータファイルの一部で、名前はhw1.xmlです
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
以下は私のスキーマファイルです
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="ECPS_Schema" version="1.5">
<fields>
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="to" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="from" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="heading" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="body" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="text" type="text_field" indexed="true" stored="true" />
<field name="_version_" type="long" indexed="true" stored="true"/>
</fields>
<uniqueKey>id</uniqueKey>
<copyField source="to" dest="text"/>
<copyField source="from" dest="text"/>
<copyField source="heading" dest="text"/>
<copyField source="body" dest="text"/>
<types>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" />
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="text_field" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
</analyzer>
</fieldType>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
</types>
</schema>
以下は私のデータ構成ファイルです
<dataConfig>
<dataSource type="FileDataSource" encoding="UTF-8" />
<document>
<entity name="page" processor="XPathEntityProcessor" stream="true" forEach="/doc" url="/opt/solr-4.4.0/solr/example/exampledocs" forEach="/note" transformer="RegexTransformer,DateFormatTransformer">
<field column="file" name="id"/>
<field column="to" xpath="/note/to" indexed="true" multiValued="false"/>
<field column="from" xpath="/note/from" indexed="true" multiValued="false"/>
<field column="heading" xpath="/note/heading" indexed="true" multiValued="false"/>
<field column="body" xpath="/note/body" indexed="true" multiValued="false"/>
</entity>
</document>
</dataConfig>
これをsolrconfig.xmlに追加しました。
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>
私の質問は、DIH を使用していて、data-config ファイルに xml ファイルの場所を示す url パラメータがあるためです。POST hw1.xml ファイルなど、他に何かする必要がありますか? コアの作成中に、dataconfig ファイルを参照し、url 属性に示されているディレクトリから記述された形式に適合する xml をロードすると想定するのは正しいですか?
<entity name="page" processor="XPathEntityProcessor" stream="true" forEach="/doc" url="/opt/solr-4.4.0/solr/example/exampledocs" forEach="/note" transformer="RegexTransformer,DateFormatTransformer">
ログはエラーを示していませんが、numDocs のインデックスが 0 になっています。これをデバッグするにはどうすればよいですか?