0

solr と mysql の日付を正常に動作させるのに問題があります。sentスキーマからフィールドをコメントアウトすると、すべて正常に機能します。ただし、日付フィールドに追加するとすぐに、すべてのドキュメントでこのエラーが発生します。

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

これがsolrの構成方法です。空/nullの日付がなく、そうでないことを確認するようにしました。dateTimeFormat= も試しましたがyyyy-MM-dd'T'hh:mm:ss、dateTimeFormat が設定されていません。また、スキーマで送信されたタイプの日付と tdate の両方を試しました。

dataconfig.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="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="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" /> 
4

1 に答える 1

-1

どうやら日付の場合、フィールド名は列名と同じでなければなりません。そのため、ファイルを以下に変更すると問題が修正されました。time_sent が列名とフィールド名の両方になっていることに注意してください。

データ構成.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" />
于 2012-04-17T20:21:00.900 に答える