org.apache.lucene.luke.models.tools

## Interface IndexTools

- All Known Implementing Classes:
    IndexToolsImpl

      public interface IndexTools

  A dedicated interface for Luke's various index manipulations.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDocument(Document doc, Analyzer analyzer)` Add new document to this index.
    `CheckIndex.Status` | `checkIndex(PrintStream ps)` Check the current index status.
    `void` | `createNewIndex()` Create a new index.
    `void` | `createNewIndex(String dataDir)` Create a new index with sample documents.
    `void` | `deleteDocuments(Query query)` Delete documents from this index by the specified query.
    `String` | `exportTerms(String destDir, String field, String delimiter)` Export terms from given field into a new file on the destination directory
    `void` | `optimize(boolean expunge, int maxNumSegments, PrintStream ps)` Execute force merges.
    `void` | `repairIndex(CheckIndex.Status st, PrintStream ps)` Try to repair the corrupted index using previously returned index status.

- - ### Method Detail

    - #### optimize

          void optimize(boolean expunge,
                        int maxNumSegments,
                        PrintStream ps)

      Execute force merges.

      Merges are executed until there are maxNumSegments segments.
      When expunge is true, maxNumSegments parameter is ignored.

      Parameters:
        `expunge` - - if true, only segments having deleted documents are merged
        `maxNumSegments` - - max number of segments
        `ps` - - information stream
      Throws:
        `LukeException` - - if an internal error occurs when accessing index

    - #### checkIndex

          CheckIndex.Status checkIndex(PrintStream ps)

      Check the current index status.
      Parameters:
        `ps` - information stream
      Returns:
        index status
      Throws:
        `LukeException` - - if an internal error occurs when accessing index

    - #### repairIndex

          void repairIndex(CheckIndex.Status st,
                           PrintStream ps)

      Try to repair the corrupted index using previously returned index status.

      This method must be called with the return value from `checkIndex(PrintStream)`.

      Parameters:
        `st` - - index status
        `ps` - - information stream
      Throws:
        `LukeException` - - if an internal error occurs when accessing index

    - #### addDocument

          void addDocument(Document doc,
                           Analyzer analyzer)

      Add new document to this index.
      Parameters:
        `doc` - - document to be added
        `analyzer` - - analyzer for parsing to document
      Throws:
        `LukeException` - - if an internal error occurs when accessing index

    - #### deleteDocuments

          void deleteDocuments(Query query)

      Delete documents from this index by the specified query.
      Parameters:
        `query` - - query for deleting
      Throws:
        `LukeException` - - if an internal error occurs when accessing index

    - #### createNewIndex

          void createNewIndex()

      Create a new index.
      Throws:
        `LukeException` - - if an internal error occurs when accessing index

    - #### createNewIndex

          void createNewIndex(String dataDir)

      Create a new index with sample documents.
      Parameters:
        `dataDir` - - the directory path which contains sample documents (20 Newsgroups).

    - #### exportTerms

          String exportTerms(String destDir,
                             String field,
                             String delimiter)

      Export terms from given field into a new file on the destination directory
      Parameters:
        `destDir` - - destination directory
        `field` - - field name
        `delimiter` - - delimiter to separate terms and their frequency
      Returns:
        The file containing the export

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