5. A document management apparatus including comprising: a storage unit having a document data region in which document data is stored; a first determination unit configured to determine, in a registration mode, that a management Gram corresponds to one of a first Gram of relatively low occurrence frequency less than a threshold and a second Gram of relatively high occurrence frequency not less than the threshold, the management Gram being generated by shifting a character string of a given number of characters from the document data of the storage unit and clipping the character string; a first write-in unit configured to store first post data in series in a first post region of the storage unit in association with a Gram value obtained by computing the character string of the first Gram if the management Gram is determined to be the first Gram, the first post data being configured with a set of a document identification (ID) indicating the document data including the character string of the first Gram and an intra-document offset indicating a position of the character string of the first Gram; and a second write-in unit configured to store second post data in series in a second post region of the storage unit in association with the character string of the second Gram if the management Gram is determined to be the second Gram, the second post data being configured with a set of a document identification (ID) indicating document data including the character string of the second Gram and an intra-document offset indicating a position of the character string of the second Gram; a generation unit configured to generate a retrieval Gram by shifting a character string of a given number of characters from a retrieval key word clipping the character string, the retrieval key word being used for searching the document data stored in the document data region of the storage unit in a search mode; a second determination unit configured to determine whether or not an occurrence frequency of the retrieval Gram is less than the threshold; a first scanner configured to read first post data by scanning only the first post region according to a retrieval Gram value obtained by computing the character string of the retrieval Gram if the second determination unit determines that the occurrence frequency of the retrieval Gram is less than the threshold; a second scanner configured to read first post data and second post data by scanning both of the first post region and the second post region according to the character string of the retrieval Gram if the second determination unit determines that the occurrence frequency of the retrieval Gram is not less than the threshold; and a search unit configured to search the document data region for document data matching with the retrieval key word using the first post data and the second post data, wherein the first determination unit comprises an order determination unit configured to determine the management Gram as the first Gram when Rk(g)<V 1 is satisfied, where V 1 indicates a minimum order in order of decreasing occurrence frequency of the management Gram and Rk(g) indicates an order of the management Gram in all management Grams arranged in the order of decreasing occurrence frequency.
7. The document management apparatus according to claim 5 , further including a computation unit configured to compute a hash value of the character string of the first Gram to obtain the Gram value.