Sounds good, thanks :) --- On Thu, 1/13/11, mark harwood <markharw...@yahoo.co.uk> wrote:
From: mark harwood <markharw...@yahoo.co.uk> Subject: Re: Maintaining index for "flattened" database tables To: java-user@lucene.apache.org Date: Thursday, January 13, 2011, 6:20 AM 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 queried 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 items. Cheers Mark ----- Original Message ---- From: sol myr <solmy...@yahoo.com> To: java-user@lucene.apache.org Sent: Thu, 13 January, 2011 12:10:29 Subject: Maintaining index for "flattened" database tables Hi, 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 have: addContract(Contract cont){ // INSERT into MySQL: hibernateSession.save(cont); // Index in Lucene: Document d=new Document(); d.addField(new Field ("title", cont.getTitle()...) d.addField(new Field ("body", cont.getBody()...) indexWriter.addDocument(d); ... } 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? Thanks. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org