By bloid
via search-lucene.blogspot.com
Published: Aug 31 2008 / 23:31
I was trying to do some Index writing speed improvement and thought of creating a asynchronous Lucene index writer. This writer provides a addDocument() method which can be called asynchronously by multiple threads.
Comments
masteromd.blogspot.com replied ago:
Good Article and I just have one sugestion.
It seems that the use of the Decorator pattern fits well in this case. Can't your Asynchronous writer extend the IndexWriter? This way you could switch back to the default writer.
And an observation: the optimse operation shouldn't be asynchronous too?
Cheers
,
joshisachin79 replied ago:
Nice idea...though I preferred containment approach in this case for the following reasons:
I did not want to restrict my implementation to only current version of IndexWriter. If there is a new and better version of IndexWriter available then same implementation can be leveraged. I think same can be achieved in decorator approach as well.
Another reason I did not want to do inheritance is, providing support for all parametrized constructors of IndexWriter which is a un-necessary code calling super in each case, as I am not worried about how the Writer is initialized but just need to make it asynchronous.
Third reason, I was not sure about Multi-threaded environment behavior of all methods of IndexWriter so didn't want risk the implementation.
,
Voters For This Link (13)
Voters Against This Link (0)