org.hibernate.search.store
Interface Workspace

All Known Implementing Classes:
AbstractWorkspaceImpl, ExclusiveIndexWorkspaceImpl, NRTWorkspaceImpl, SharedIndexWorkspaceImpl

public interface Workspace

Author:
Sanne Grinovero (C) 2011 Red Hat Inc.

Method Summary
 void afterTransactionApplied(boolean someFailureHappened, boolean streaming)
          Invoked after all changes of a transaction are applied.
 boolean areSingleTermDeletesSafe()
          Return true if it's safe to perform index delete operations using only the identifier term.
 void flush()
          Makes sure eventually pending changes are made visible to IndexReaders.
 org.apache.lucene.analysis.Analyzer getAnalyzer(String name)
           
<T> DocumentBuilderIndexedEntity<?>
getDocumentBuilder(Class<T> entity)
           
 Set<Class<?>> getEntitiesInIndexManager()
           
 org.apache.lucene.index.IndexWriter getIndexWriter()
          Gets the IndexWriter, opening one if needed.
 void incrementModificationCounter(int modCount)
          Increment the counter of modification operations done on the index.
 void optimizerPhase()
          If optimization has not been forced give a chance to configured OptimizerStrategy to optimize the index.
 void performOptimization(org.apache.lucene.index.IndexWriter writer)
          Used by OptimizeLuceneWork to start an optimization process of the index.
 

Method Detail

getDocumentBuilder

<T> DocumentBuilderIndexedEntity<?> getDocumentBuilder(Class<T> entity)

getAnalyzer

org.apache.lucene.analysis.Analyzer getAnalyzer(String name)

optimizerPhase

void optimizerPhase()
If optimization has not been forced give a chance to configured OptimizerStrategy to optimize the index.


performOptimization

void performOptimization(org.apache.lucene.index.IndexWriter writer)
Used by OptimizeLuceneWork to start an optimization process of the index.

Parameters:
writer - the IndexWriter to use for optimization
See Also:
OptimizeLuceneWork, SearchFactory.optimize(), SearchFactory.optimize(Class)

getIndexWriter

org.apache.lucene.index.IndexWriter getIndexWriter()
Gets the IndexWriter, opening one if needed.

Returns:
a new IndexWriter or an already open one, or null if an error happened.

incrementModificationCounter

void incrementModificationCounter(int modCount)
Increment the counter of modification operations done on the index. Used (currently only) by the OptimizerStrategy.

Parameters:
modCount - the increment to add to the counter.

getEntitiesInIndexManager

Set<Class<?>> getEntitiesInIndexManager()
Returns:
The unmodifiable set of entity types being indexed in the underlying IndexManager backing this Workspace.

afterTransactionApplied

void afterTransactionApplied(boolean someFailureHappened,
                             boolean streaming)
Invoked after all changes of a transaction are applied. Must be invoked strictly once after every getIndexWriter() in a finally block as implementations might rely on counters to release the IndexWriter.

Parameters:
someFailureHappened - usually false, set to true if errors where caught while using the IndexWriter
streaming - if no immediate visibility of the change is required (hint for performance)

flush

void flush()
Makes sure eventually pending changes are made visible to IndexReaders.


areSingleTermDeletesSafe

boolean areSingleTermDeletesSafe()
Return true if it's safe to perform index delete operations using only the identifier term. This can be more efficient but can not work if there are multiple indexed types in the same index possibly sharing the same id term, or if the index might contain entity types we don't know.

Returns:
true if it's safe to do the single term operation.


Copyright © 2006-2012 Red Hat Middleware, LLC. All Rights Reserved