Link Details

Link 108353 thumbnail
User 111696 avatar

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.
  • 13
  • 0
  • 1965
  • 543

Comments

Add your comment
User 329505 avatar

masteromd.blogspot.com replied ago:

0 votes Vote down Vote up Reply

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
,

User 331532 avatar

joshisachin79 replied ago:

0 votes Vote down Vote up Reply

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.

,

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.