org.appng.search.indexer

## Class DocumentIndexer

- java.lang.Object
- - org.appng.api.search.BlockingQueueAccessor<P>
  - - org.appng.api.search.Consumer<DocumentEvent,DocumentProducer>
    - - org.appng.search.indexer.DocumentIndexer

- All Implemented Interfaces:
    Runnable

      public class DocumentIndexer
      extends Consumer<DocumentEvent,DocumentProducer>
      implements Runnable

  A `Consumer` of `DocumentEvent`s produced by a `DocumentProducer`. Therefore it holds a queue of `DocumentProducer`s, whose `DocumentEvent`s are being consumed with a timeout calling `BlockingQueueAccessor.get(long)`. This means if a `DocumentProducer` doesn't produce a new `Document` within the given timeout, the producer is being discarded and the next one is taken.
  Author:
    Matthias Müller

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Observable.Event` | `CLEAR_INDEX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DocumentIndexer(File indexDir, Long timeout)`
    `DocumentIndexer(int queueSize, File indexDir, Long timeout)` Creates a new `DocumentIndexer`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `run()` Starts this `DocumentIndexer`, running forever (until interrupted).

    - ### Methods inherited from class org.appng.api.search.BlockingQueueAccessor

      `get, get, getBlockingQueue, getWithTimeout, put, put, putWithTimeout`

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

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

- - ### Field Detail

    - #### CLEAR_INDEX

          public static final Observable.Event CLEAR_INDEX

  - ### Constructor Detail

    - #### DocumentIndexer

          public DocumentIndexer(int queueSize,
                                 File indexDir,
                                 Long timeout)

      Creates a new `DocumentIndexer`.
      Parameters:
        `indexDir` - the directory to read/save the Lucene index from/to
        `timeout` - the timeout in milliseconds when retrieving the next `DocumentEvent` from a `DocumentProducer`

    - #### DocumentIndexer

          public DocumentIndexer(File indexDir,
                                 Long timeout)

  - ### Method Detail

    - #### run

          public void run()

      Starts this `DocumentIndexer`, running forever (until interrupted).
      Specified by:
        `run` in interface `Runnable`

Copyright © 2011–2023 aiticon GmbH. All rights reserved.