Skip to content

Instantly share code, notes, and snippets.

@sebnmuller
Last active February 11, 2016 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sebnmuller/03935f1384e150504363 to your computer and use it in GitHub Desktop.
Save sebnmuller/03935f1384e150504363 to your computer and use it in GitHub Desktop.
Connection config for indexing a database to Solr
<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/employees"
user="user"
password="password" />
<document>
<entity name="id" query="select emp_no as 'id', first_name, last_name from employees limit 1000;" />
</document>
</dataConfig>
select e.emp_no as 'id', e.birth_date,
(
select t.title
order by t.`from_date` desc
limit 1
) as 'title_s', e.first_name, e.last_name, e.gender as 'gender_s', d.`dept_name` as 'dept_s'
from employees e
join dept_emp de on de.`emp_no` = e.`emp_no`
join departments d on d.`dept_no` = de.`dept_no`
join titles t on t.`emp_no` = e.`emp_no`
group by `emp_no`
limit 1000;
<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
name="employees_db"
url="jdbc:mysql://localhost:3306/employees"
user="user"/>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
name="posten_db"
url="jdbc:mysql://localhost:3306/kawdbprod1"
user="user"
password="password"/>
<document>
<entity name="employees"
dataSource="employees_db"
query="select e.emp_no as 'id', e.birth_date,
(
select t.title
order by t.from_date desc
limit 1
) as 'title_s', e.first_name, e.last_name, e.gender as 'gender_s', d.dept_name as 'dept_s', 'employees' as 'source_s'
from employees e
join dept_emp de on de.emp_no = e.emp_no
join departments d on d.dept_no = de.dept_no
join titles t on t.emp_no = e.emp_no
group by e.emp_no
limit 1000;" />
<entity name="posten"
dataSource="posten_db"
query="select product_id as 'id', title as 'product_s', 'posten' as 'source_s'
from kaw_produkt_valid_index limit 100;"
/>
</document>
</dataConfig>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment