What I described is really nothing more than a few methods like this:

    public void index(Indexable data)
        throws IOException
    {
        synchronized(_directory)
        {
            IndexWriter writer = getFSWriter();
            try
            {
                Document doc = createDocument(
                    data.getUnStoredFields(),
                    data.getTextFields(),
                    data.getKeywordFields());
                writer.addDocument(doc);
            }
            finally
            {
                writer.close();
            }
        }
    }

Maik's contribution sounds better, and I'll likely adopt it in my
projects.

Otis


--- Daniel Naber <[EMAIL PROTECTED]> wrote:
> On Sunday 22 May 2005 20:17, Otis Gospodnetic wrote:
> 
> > To deal with managing index-modifying access to the index I often
> use
> > code that acts as a facade to IndexReader/Writer and provides
> methods
> > such as index(....), optimize(), and delete(....).  All of these
> > methods have index-modifying code inside a "synchronized
> > (_myDirInstanceHere)" block.
> 
> That sounds quite useful. Any chance you can contribute this to
> Lucene?
> 
> Regards
>  Daniel
> 
> -- 
> http://www.danielnaber.de
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to