tags:

views:

62

answers:

1

Is there a rollback in lucene?

I'm saving & updating database repository & lucene repository simultaneously so that the lucene index & database are in sync..

ex.

CustomerRepository.add(customer);
SupplierRepository.add(supplier);

CustomerLuceneRepository.add(customer); 
SupplierLuceneRepository.add(supplier); // If this here fails i cannot rollback the customer above

DataContext.SubmitChanges();
+1  A: 

I am not completely sure on how you are using Lucene or how the C# version differs from the Java version, but at least IndexWriter in Java contains methods for commit and rollback. If you could post some implementation code that would probably help.

ponzao
happy
Have you seen this blog post http://www.lybecker.com/blog/2009/12/03/lucene-net-and-transactions/? I checked the API documentation for Lucene.net 2.4.0 at http://lucene.apache.org/lucene.net/docs/2.4.0/ and IndexWriter seems to contain methods for commit and rollback.
ponzao
Hi Ponzao, you are right. Those methods exist in 2.4 version. Currently, im using 2.3. Need to get latest =).. thank you very much for pointing that out. Appreciate your help.
happy
No problem. Good thing it was just a version problem.
ponzao