Skip to content

Instantly share code, notes, and snippets.

@firatkarakusoglu
Forked from sebnmuller/db-data-config
Created February 11, 2016 09:22
Show Gist options
  • Select an option

  • Save firatkarakusoglu/613a7c1dc9cecb090e26 to your computer and use it in GitHub Desktop.

Select an option

Save firatkarakusoglu/613a7c1dc9cecb090e26 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>
<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 e.emp_no, 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, 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;" />
</document>
</dataConfig>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment