Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I use Lucene to index a database?

database index lucene
0
Posted

How can I use Lucene to index a database?

0

Connect to the database using JDBC and use an SQL “SELECT” statement to query the database. Then create one Lucene Document object per row and add it to the index. You will probably want to store the ID column so you can later access the matching items. For other (text) columns it might make more sense to only index (not store) them, as the original data is still available in your database. For a more high level approach you might want to have a look at Hibernate Search, Compass, or DBSight, which all use Lucene internally.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.