org.apache.lucene.index

## Class RandomCodec

- java.lang.Object
- - org.apache.lucene.codecs.Codec
  - - org.apache.lucene.codecs.lucene42.Lucene42Codec
    - - org.apache.lucene.index.RandomCodec

- All Implemented Interfaces:
    NamedSPILoader.NamedSPI

      public class RandomCodec
      extends Lucene42Codec

  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>` | `dvFormatNames` unique set of docvalues format names this codec knows about
    `Set<String>` | `formatNames` unique set of format names this codec knows about

  - ### 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)`
    `PostingsFormat` | `getPostingsFormatForField(String name)`
    `String` | `toString()`

    - ### Methods inherited from class org.apache.lucene.codecs.lucene42.Lucene42Codec

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

    - ### 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

  - ### Constructor Detail

    - #### RandomCodec

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

    - #### RandomCodec

          public RandomCodec(Random random)

  - ### Method Detail

    - #### getPostingsFormatForField

          public PostingsFormat getPostingsFormatForField(String name)

      Overrides:
        `getPostingsFormatForField` in class `Lucene42Codec`

    - #### getDocValuesFormatForField

          public DocValuesFormat getDocValuesFormatForField(String name)

      Overrides:
        `getDocValuesFormatForField` in class `Lucene42Codec`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Codec`

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