org.apache.lucene.facet.taxonomy

## Class SearcherTaxonomyManager

- java.lang.Object
- - org.apache.lucene.search.ReferenceManager<SearcherTaxonomyManager.SearcherAndTaxonomy>
  - - org.apache.lucene.facet.taxonomy.SearcherTaxonomyManager

- All Implemented Interfaces:
    Closeable, AutoCloseable

      public class SearcherTaxonomyManager
      extends ReferenceManager<SearcherTaxonomyManager.SearcherAndTaxonomy>

  Manages near-real-time reopen of both an IndexSearcher and a TaxonomyReader.

  NOTE: If you call `DirectoryTaxonomyWriter.replaceTaxonomy(org.apache.lucene.store.Directory)` then you must open a new `SearcherTaxonomyManager` afterwards.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `SearcherTaxonomyManager.SearcherAndTaxonomy` Holds a matched pair of `IndexSearcher` and `TaxonomyReader`

    - ### Nested classes/interfaces inherited from class org.apache.lucene.search.ReferenceManager

      `ReferenceManager.RefreshListener`

  - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.search.ReferenceManager

      `current`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SearcherTaxonomyManager(Directory indexDir, Directory taxoDir, SearcherFactory searcherFactory)` Creates search and taxonomy readers over the corresponding directories.
    `SearcherTaxonomyManager(IndexReader reader, DirectoryTaxonomyReader taxoReader, SearcherFactory searcherFactory)` Creates this from already opened `IndexReader` and `DirectoryTaxonomyReader` instances.
    `SearcherTaxonomyManager(IndexWriter writer, boolean applyAllDeletes, SearcherFactory searcherFactory, DirectoryTaxonomyWriter taxoWriter)` Expert: creates near-real-time searcher and taxonomy reader from the corresponding writers, controlling whether deletes should be applied.
    `SearcherTaxonomyManager(IndexWriter writer, SearcherFactory searcherFactory, DirectoryTaxonomyWriter taxoWriter)` Creates near-real-time searcher and taxonomy reader from the corresponding writers.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `decRef(SearcherTaxonomyManager.SearcherAndTaxonomy ref)`
    `protected int` | `getRefCount(SearcherTaxonomyManager.SearcherAndTaxonomy reference)`
    `protected SearcherTaxonomyManager.SearcherAndTaxonomy` | `refreshIfNeeded(SearcherTaxonomyManager.SearcherAndTaxonomy ref)`
    `protected boolean` | `tryIncRef(SearcherTaxonomyManager.SearcherAndTaxonomy ref)`

    - ### Methods inherited from class org.apache.lucene.search.ReferenceManager

      `acquire, addListener, afterClose, afterMaybeRefresh, close, maybeRefresh, maybeRefreshBlocking, release, removeListener`

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

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

- - ### Constructor Detail

    - #### SearcherTaxonomyManager

          public SearcherTaxonomyManager(IndexWriter writer,
                                         SearcherFactory searcherFactory,
                                         DirectoryTaxonomyWriter taxoWriter)
                                  throws IOException

      Creates near-real-time searcher and taxonomy reader from the corresponding writers.
      Throws:
        `IOException`

    - #### SearcherTaxonomyManager

          public SearcherTaxonomyManager(IndexWriter writer,
                                         boolean applyAllDeletes,
                                         SearcherFactory searcherFactory,
                                         DirectoryTaxonomyWriter taxoWriter)
                                  throws IOException

      Expert: creates near-real-time searcher and taxonomy reader from the corresponding writers, controlling whether deletes should be applied.
      Throws:
        `IOException`

    - #### SearcherTaxonomyManager

          public SearcherTaxonomyManager(Directory indexDir,
                                         Directory taxoDir,
                                         SearcherFactory searcherFactory)
                                  throws IOException

      Creates search and taxonomy readers over the corresponding directories.

      NOTE: you should only use this constructor if you commit and call `ReferenceManager.maybeRefresh()` in the same thread. Otherwise it could lead to an unsync'd `IndexSearcher` and `TaxonomyReader` pair.

      Throws:
        `IOException`

    - #### SearcherTaxonomyManager

          public SearcherTaxonomyManager(IndexReader reader,
                                         DirectoryTaxonomyReader taxoReader,
                                         SearcherFactory searcherFactory)
                                  throws IOException

      Creates this from already opened `IndexReader` and `DirectoryTaxonomyReader` instances. Note that the incoming readers will be closed when you call `ReferenceManager.close()`.
      Throws:
        `IOException`

  - ### Method Detail

    - #### decRef

          protected void decRef(SearcherTaxonomyManager.SearcherAndTaxonomy ref)
                         throws IOException

      Specified by:
        `decRef` in class `ReferenceManager<SearcherTaxonomyManager.SearcherAndTaxonomy>`
      Throws:
        `IOException`

    - #### tryIncRef

          protected boolean tryIncRef(SearcherTaxonomyManager.SearcherAndTaxonomy ref)
                               throws IOException

      Specified by:
        `tryIncRef` in class `ReferenceManager<SearcherTaxonomyManager.SearcherAndTaxonomy>`
      Throws:
        `IOException`

    - #### refreshIfNeeded

          protected SearcherTaxonomyManager.SearcherAndTaxonomy refreshIfNeeded(SearcherTaxonomyManager.SearcherAndTaxonomy ref)
                                                                         throws IOException

      Specified by:
        `refreshIfNeeded` in class `ReferenceManager<SearcherTaxonomyManager.SearcherAndTaxonomy>`
      Throws:
        `IOException`

    - #### getRefCount

          protected int getRefCount(SearcherTaxonomyManager.SearcherAndTaxonomy reference)

      Specified by:
        `getRefCount` in class `ReferenceManager<SearcherTaxonomyManager.SearcherAndTaxonomy>`

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.