org.apache.lucene.index

## Class RandomCodec

- java.lang.Object
- - org.apache.lucene.codecs.Codec
  - - org.apache.lucene.codecs.FilterCodec
    - - org.apache.lucene.codecs.asserting.AssertingCodec
      - - org.apache.lucene.index.RandomCodec

- All Implemented Interfaces:
    NamedSPILoader.NamedSPI

      public class RandomCodec
      extends AssertingCodec

  Codec that assigns per-field random postings formats.

  The same field/format assignment will happen regardless of order, a hash is computed up front that determines the mapping. This means fields can be put into things like HashSets and added to documents in different orders and the test will still be deterministic and reproducable.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `Set<String>` | `avoidCodecs`
    `Set<String>` | `dvFormatNames` unique set of docvalues format names this codec knows about
    `Set<String>` | `formatNames` unique set of format names this codec knows about

    - ### Fields inherited from class org.apache.lucene.codecs.FilterCodec

      `delegate`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RandomCodec(Random random)`
    `RandomCodec(Random random, Set<String> avoidCodecs)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `DocValuesFormat` | `getDocValuesFormatForField(String name)` Returns the docvalues format that should be used for writing new segments of `field`.
    `PostingsFormat` | `getPostingsFormatForField(String name)` Returns the postings format that should be used for writing new segments of `field`.
    `String` | `toString()`

    - ### Methods inherited from class org.apache.lucene.codecs.asserting.AssertingCodec

      `docValuesFormat, liveDocsFormat, normsFormat, postingsFormat, storedFieldsFormat, termVectorsFormat`

    - ### Methods inherited from class org.apache.lucene.codecs.FilterCodec

      `compoundFormat, fieldInfosFormat, segmentInfoFormat`

    - ### Methods inherited from class org.apache.lucene.codecs.Codec

      `availableCodecs, forName, getDefault, getName, reloadCodecs, setDefault`

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

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

- - ### Field Detail

    - #### formatNames

          public Set<String> formatNames

      unique set of format names this codec knows about

    - #### dvFormatNames

          public Set<String> dvFormatNames

      unique set of docvalues format names this codec knows about

    - #### avoidCodecs

          public final Set<String> avoidCodecs

  - ### Constructor Detail

    - #### RandomCodec

          public RandomCodec(Random random,
                     Set<String> avoidCodecs)

    - #### RandomCodec

          public RandomCodec(Random random)

  - ### Method Detail

    - #### getPostingsFormatForField

          public PostingsFormat getPostingsFormatForField(String name)

      Description copied from class: `AssertingCodec`
      Returns the postings format that should be used for writing new segments of `field`. The default implementation always returns "Asserting"
      Overrides:
        `getPostingsFormatForField` in class `AssertingCodec`

    - #### getDocValuesFormatForField

          public DocValuesFormat getDocValuesFormatForField(String name)

      Description copied from class: `AssertingCodec`
      Returns the docvalues format that should be used for writing new segments of `field`. The default implementation always returns "Asserting"
      Overrides:
        `getDocValuesFormatForField` in class `AssertingCodec`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `AssertingCodec`

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