The other option is to have a 'deleted' column in your table, and have the application 'delete' operation set that field. In the DIH you query this column with 'deletedPkQuery'.
Or, you can use triggers to maintain a new table with the IDs of deleted rows. This will allow you to have a batch job that deletes all IDs from this list. On Tue, Dec 29, 2009 at 10:40 AM, Mohamed Parvez <par...@gmail.com> wrote: > Ditto. There should have been an DIH command to re-sync the Index with the > DB. > Right now it looks like one way street form DB to Index. > > > On Tue, Dec 29, 2009 at 3:07 AM, Ravi Gidwani <ravi.gidw...@gmail.com>wrote: > >> Hi Shalin: >> >> > I get your point about not knowing what has been deleted from >> the database. So this is what even I am looking for: >> > >> > 0) A document (id=100) is currently part of solr index.( >> > 1) Lets say the application deleted a record with id=100 from database. >> > >> > 2) Now I need to execute some DIH command to say remove document where >> id=100. I dont expect the DIH to automatically detect what has been deleted, >> > but I am looking for a DIH command/special-command to request deletion >> from index. >> > >> > Is that possible ? also as an alternate solution, is it possible to build >> index using DIH, and use the solr.XmlUpdateRequestHandler request handler to >> delete/update these one off documents ? >> > Is this something you will recommend ? >> > >> > Thanks, >> > ~Ravi Gidwani. >> > >> > On Tue, Dec 29, 2009 at 3:03 AM, Mohamed Parvez <par...@gmail.com> >> wrote: >> > >> > > I have looked in the that thread earlier. But there is no option there >> for >> > >> > > a >> > > solution from Solr side. >> > > >> > > I mean the two more options there are >> > > 1] Use database triggers instead of DIH to manage updating the index :- >> > > This out of question as we cant run 1000 odd triggers every hour to >> delete. >> > >> > > >> > > 2] Some sort of ORM use its interception:- >> > > This is also out of question as the deletes happens form external >> system or >> > > directly on the database, not through our application. >> > > >> > > >> > >> > > To Say in Short, Solr Should have something thing to keep the index >> synced >> > > with the database. As of now its one way street, updates rows, on DB >> will >> > > go >> > > to the index. Deleted rows in the DB, will not be deleted from the >> Index >> > >> > > >> > > >> > How can Solr figure out what has been deleted? Should it go through each >> row >> > and comparing against each doc? Even then some things are not possible >> > (think indexed fields). It would be far efficient to just do a >> full-import >> > >> > each time instead. >> > >> > -- >> > Regards, >> > Shalin Shekhar Mangar. >> > >> > >> > -- Lance Norskog goks...@gmail.com