# BitFieldType Fields

If you have documents that can be part of several different document sets, you can use `BitFieldType` fields to efficiently store information on which sets the documents belong to.

The value in a `BitFieldType` field is a hexadecimal number, which in turn represents a binary number. The binary number is a representation of the sets that a document belongs to, with each binary digit representing a particular set of documents. If a document is part of a set, the bit corresponding to that set is a `1`. If a document is not part of that set, the bit is a `0`.

For example, if a document is present in sets 0, 5, 9, 11, 12, and 13, it has the following binary representation:

    11101000100001

where the digit at the furthest right position represents set 0, the digit to the left of set `0` represents set `1` and so on. Set numbers increase from right to left.

This number is the binary representation of the decimal number 14881, and the hexadecimal number `3A21`. Therefore, the `BitField` contains the value `3A21` to indicate that the document is part of these sets:

    #DREFIELD BitField="003A21"

In this way, information on sets can be stored in a single field per document, for an arbitrarily large number of sets.

To set up BitFieldType fields

1. Open the IDOL Content component configuration file in a text editor.

2. List a Bit Field process in the `[FieldProcessing]` section. For example:

       [FieldProcessing]
       0=MyFirstProcess
       1=BitFields

3. Create a section for each process that you listed, and in each section, create a property for the process (you define the property later by setting one or more applicable configuration parameters). Identify the fields that you want to associate with the process.

   NOTE: The properties that you create must not have the same name as the processes.

   For example:

       [MyFirstProcess]
       Property=MyProperty
       PropertyFieldCSVs=*/MyField,*/MyOtherField

       [BitFields]
       Property=BitFieldSetFields
       PropertyFieldCSVs=*/WORKBOORK,*/BITFIELD

4. Create a section for the property in which you set the `BitFieldType` parameter to `True`. This enables Content to store the contents of the `PropertyFieldCSVs` fields as bit fields. For example:

       [BitFieldSetFields]
       BitFieldType=True

5. To compress the BitField index, set `BitFieldCompressed` to `True` in the property section. For example:

       [BitFieldSetFields]
       BitFieldType=True
       BitFieldCompressed=True

6. Set the `BitFieldMaxMemoryKB` parameter to the maximum memory (in KB) that can be used by `BitFieldType` fields. If this is zero (the default) there is no limit to the memory.

       [BitFieldSetFields]
       BitFieldType=True
       BitFieldMaxMemoryKB=True

7. If you want to define `BitFieldType` fields or add extra `BitFieldType` fields, but have already indexed content into Content, you can set `RegenerateBitFieldIndex` to `True` in the `[Server]` section. This allows Content to generate the files it requires to internally identify `BitFieldType` fields on startup, so that you need only to restart Content to able to use `BitFieldType` fields, rather than having to reindex all your data.

       [Server]
       (...)
       RegenerateBitFieldIndex=True

   You can also use the `DREREGENERATE` index action to regenerate the `BitFieldType` index while the server is running.

8. Save and close the configuration file.

9. Restart the IDOL Content component for your changes to take effect.

NOTE: Each document that you store in Content must contain only one instance of any particular `BitFieldType` field.

_FT_HTML5_bannerTitle.htm