Solr DIH Mysql configuration

87 views Asked by At
<entity name="tw_tweet_user_merged" query="select * from tw_tweet_user_merged">
    <field column="id" name="id" />
    <field column="gender" name="gender" />
    <entity name="tw_flag" query="select moderator_id from tw_flag where tweet_id='${tw_tweet_user_merged.id}'">
        <field column="moderator_id" name="moderator_id" />
    </entity>
</entity>

This is my DIH data-config.xml,
It is importing id, user_id but not uid, flagged_by in schema.xml is

<field name="moderator_id" type="text_general" indexed="true" stored="true" required="false" multiValued="true"/>
2

There are 2 answers

0
elyograg On BEST ANSWER

I believe that you have column and name reversed in your config.

You can also get rid of the field config and do the name changing in the SQL:

select uid as flagged_by from flag where tweet_id='${tweets.id}'

0
Wasim A. On

don't know why, but

<entity name="tw_tweet_user_merged" query="select * from tw_tweet_user_merged">
    <field column="id" name="id" />
    <field column="gender" name="gender" />
    <entity name="tw_flag" query="select moderator_id as flagged from tw_flag where tweet_id='${tw_tweet_user_merged.id}'">
        <field column="moderator_id" name="moderator_id" />
    </entity>
</entity>

work for me. Just adding "as someColName" in sub query