Dear Wiki user, You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The following page has been changed by NoblePaul: http://wiki.apache.org/solr/DataImportHandler ------------------------------------------------------------------------------ {{{ <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/dbname" user="db_username" password="db_password"/> }}} - '''note'' The 'type' attribute is optional . The default value is `'JdbcDataSource'` + '''note''' The 'type' attribute is optional . The default value is `'JdbcDataSource'` The datasource configuration can also be done in data-config xml [#solrconfigdatasource also] . The attributes other than 'type' and 'name' are not decided by the datasource implementation. Each one can decide what it needs. We will discuss them as we see them @@ -60, +60 @@ eg: {{{ - <dataSource type="JdbcDataSource" name="datasource-1" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://db1-host/dbname" user="db_username" password="db_password"/> + <dataSource type="JdbcDataSource" name="ds-1" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://db1-host/dbname" user="db_username" password="db_password"/> - <dataSource type="JdbcDataSource" name="datasource-2" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://db2-host/dbname" user="db_username" password="db_password"/> + <dataSource type="JdbcDataSource" name="ds-2" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://db2-host/dbname" user="db_username" password="db_password"/> }}} in your entities: {{{ .. - <entity name="one" dataSource="datasource-1" ...> + <entity name="one" dataSource="ds-1" ...> .. </entity> - <entity name="two" dataSource="datasource-2" ...> + <entity name="two" dataSource="ds-2" ...> .. </entity> .. @@ -182, +182 @@ </entity> </entity> }}} - + [[Anchor(shortconfig)]] === A shorter data-config === In the above example, there are mappings of fields to Solr fields. It is possible to totally avoid the field entries in entities if the names of the fields are same (case does not matter) as those in Solr schema. You may need to add a field entry if any of the inbuilt Tranformers are used (see Transformer section) The shorter version is given below {{{ <dataConfig> + <dataSource driver="org.hsqldb.jdbcDriver" url="jdbc:mysql://db1-host/dbname" user="sa" /> <document name="products"> <entity name="item" pk="ID" query="select * from item"> <entity name="feature" query="select description as features from feature where item_id='${item.ID}'"/>
