com.atlassian.confluence.plugins.edgeindex.lucene
Class DefaultLuceneIndex

java.lang.Object
  extended by com.atlassian.confluence.plugins.edgeindex.lucene.DefaultLuceneIndex
All Implemented Interfaces:
LuceneIndex, org.springframework.beans.factory.DisposableBean

public class DefaultLuceneIndex
extends Object
implements LuceneIndex, org.springframework.beans.factory.DisposableBean


Constructor Summary
DefaultLuceneIndex(org.apache.lucene.store.Directory directory)
           
DefaultLuceneIndex(org.apache.lucene.store.Directory directory, org.apache.lucene.analysis.Analyzer analyzer)
           
 
Method Summary
 void destroy()
           
 void refreshSearcher()
          Refresh the searcher.
<T> T
search(IndexSearcherCallback<T> indexSearcherCallback)
          Searches lucene index.
<T> T
write(IndexWriterCallback<T> indexWriterCallback)
          Writes to the index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLuceneIndex

public DefaultLuceneIndex(org.apache.lucene.store.Directory directory)

DefaultLuceneIndex

public DefaultLuceneIndex(org.apache.lucene.store.Directory directory,
                          org.apache.lucene.analysis.Analyzer analyzer)
Method Detail

search

public <T> T search(IndexSearcherCallback<T> indexSearcherCallback)
Description copied from interface: LuceneIndex
Searches lucene index.

Specified by:
search in interface LuceneIndex
Type Parameters:
T - the generic type of the return object
Parameters:
indexSearcherCallback - the callback
Returns:
(optional) return any results from the search operation

write

public <T> T write(IndexWriterCallback<T> indexWriterCallback)
Writes to the index. All indexWriterCallback's are executed serially with the help of a lock. This is to deliver atomicity of the updates inside the callback (we don't want index changes flushed in the callback to be committed by another thread). This also preserves the old behaviour in LuceneConnection.

Specified by:
write in interface LuceneIndex
Type Parameters:
T - the generic type of the return object
Parameters:
indexWriterCallback - the callback
Returns:
(optional) return any results of the write operation

refreshSearcher

public void refreshSearcher()
Refresh the searcher. Only one thread is permitted to do this. Some methods like DelayCloseIndexSearcher.closeWhenDone(), can only be called once (subsequent calls will lead to an IllegalStateException). Also, apart from the constructor, this is the only method permitted to reassign "searcher".

Specified by:
refreshSearcher in interface LuceneIndex

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
Exception


Copyright © 2003–2015 Atlassian. All rights reserved.