// entries for a record without having to know the vtags under which they occur
// - the sourcefield will often by optional in queries, that's why it comes last
final int schemaIdByteLength = 16; // see SchemaIdImpl
{
IndexDefinition indexDef = new IndexDefinition("links-forward");
// For the record ID we use a variable length byte array field of which the first two bytes are fixed length
// The first byte is actually the record identifier byte.
// The second byte really is the first byte of the record id. We put this in the fixed length part
// (safely because a record id should at least be a single byte long) because this prevents BCD encoding
// on the first byte, thus making it easier to configure table splitting based on the original input.
indexDef.addVariableLengthByteField("source", 2);
indexDef.addByteField("vtag", schemaIdByteLength);
indexDef.addByteField("sourcefield", schemaIdByteLength);
forwardIndex = indexManager.getIndex(indexDef);
}
{
IndexDefinition indexDef = new IndexDefinition("links-backward");
// Same remark as in the forwardIndex.
indexDef.addVariableLengthByteField("target", 2);
indexDef.addByteField("vtag", schemaIdByteLength);
indexDef.addByteField("sourcefield", schemaIdByteLength);
backwardIndex = indexManager.getIndex(indexDef);
}
}