public abstract class AbstractWorkspaceImpl extends Object implements Workspace
Modifier and Type | Field and Description |
---|---|
protected org.hibernate.search.backend.impl.lucene.IndexWriterHolder |
writerHolder |
Constructor and Description |
---|
AbstractWorkspaceImpl(DirectoryBasedIndexManager indexManager,
WorkerBuildContext context,
Properties cfg) |
Modifier and Type | Method and Description |
---|---|
void |
afterTransactionApplied(boolean someFailureHappened,
boolean streaming)
Invoked after all changes of a transaction are applied.
|
boolean |
areSingleTermDeletesSafe()
Returns true if one and only one entity type is stored in the targeted index.
|
void |
closeIndexWriter() |
void |
flush()
Makes sure eventually pending changes are made visible to IndexReaders.
|
Analyzer |
getAnalyzer(String name) |
DocumentBuilderIndexedEntity |
getDocumentBuilder(Class<?> entity) |
Set<Class<?>> |
getEntitiesInIndexManager() |
String |
getIndexName()
Returns the name of the index this workspace is being used for.
|
IndexWriter |
getIndexWriter()
Gets the IndexWriter, opening one if needed.
|
IndexWriter |
getIndexWriter(ErrorContextBuilder errorContextBuilder) |
IndexWriterDelegate |
getIndexWriterDelegate() |
IndexWriterDelegate |
getIndexWriterDelegate(ErrorContextBuilder errorContextBuilder) |
protected void |
incrementModificationCounter() |
boolean |
isDeleteByTermEnforced()
Returns true if either the configuration guarantees that one can use delete by term on all indexes
or if we ensure that entity types stored in the index return positive to
IdUniquenessResolver
and that the document id and JPA id are the same property. |
void |
optimizerPhase()
If optimization has not been forced give a chance to configured OptimizerStrategy
to optimize the index.
|
void |
performOptimization(IndexWriter writer)
Used by OptimizeLuceneWork to start an optimization process of the index.
|
void |
shutDownNow() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCommitPolicy, notifyWorkApplied
protected final org.hibernate.search.backend.impl.lucene.IndexWriterHolder writerHolder
public AbstractWorkspaceImpl(DirectoryBasedIndexManager indexManager, WorkerBuildContext context, Properties cfg)
public DocumentBuilderIndexedEntity getDocumentBuilder(Class<?> entity)
getDocumentBuilder
in interface Workspace
public Analyzer getAnalyzer(String name)
getAnalyzer
in interface Workspace
public void optimizerPhase()
Workspace
optimizerPhase
in interface Workspace
public void performOptimization(IndexWriter writer)
Workspace
performOptimization
in interface Workspace
writer
- the IndexWriter to use for optimizationOptimizeLuceneWork
,
SearchIntegrator.optimize()
,
SearchIntegrator.optimize(Class)
protected void incrementModificationCounter()
public Set<Class<?>> getEntitiesInIndexManager()
getEntitiesInIndexManager
in interface Workspace
public void afterTransactionApplied(boolean someFailureHappened, boolean streaming)
Workspace
Workspace.getIndexWriter()
in a finally block
as implementations might rely on counters to release the IndexWriter.afterTransactionApplied
in interface Workspace
someFailureHappened
- usually false, set to true if errors
where caught while using the IndexWriterstreaming
- if no immediate visibility of the change is required (hint for performance)public void shutDownNow()
public void closeIndexWriter()
public IndexWriter getIndexWriter()
Workspace
getIndexWriter
in interface Workspace
public IndexWriter getIndexWriter(ErrorContextBuilder errorContextBuilder)
public boolean areSingleTermDeletesSafe()
Workspace
isSingleClassInIndex
but that's a public contract.areSingleTermDeletesSafe
in interface Workspace
public boolean isDeleteByTermEnforced()
Workspace
IdUniquenessResolver
and that the document id and JPA id are the same property.
This allows to use delete by identifier term in a safe way and is much more efficient.
If unsure, we will delete taking the class field into account to avoid unwanted document deletions.
The method should really be named isDeleteByTermEnforcedOrSafe
but that's a public contract.isDeleteByTermEnforced
in interface Workspace
public void flush()
Workspace
public String getIndexName()
Workspace
getIndexName
in interface Workspace
public IndexWriterDelegate getIndexWriterDelegate(ErrorContextBuilder errorContextBuilder)
public IndexWriterDelegate getIndexWriterDelegate()
Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved