raindrop_boy
raindrop_boy

Reputation: 63

how to cfg Multiple DataSources in solr?

My db-data-config.xml like this:

<dataSource name="192.168.5.206" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://192.168.5.206:3306/editor_app" user="root" password="tvmining" />
<dataSource name="localhost" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://192.168.4.49/titans_myself" user="editor" password="tvm_editor" />

<document>
    <entity dataSource ="192.168.5.206" name="product_info" query="SELECT t.id, t.title, t.keyword, t.update_time FROM product_info t" deltaQuery="SELECT t.id FROM product_info t where t.update_time &gt; '${dataimporter.last_index_time}'" deltaImportQuery="SELECT t.id, t.title, t.keyword, t.update_time FROM product_info t where t.id='${dataimporter.delta.id}'">
        <field column="id" name="id" />
        <field column="title" name="title" />
        <field column="keyword" name="keyword" />
        <field column="update_time" name="update_time" />
    </entity>

    <entity dataSource ="localhost" name="log_info" query="SELECT t.id, t.operation_content FROM log_info t " deltaQuery="SELECT t.id, t.operation_content FROM log_info t where t.update_time &gt; '${dataimporter.last_index_time}'" deltaImportQuery="SELECT t.id, t.operation_content FROM log_info t where t.id='${dataimporter.delta.id}'">
        <field column="id" name="id" />
        <field column="operation_content" name="operation_content" />
    </entity>
</document>

but when I enter 'http://192.168.4.40:8080/solr/update/database?command=full-import', there always import the first entity data. How can I import two entities data?

Upvotes: 1

Views: 318

Answers (2)

Persimmonium
Persimmonium

Reputation: 15789

this should work as is in order to import both entities. Now, maybe you expect to have a single doc in solr with fields from both entities if the id is the same?? If that is what you are looking for, you need to join the tables somehow, and use a single entity

Upvotes: 1

javanna
javanna

Reputation: 60235

Try with this url:

http://192.168.4.40:8080/solr/update/database?command=full-import&entity=log_info

I just added the entity parameter with the name of the entity as value.

Upvotes: 0

Related Questions