org.hibernate.search.backend.impl.lucene

## Class IndexWriterDelegate

- java.lang.Object
- - org.hibernate.search.backend.impl.lucene.IndexWriterDelegate

-     public final class IndexWriterDelegate
      extends Object

  Encapsulates various operations to be performed on a single IndexWriter. Avoid using `Workspace.getIndexWriter()` directly as it bypasses lifecycle management of the IndexWriter such as reference counting, potentially leading to leaks.
  Author:
    Sanne Grinovero (C) 2015 Red Hat Inc.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IndexWriterDelegate(IndexWriter indexWriter)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDocument(Document document, ScopedAnalyzerReference analyzerReference)`
    `void` | `deleteDocuments(Query termDeleteQuery)`
    `void` | `deleteDocuments(Term idTerm)`
    `IndexWriter` | `getIndexWriter()` Deprecated.
    `void` | `updateDocument(Term idTerm, Document document, ScopedAnalyzerReference analyzerReference)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### IndexWriterDelegate

          public IndexWriterDelegate(IndexWriter indexWriter)

  - ### Method Detail

    - #### deleteDocuments

          public void deleteDocuments(Query termDeleteQuery)
                               throws IOException

      Throws:
        `IOException`

    - #### deleteDocuments

          public void deleteDocuments(Term idTerm)
                               throws IOException

      Throws:
        `IOException`

    - #### addDocument

          public void addDocument(Document document,
                                  ScopedAnalyzerReference analyzerReference)
                           throws IOException

      Throws:
        `IOException`

    - #### updateDocument

          public void updateDocument(Term idTerm,
                                     Document document,
                                     ScopedAnalyzerReference analyzerReference)
                              throws IOException

      Throws:
        `IOException`

    - #### getIndexWriter

          @Deprecated
          public IndexWriter getIndexWriter()

      Deprecated.
      This method should not be used: created only to avoid changes in public API.
      Returns:
        the `IndexWriter`

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved