私はDIHを使用してSolrのデータベースからデータのインデックスを作成しようとしています。最も簡単なSolrのDIHインデックス
次のようにだから私は2の設定ファイルを変更した:
solrconfig.xml:
<requestHandler name="/dataimport"
class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>
データ-config.xmlの:
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/test" user="root" password="****"/>
<document>
<entity name="source_scellee" query="select * from source_scellee">
</entity>
</document>
</dataConfig>
source_scelleeがあることを私のテストデータベース上の私のテーブルの名前。それは多くのフィールドを含んでいます。
明らかに、私は簡単なテスト以外は何も実行しようとしていません。サーバーのログには何の警告もエラーのほかに
<str name="Full Dump Started">2012-01-27 12:27:01</str><str name="">Indexing completed. Added/Updated: 4 documents. Deleted 0 documents.</str><str name="Committed">2012-01-27 12:27:02</str>
<str name="**Total Documents Failed**">4</str>
:http://localhost:8983/solr/dataimport?command=full-import&clean=false&commit=trueを実行しているとき、私は、次の結果を取得します。 4はテーブル "source_scellee"内のレコード数です。しかし、それはすべての文書が失敗すると言います。
http://localhost:8983/solr/admin/ からクエリを実行した場合、結果はまったく表示されません。どうすれば解決できますか? ( ":"には結果が表示されません)
ありがとうございました!
----編集--- は私のschema.xmlにこれらの行を追加しました:
<field name="ID" type="int" indexed="true" stored="true" />
<field name="reference_catalogue" type="string" indexed="true" stored="true"/>
<field name="reference_capsule" type="string" indexed="true" stored="true"/>
<field name="organisme_certificateur" type="string" indexed="true" stored="true" />
<field name="reference_certificat" type="string" indexed="true" stored="true" />
<field name="duree_d_utilisation" type="string" indexed="true" stored="true" />
<field name="activite_nominale" type="string" indexed="true" stored="true"/>
<field name="activite_minimale" type="string" indexed="true" stored="true"/>
<field name="activite_maximale" type="string" indexed="true" stored="true"/>
<field name="coffret" type="boolean" indexed="true" stored="true"/>
<field name="dispositif_medical" type="boolean" indexed="true" stored="true"/>
<field name="forme_speciale" type="boolean" indexed="true" stored="true" />
<field name="exemption_cpa" type="boolean" indexed="true" stored="true"/>
<field name="marquage_ce" type="boolean" indexed="true" stored="true"/>
<field name="element_cible" type="boolean" indexed="true" stored="true"/>
結果はまだ同じであるしかし:照会は結果が(私はSolrのを再起動しようとしません、
<document>
<entity name="source_scellee" query="select * from source_scellee">
<field column="ID" name="ID_i" />
<field column="reference_catalogue" name="reference_catalogue_s" />
<field column="reference_capsule" name="reference_capsule_s" />
<field column="organisme_certificateur" name="organisme_certificateur_s" />
<field column="reference_certificat" name="reference_certificat_s" />
<field column="duree_d_utilisation" name="duree_d_utilisation_s" />
<field column="activite_nominale" name="activite_nominale_s" />
<field column="activite_minimale" name="activite_minimale_s" />
<field column="activite_maximale" name="activite_maximale_s" />
<field column="coffret" name="coffret_b" />
<field column="dispositif_medical" name="dispositif_medical_b" />
<field column="forme_speciale" name="forme_speciale_b" />
<field column="exemption_cpa" name="exemption_cpa_b" />
<field column="marquage_ce" name="marquage_ce_b" />
<field column="element_cible" name="element_cible_b" />
</entity>
</document>
:とすべてのも)、インデックスを再し
------第二編集--- 私はダイナミックインポート が今私のデータ-config.xmlにはこのようになります試してみました
thx、私の質問を編集してください。 – zg2pro
テーブルカラムIDがソルフィールドID_iにマッピングされているように見えますが、IDのID_iにはファイル定義がありません。 RDBMS ColumnnamesとSolr-Filed-Namesが同じ場合、data-config.xmlのフィールドをマップする必要はありません。私の編集を見てください。ちなみに:IDは一意です:あなたのフォーカスがフルテキスト検索を使用している場合は、フィールドを格納する必要はありません –
したがって、フィールド型を自分のフィールドに動的に割り当てるには、列名の名前を_i RDBMSの_sですか? IDは固有です。はい。 – zg2pro