com.atlassian.jira.issue.search.util
Class LuceneConnection

java.lang.Object
  extended bycom.atlassian.jira.issue.search.util.LuceneConnection

public class LuceneConnection
extends Object

TODO renetrancy to/from reader/writer ... allow it? these operations can occur concurrently, using the same reader (writer closed beforehand): - withQuery - withReader

these operations will be serialized against all other operatons - withWriter (closes any readers closed beforehand) - withReaderAndDeletes (writers closed beforehand, reader+writer closed afterwards) - optimize (any readers closed beforehand) - flushWriter (closes readers and writers)

also see: - "What are all possible concurrent Lucene requests?" http://www.jguru.com/faq/view.jsp?EID=913302

Author:
Matt Quail

Nested Class Summary
static interface LuceneConnection.QueryAction
           
static interface LuceneConnection.ReaderAction
           
static interface LuceneConnection.WriterAction
           
 
Constructor Summary
LuceneConnection(File location, org.apache.lucene.analysis.Analyzer analyzerForIndexing)
           
 
Method Summary
 void close()
           
static void configureWriter(org.apache.lucene.index.IndexWriter writer)
          Configures a writer according to our particular requirements
 void createIndex(boolean create)
           
 void flushWriter()
           
 File getLocation()
           
 void optimize()
           
 void withQuery(LuceneConnection.QueryAction action)
           
 void withReader(LuceneConnection.ReaderAction action)
          just for queriying, do not delete with this action
 void withReaderAndDeletes(LuceneConnection.ReaderAction action)
           
 void withWriter(LuceneConnection.WriterAction action)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LuceneConnection

public LuceneConnection(File location,
                        org.apache.lucene.analysis.Analyzer analyzerForIndexing)
Method Detail

getLocation

public File getLocation()

withQuery

public void withQuery(LuceneConnection.QueryAction action)
               throws DataAccessException
Throws:
DataAccessException

withReader

public void withReader(LuceneConnection.ReaderAction action)
                throws DataAccessException
just for queriying, do not delete with this action

Throws:
DataAccessException

withReaderAndDeletes

public void withReaderAndDeletes(LuceneConnection.ReaderAction action)
                          throws DataAccessException
Throws:
DataAccessException

withWriter

public void withWriter(LuceneConnection.WriterAction action)
                throws DataAccessException
Throws:
DataAccessException

optimize

public void optimize()
              throws DataAccessException
Throws:
DataAccessException

configureWriter

public static void configureWriter(org.apache.lucene.index.IndexWriter writer)
Configures a writer according to our particular requirements


flushWriter

public void flushWriter()
                 throws DataAccessException
Throws:
DataAccessException

createIndex

public void createIndex(boolean create)
                 throws DataAccessException
Parameters:
create - true to create the index or overwrite the existing one; false to append to the existing index
Throws:
DataAccessException

close

public void close()


Copyright © 2002-2006 Atlassian. All Rights Reserved.