splitting multivalued field while importing data into solr

ε祈祈猫儿з 提交于 2019-12-07 19:49:23

问题


I'm having a bit of trouble getting my head around solr 3.4 when it comes to multiple values. I have this DIH:

<dataConfig>
    <dataSource type="JdbcDataSource" name="********" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/lokal" user="****" password="******" />
    <document>
        <entity name="Search" transformer="RegexTransformer" query="select b_id, b_navn, b_cats, b_info, b_keyword, b_critical, b_geo, b_adress from searchbiz">
            <field column="b_id" name="b_id" />
            <field column="b_info" name="b_info" />
            <field column="b_cats" name="b_cats" splitBy=","/>
        </entity>
    </document>
</dataConfig>

Now, my problem is when this b_cats is index'ed Im getting this result :

<arr name="b_adress">
  <str>place1, place2</str>
</arr>

But I thought it should be one node on each.

When I try to facet using this field, I'm getting "place1, place2" = xx result, instead of place1 = xx, and place2 xx.

Can anybody please point me in the right direction on this problem?

Thanks ;)


回答1:


Here is the solution:

<dataConfig>
<dataSource type="JdbcDataSource" name="********" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/lokal"     user="****" password="******" />
<document>
    <entity name="Search" transformer="RegexTransformer" query="select b_id, b_navn, b_cats, b_info, b_keyword, b_critical,     b_geo, b_adress from searchbiz">
        <field column="b_id" name="b_id" />
        <field column="b_info" name="b_info" />
        <field column="b_cats" splitBy="," sourceColName="b_cats"/>
    </entity>
</document>



来源:https://stackoverflow.com/questions/8971476/splitting-multivalued-field-while-importing-data-into-solr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!