2012-03-22 42 views
0

私はSolrの新しいユーザーです。複数のテーブルに対してfull_importコマンドを実行すると、正常に動作しています。更新された日付はdataimport.propertiesファイルに書き込まれます。 Solrのコンソール上solrで複数のテーブルを使用するためのデルタインポート

<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> 

エラー:

を私はデルタのインポートを実行するときには、次のように and deltaQuery inデータ-config.xml`が..です

クエリdeltaImportQueryをコンテキストをinitilizing中に例外が発生した与えています

[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.. 

私のdatabseは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) 

誰もが問題を解決する方法を知って変わったのか?

答えて

2

あなたのデータ-configファイルに無効なXML構文を持っている...

正しい1:

<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> 
関連する問題