org.apache.lucene.index

## Class RandomPostingsTester

- java.lang.Object
- - org.apache.lucene.index.RandomPostingsTester

-     public class RandomPostingsTester
      extends Object

  Helper class extracted from BasePostingsFormatTestCase to exercise a postings format.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `RandomPostingsTester.FieldAndTerm` Holds one field, term and ord.
    `static class` | `RandomPostingsTester.Option` Which features to test.
    `static class` | `RandomPostingsTester.SeedPostings` Given the same random seed this always enumerates the same random postings

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RandomPostingsTester(Random random)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `FieldsProducer` | `buildIndex(Codec codec, Directory dir, IndexOptions maxAllowed, boolean allowPayloads, boolean alwaysTestMax)`
    `static RandomPostingsTester.SeedPostings` | `getSeedPostings(String term, long seed, IndexOptions options, boolean allowPayloads)`
    `void` | `testFields(Fields fields)`
    `void` | `testFull(Codec codec, Path path, IndexOptions options, boolean withPayloads)` Indexes all fields/terms at the specified IndexOptions, and fully tests at that IndexOptions.
    `void` | `testTerms(Fields fieldsSource, EnumSet<RandomPostingsTester.Option> options, IndexOptions maxTestOptions, IndexOptions maxIndexOptions, boolean alwaysTestMax)`

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

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

- - ### Constructor Detail

    - #### RandomPostingsTester

          public RandomPostingsTester(Random random)
                               throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### getSeedPostings

          public static RandomPostingsTester.SeedPostings getSeedPostings(String term,
                                                                          long seed,
                                                                          IndexOptions options,
                                                                          boolean allowPayloads)

    - #### buildIndex

          public FieldsProducer buildIndex(Codec codec,
                                           Directory dir,
                                           IndexOptions maxAllowed,
                                           boolean allowPayloads,
                                           boolean alwaysTestMax)
                                    throws IOException

      Throws:
        `IOException`

    - #### testTerms

          public void testTerms(Fields fieldsSource,
                                EnumSet<RandomPostingsTester.Option> options,
                                IndexOptions maxTestOptions,
                                IndexOptions maxIndexOptions,
                                boolean alwaysTestMax)
                         throws Exception

      Throws:
        `Exception`

    - #### testFields

          public void testFields(Fields fields)
                          throws Exception

      Throws:
        `Exception`

    - #### testFull

          public void testFull(Codec codec,
                               Path path,
                               IndexOptions options,
                               boolean withPayloads)
                        throws Exception

      Indexes all fields/terms at the specified IndexOptions, and fully tests at that IndexOptions.
      Throws:
        `Exception`

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