lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark harwood <>
Subject Re: Maintaining index for "flattened" database tables
Date Thu, 13 Jan 2011 14:20:18 GMT
Probably off-topic for a Lucene list but the typical database options are:
1) an auto-updated "last changed" timestamp column on related tables that can be 
2) a database trigger automatically feeding a "to-be-indexed" table

Option 1 would also need a "marked as deleted" column adding to help synch 
things up whereas option 2 can automatically record create/update/delete changes 
cleanly in a separate table.

Either of these options help you to "remember to reindex" just the changed 


----- Original Message ----
From: sol myr <>
Sent: Thu, 13 January, 2011 12:10:29
Subject: Maintaining index for "flattened" database tables


Our main data storage is MySql tables.
We index it on Lucene in order to improve the search (boosting, proximate 
spelling, etc).
We naturally maintain it - for example, to insert a new "Contract" entity, we 
addContract(Contract cont){
     // INSERT into MySQL:; 
     // Index in Lucene:
     Document d=new Document();
     d.addField(new Field ("title", cont.getTitle()...)    
     d.addField(new Field ("body", cont.getBody()...)    

This works, but becomes a maintenance nightmare when the index fields are 
collected from JOINS. For example, we also want Lucene to search contracts by 
"author name", which is taken from another table AUTHOR (through Foreign Key). 
And then if the author name changes (e.g. through marriage), you must remember 
to re-index all her contracts...!

Does anyone have experience with such database/lucene combination, and knows of 
a solution that would be reasonable to maintain?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message