Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.search.backend
Class Workspace

    java.lang.Object
      org.hibernate.search.backend.Workspace

    public class Workspace

extends java.lang.Object

Lucene workspace for a DirectoryProvider.

Before using `getIndexWriter(boolean)` the lock must be acquired, and resources must be closed before releasing the lock.

Author:
  Emmanuel Bernard, Hardy Ferentschik, Sanne Grinovero

Constructor Summary
`Workspace(SearchFactoryImplementor searchFactoryImplementor, DirectoryProvider<?> provider)`

Method Summary
`void` | `closeIndexWriter()` Closes a previously opened IndexWriter.
`void` | `commitIndexWriter()` Commits changes to a previously opened IndexWriter.
`void` | `forceLockRelease()` Forces release of Directory lock.
`org.apache.lucene.analysis.Analyzer` | `getAnalyzer(java.lang.String name)`
`
`<T> DocumentBuilderIndexedEntity<T>`
` | `getDocumentBuilder(java.lang.Class<T> entity)`
`java.util.Set<java.lang.Class<?>>` | `getEntitiesInDirectory()`
`org.apache.lucene.index.IndexWriter` | `getIndexWriter(boolean batchmode)` Gets the IndexWriter, opening one if needed.
`void` | `incrementModificationCounter(int modCount)` Increment the counter of modification operations done on the index.
`void` | `optimize()` Used by OptimizeLuceneWork after index optimization to flag that optimization has been forced.
`void` | `optimizerPhase()` If optimization has not been forced give a chance to configured OptimizerStrategy to optimize the index.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Workspace

    public Workspace(SearchFactoryImplementor searchFactoryImplementor,
                     DirectoryProvider<?> provider)

Method Detail

### getDocumentBuilder

    public <T> DocumentBuilderIndexedEntity<T> getDocumentBuilder(java.lang.Class<T> entity)

### getAnalyzer

    public org.apache.lucene.analysis.Analyzer getAnalyzer(java.lang.String name)

### optimizerPhase

    public void optimizerPhase()

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

### optimize

    public void optimize()

  Used by OptimizeLuceneWork after index optimization to flag that optimization has been forced.

  See Also:
    `OptimizeLuceneWork`, `SearchFactory.optimize()`, `SearchFactory.optimize(Class)`

### getIndexWriter

    public org.apache.lucene.index.IndexWriter getIndexWriter(boolean batchmode)

  Gets the IndexWriter, opening one if needed.

  Parameters:
    `batchmode` - when true the indexWriter settings for batch mode will be applied. Ignored if IndexWriter is open already.
  Returns:
    a new IndexWriter or one already open.
  Throws:
    `SearchException` - on a IOException during index opening.

### commitIndexWriter

    public void commitIndexWriter()

  Commits changes to a previously opened IndexWriter.

  Throws:
    `SearchException` - on IOException during Lucene close operation, or if there is no IndexWriter to close.

### closeIndexWriter

    public void closeIndexWriter()

  Closes a previously opened IndexWriter.

  Throws:
    `SearchException` - on IOException during Lucene close operation

### incrementModificationCounter

    public 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.

### getEntitiesInDirectory

    public java.util.Set<java.lang.Class<?>> getEntitiesInDirectory()

  Returns:
    The unmodifiable set of entity types being indexed in the underlying Lucene Directory backing this Workspace.

### forceLockRelease

    public void forceLockRelease()

  Forces release of Directory lock. Should be used only to cleanup as error recovery.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2010 Hibernate. All Rights Reserved.