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'` 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 === Multiple DataSources === - It is possible to have more than one datasources for a configuration. To configure an extra datasource , just keep an another 'dataSource' tag . There is an implicit attribute "name" for a datasource. If there are more than one, each extra datasource must be identified by a unique name `'name="datasource-2"'` + It is possible to have more than one datasources for a configuration. To configure an extra datasource , just keep an another 'dataSource' tag . There is an implicit attribute "name" for a datasource. If there are more than one, each extra datasource must be identified by a unique name `'name="datasource-2"'` . eg: {{{ @@ -136, +137 @@ {{{ <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"> <field column="ID" name="id" /> @@ -180, +182 @@ </entity> </entity> }}} - - * The dataimport section in ''solr/db/conf/solrconfig.xml'' in the example-solr-home you downloaded, is as follows: - {{{ - <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler"> - <lst name="defaults"> - <str name="config">db-data-config.xml</str> - <lst name="datasource"> - <str name="driver">org.hsqldb.jdbcDriver</str> - <str name="url">jdbc:hsqldb:./hsqldb/ex</str> - <str name="user">sa</str> - <str name="password"></str> - </lst> - </lst> - </requestHandler> - }}} === 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)
