2.5.7 Record Structure

The index directory record is a variable length structure and is stored in the Record Data field of the 2.5.6, without any padding or record alignment.

The data elements which are represented in the index directory record structure are:

  • An index key (see section 2.2.3): The structure includes separate fields for representing the data components of an index key: index key string and property identifier. The list of index directory records for each level of the index directory files is sorted in ascending order of the index key. The details of the sort criteria are defined in section 2.2.3.

  • A key position: A BitStreamPosition that points to the record which contain the same index key in the associated content index file or scope index file which contains the same index key. The key position field is stored only in the index directory records which make up the Level 1 of the index directory file.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

Flags

Key Size

KeyBytes (variable)

...

PropertyID (variable)

...

BitStreamOffset (variable)

...

BitStreamPage (variable)

...

Flags (1 byte): This field determines the size of other fields in this structure.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

L

K

Z

B

P1

P2

I1

I2

L (1 bit): Indicates whether the record contains the BitStreamOffset field and the BitStreamPage field. Its value MUST be zero if the record does not contain BitStreamOffset and BitStreamPage fields, and "1" otherwise.

K (1 bit): Indicates whether the KeyBytes field is stored in a compressed mode. Its value MUST be 0 if the index key string is stored uncompressed in the KeyBytes field, and 1 otherwise.

Z (1 bit): If set, it indicates that the representation of the KeyBytes field does not include the first byte of the index key string. The value of this byte is assumed to be 0.

B (1 bit): Selector for the size of BitStreamOffset field.

  • 0 - BitStreamOffset field is stored as a 2-byte integer.

  • 1 - BitStreamOffset field is stored as a 1-byte integer.

    P1, P2 (1 bit each): 2 bits which specify the size of the BitStreamPage field as defined in the following table.

    P1

    P2

    Size of BitStreamPage field

    0

    0

    1 byte

    0

    1

    2 bytes

    1

    0

    4 bytes

    1

    1

    Undefined. This bit combination is not valid and it MUST NOT be used.

    I1, I2 (1 bit each): 2 bits that specify the size of the PropertyID field as defined in the following table.

    I1

    I2

    Size of PropertyID field

    0

    0

    1 Byte

    0

    1

    2 Bytes

    1

    0

    4 Bytes

    1

    1

    0 Bytes.

    The PropertyID field is not present in the record.

KeySize (1 byte): A single byte unsigned integer which specifies the size of KeyBytes field. The value of this field MUST be less than or equal to 129.

KeyBytes (variable): Array of bytes that stores the content of index key string component of the index key. When possible, the representation of this field is compressed by skipping bytes with 0 values. The flags Z and K define which bytes of the index key string are skipped and assumed to be 0.

  • If both Z and K are 0, KeyBytes stores integrally the index key string.

  • If Z is 1, the first byte of the index key string is not included in KeyBytes field and it is assumed to be 0.

  • If K is 1, the second byte and then every other byte of the index key string is not included in KeyBytes field and it is assumed to be 0. This compression method is specific to the content index keys which represent a token composed of only characters which belong to Unicode range 0 to 255.

Examples

Index key string

K

Z

KeyBytes stored in Index Directory Record

0x0, 0x0, 0x61, 0x0, 0x62, 0x0, 0x63

1

1

0x61, 0x62, 0x63

0x0, 0xe, 0x02, 0x0e, 0x32, 0xe, 0x27

0

1

0xe, 0x02, 0x0e, 0x32, 0xe, 0x27

0x7E, 0xFF

0

0

0x7E, 0xFF

PropertyID (variable): An unsigned integer value specifying the property identifier of the index key. The size of this field MUST be 1, 2 or 4 bytes. The actual size is determined by the value of bits I1 and I2 of the Flags field.

If both I1 and I2 are set to 1, this field is not present, and the value for the property identifier to be used in the index key is 4096.

BitStreamOffset (variable): The size of this field can be either 1 or 2 bytes and is determined by the value of bit B of the Flags field. The field is an unsigned integer value representing the Offset part of the BitStreamPosition, which locates the index key in the associated content index file or scope index file.

BitStreamPage (variable): Unsigned integer field. The size of field can be 1, 2 or 4 bytes and is determined by the value of bits P1 and P2 of Flags field. The value of this field added on top of Page Base field stored in the current Index Directory Page Header gives the Page part of the BitStreamPosition which locates the index key in the associated content index file or scope index file.