1

ここでは、対応する MySQL 列のデータ型に正しいフィールド型を選択することに関するいくつかの質問を見てきましたが、私の問題は少し奇妙です。タイプ の MySQL の投稿の列があり、Solr でそれにtext対応しようとしました。しかし、DIH を使用してインポートするたびに、BLOB オブジェクトとしてインポートされます。私がチェックしたところ、これはタイプの列に対してのみ発生しており、 (文字列としてインデックスが作成されている)に対しては発生していません。したがって、投稿フィールドは検索可能になりません。field-typeschema.xmlstring, text, text-wstextvarchar

*:*Solrでクエリ検索を行ったときに、検索の失敗を繰り返した後、この問題を発見しました。サンプル応答:

    <result name="response" numFound="223" start="0" maxScore="1.0">
    <doc>
    <float name="score">1.0</float>
    <str name="solr_post_bio">[B@10a33ce2</str>
    <date name="solr_post_created_at">2011-02-21T07:02:55Z</date>
    <str name="solr_post_email">test.account@gmail.com</str>
    <str name="solr_post_first_name">Test</str>
    <str name="solr_post_last_name">Account</str>
    <str name="solr_post_message">[B@2c93c4f1</str>
    <str name="solr_post_status_message_id">1</str>
    </doc>

編集 :

以下の詳細を提供していないことをお詫び申し上げます。

data-config.xml:_

    <document>
    <entity name="posts" dataSource="jdbc"  query="select 
        p.person_id as solr_post_person_id,
        pr.first_name as solr_post_first_name,
        pr.last_name as solr_post_last_name,
        u.email as solr_post_email,
        p.message as solr_post_message,
        p.id as solr_post_status_message_id,
        p.created_at as solr_post_created_at,
        pr.bio as solr_post_bio
        from posts p,users u,profiles pr where p.person_id = u.id and p.person_id = pr.person_id and p.type='StatusMessage'">               
            <field column="solr_post_person_id" />
        <field column="solr_post_first_name"/>
        <field column="solr_post_last_name" />
        <field column="solr_post_email" />
        <field column="solr_post_message" />
        <field column="solr_post_status_message_id" />
        <field column="solr_post_created_at" />
        <field column="solr_post_bio"/>
       </entity>
  </document>

schema.xml:_

<fields>
    <field name="solr_post_status_message_id" type="string" indexed="true" stored="true" required="true" />
    <field name="solr_post_message" type="text_ws" indexed="true" stored="true" required="true" />  
    <field name="solr_post_bio" type="text" indexed="false" stored="true" />
    <field name="solr_post_first_name" type="string" indexed="false" stored="true" />
    <field name="solr_post_last_name" type="string" indexed="false" stored="true" />
    <field name="solr_post_email" type="string" indexed="false" stored="true" />
    <field name="solr_post_created_at" type="date" indexed="false" stored="true" />
</fields>
<uniqueKey>solr_post_status_message_id</uniqueKey>
<defaultSearchField>solr_post_message</defaultSearchField>
4

1 に答える 1

0

私はこれと同じ問題を抱えていました。すべての設定とスキーマは正しかったのですが、短いテキスト フィールドにまだブロブが表示されていました。

多くの頭を悩ませた後、私はついにこの交換に出くわしました: http://qnalist.com/questions/624892/solr-dih-importing-mysql-text-column-as-a-blob

MySQL または JDBC のいずれかにバグがあり、まれに CHAR または VARCHAR フィールドが代わりに BLOB として表示されることが判明しました。かなり古いバージョンで作業しているため、バグはMySQLにあったと思われます。

私の場合、回避策は値を CONCAT() でラップ、それを CAST() でラップすることでした。これにより、最終的にMySQLは、はい、私のテキスト列は本当にテキストであると確信しました。

CAST(CONCAT('',your_column) AS CHAR(20))

あなたが問題の解決策を見つけたかどうかはわかりませんが、私がそれに遭遇したとき、このページは私の Google 検索で頻繁に出てきました。

于 2015-05-18T20:16:42.157 に答える