0

私はSolrの初心者です。複数のテーブルに対して full_import コマンドを実行すると、正常に動作します。更新された日付がdataimport.propertiesファイルに書き込まれます。デルタインポートを実行すると、コンテキストの初期化中に例外が発生しました..

クエリ deltaImportQuery anddeltaQuery indata-config.xml` は次のとおりです。

<dataConfig>
<dataSource name="JdbcDataSource" 
    driver="com.mysql.jdbc.Driver" 
    url="jdbc:mysql://localhost:3306/hellodb" 
    user="root" 
    password="root" 
    batchSize="-1" />

<document>

<entity name="bhushan"         datasource="jdbcDataSource"  pk="id"         query="select * from bhushan" 
                               deltaImportQuery="select * from bhushan where id=='${dataimporter.delta.id}'"
                               deltaQuery="select id from bhushan where last_modified &gt; '${dataimporter.last_index_time}'"/>



<entity name="sunny"          datasource="jdbcDataSource"   pk="id"     
                              query="select weight as sunny from sunny where id='${bhushan.ID}'"
                              deltaQuery="select id from sunny where last_modified > '${dataimporter.last_index_time}'"
                              parentDeltaQuery="select id from bhushan where ID=${sunny.id}"/>
enter code here

</entity>

</entity>

</document>
</dataConfig>

Solr コンソールのエラー:

[Fatal Error] :30:3: The element type "document" must be terminated by the matching end-tag "</document>".
Mar 21, 2012 11:57:51 AM org.apache.solr.handler.dataimport.DataImportHandler inform
SEVERE: Exception while loading DataImporter
org.apache.solr.handler.dataimport.DataImportHandlerException: Exception occurred while initializing context
        at org.apache.solr.handler.dataimport.DataImporter.loadDataConfig(DataImporter.java:190)
        at org.apache.solr.handler.dataimport.DataImporter.<init>(DataImporter.java:101)
        at org.apache.solr.handler.dataimport.DataImportHandler.inform(DataImportHandler.java:113)
        at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:508)
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:588)
        at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:137)
Caused by: org.xml.sax.SAXParseException; lineNumber: 30; columnNumber: 3; The element type "document" must be
 terminated by the matching end-tag "</document>".
        at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        at org.apache.solr.handler.dataimport.DataImporter.loadDataConfig(DataImporter.java:178)
        ... 30 more

Mar 21, 2012 11:57:51 AM org.apache.solr.servlet.SolrDispatchFilter init
SEVERE: Could not start SOLR. Check solr/home property
org.apache.solr.common.SolrException: FATAL: Could not create importer. DataImporter config invalid
        at org.apache.solr.handler.dataimport.DataImportHandler.inform(DataImportHandler.java:121)
        at org.apache.solr.core.SolrResourceLoader.inform(SolrResourceLoader.java:508)
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:588)
        at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:137)
Caused by: org.apache.solr.handler.dataimport.DataImportHandlerException: Exception occurred while initializin
g context..

私のデータベースはhellodbです.. mysql> use hellodb; データベースが変更されました

mysql> select * from bhushan;
+----+---------+---------------------+
| id | name    | last_modified       |
+----+---------+---------------------+
|  1 | mangesh | 2012-03-17 14:20:57 |
|  2 | appa    | 2012-03-17 14:24:20 |
|  3 | xxxx    | 2012-03-17 14:27:09 |
|  4 | yyyy    | 2012-03-17 14:35:25 |
|  5 | zzzz    | 2012-03-17 14:37:59 |
|  6 | hhh     | 2012-03-19 11:45:27 |
+----+---------+---------------------+
6 rows in set (0.02 sec)

mysql> select * from sunny;
+------+--------+
| id   | weight |
+------+--------+
|    1 |    511 |
|    2 |    911 |
|    3 |   1111 |
|    4 |   5555 |
|    5 |   7777 |
|    6 |    888 |
+------+--------+
6 rows in set (0.01 sec)

誰でも問題を解決する方法を知っていますか?

4

1 に答える 1

2

データ構成ファイルに無効な XML 構文が含まれています...

正しいもの:

<dataConfig>
<dataSource name="JdbcDataSource" 
    driver="com.mysql.jdbc.Driver" 
    url="jdbc:mysql://localhost:3306/hellodb" 
    user="root" 
    password="root" 
    batchSize="-1" />

<document>

<entity name="bhushan"         datasource="jdbcDataSource"  pk="id"         query="select * from bhushan" 
                               deltaImportQuery="select * from bhushan where id=='${dataimporter.delta.id}'"
                               deltaQuery="select id from bhushan where last_modified &gt; '${dataimporter.last_index_time}'">


</entity>
<entity name="sunny"          datasource="jdbcDataSource"   pk="id"     
                              query="select weight as sunny from sunny where id='${bhushan.ID}'"
                              deltaQuery="select id from sunny where last_modified > '${dataimporter.last_index_time}'"
                              parentDeltaQuery="select id from bhushan where ID=${sunny.id}">

</entity>


</document>
</dataConfig>
于 2012-04-26T11:31:53.077 に答える