Patent ID: 8412697

Claim:
A searching apparatus comprising: a memory unit which stores, for each of a plurality of n-grams (where n is a natural number) extracted from plural pieces of document data subjectable to searching, a transposed index representing appearing positions in the plural pieces of document data and an appearing frequency, wherein each n-gram is a character string including n number of characters; an n-gram extracting unit which extracts all n-grams which are extractable from a searching character string; a smallest-frequency deriving unit which refers to the appearing frequencies of the plurality of n-grams represented by the transposed indexes, and which derives an n-gram with a smallest appearing frequency among all of the n-grams extracted by the n-gram extracting unit; a searching n-gram selecting unit which: (a) divides the searching character string n-gram by n-gram from a first character of the searching character string so that one n-gram does not overlap with another n-gram, and selects the divided n-grams from among all of the n-grams extracted by the n-gram extracting unit, (b) additionally selects an n-gram including a last character of the searching character string when the selected n-grams do not form the searching character string, and (c) additionally selects the n-gram with the smallest appearing frequency when the n-gram with the smallest appearing frequency derived by the smallest-frequency deriving unit is not included in the n-grams selected through (a) and (b), and a document specifying unit which specifies, based on the plurality of searching n-grams selected by the searching n-gram selecting unit and based on the appearing positions of the searching n-grams represented by the transposed indexes, document data including the searching character string among the plural pieces of document data.