1. A computer-readable storage medium having stored thereon instructions that, when executed by a computer, cause the computer to perform a process, the process comprising: storing documents and identifiers in a database, each identifier of the identifiers identifying a document; storing a document type value representing a document type associated with the document, the document type having a parent class and being part of a hierarchy of document types organized in a plurality of levels, the document type value for a particular document type being unique among the document types in a given level of the hierarchy; storing a value representing a type path for the document type that shows a path from a root document type to the document type in the hierarchy of document types, the value being generated by appending the document type value representing the document type associated with the document to a value representing a type path of a parent class of the document type; compressing the value representing the type path by separating the document type value and the value representing the type path of the parent class of the document type by a reserved separator byte, wherein the value representing the type path comprises a variable-length encoded value having a length that is uniform among document types having a same depth from the root document type, wherein the variable-length encoded value corresponds to a hierarchy level of the document type within the hierarchy of document types, wherein the document type is a user-defined type (UDT); and identifying, using the compressed value, a type of the UDT within the hierarchy of document types.