2012-04-17 4 views
0

solrとmysqlの日付をうまく再生できません。私がsentフィールドをスキーマからコメントアウトすると、すべて正常に動作します。ただし、日付フィールドに追加するとすぐに、すべてのドキュメントでこのエラーが発生します。MysqlからSolrに日付をインポートする際に必須のフィールドがありません

org.apache.solr.common.SolrException: [doc=116] missing required field: sent 

ここで私はsolrを設定しました。私は空/ヌル日付が存在しないことを確認するためにチェットしました。私もdateTimeFormat = yyyy-MM-dd'T'hh:mm:ssを試しましたが、dateTimeFormatは設定されていません。また、スキーマで送信された型のdateとtdateの両方を試しました。

dataconfig.xmlフィールド名が列名と同じである必要があります日付の

<field name="id" type="tint" indexed="true" stored="true" required="true" /> 
    <field name="raw_text" type="text_general" indexed="true" stored="false" required="true" multiValued="true"/> 

    <field name="sent" type="date" indexed="true" stored="true" required="true" /> <!-- Import succeeds if I comment this line out --> 
    <field name="body" type="text_general" indexed="true" stored="true" required="true" /> 

答えて

0

どうやら

<dataConfig> 
    <dataSource driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/hoplite" user="root" password="root"/> 
    <document> 
     <entity name="document" query="select * from document"> 
      <field column="ID" name="id" /> 
      <field column="RAW_TEXT" name="raw_text" />  
      <entity name="email" query="select * from email where document_id='${document.id}'">     
       <field column="TIME_SENT" name="sent" dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss'Z'"/> 
       <field column="BODY" name="body" /> 
      </entity> 
     </entity> 
    </document> 
</dataConfig> 

のschema.xml。したがって、ファイルを以下に変更すると問題が解決されました。 time_sentが列名とフィールド名の両方になりました。

データ-config.xmlの

<dataConfig> 
    <dataSource driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/hoplite" user="root" password="root"/> 
    <document> 
     <entity name="document" query="select * from document"> 
      <field column="ID" name="id" /> 
      <field column="RAW_TEXT" name="raw_text" /> 

      <entity name="email" query="select * from email where document_id='${document.id}'">     
       <field column="TIME_SENT" name="time_sent" dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss'Z'"/> 
       <field column="BODY" name="body" /> 
      </entity> 
     </entity> 
    </document> 
</dataConfig> 

のschema.xml

<field name="id" type="tint" indexed="true" stored="true" required="true" /> 
    <field name="raw_text" type="text_general" indexed="true" stored="false" required="true" multiValued="true"/> 

    <field name="time_sent" type="date" indexed="true" stored="true" required="true" /> <!-- Import succeeds if I comment this line out --> 
    <field name="body" type="text_general" indexed="true" stored="true" required="true" /> 
関連する問題