Method for establishing inverted index

The invention provides a method for establishing an inverted index. The inverted index comprises an extraction result list, wherein the extraction result list comprises a file number and an extraction result record corresponding to the file number; and the extraction result record comprises a type information item, content information item and a position information item. The method comprises the following steps: carrying out word segmentation operation on a file represented by a character string format; extracting one word from the word segmentation operation result; judging whether the extracted word belongs to data of a certain type; if yes, performing the next step, and otherwise finishing operation after a general inverted index list is built for the extracted word; respectively filling the content of the extracted word, the position of the word in the file and a detection method adopted for judging whether the word belongs to the data of a certain type into the content information item, position information item and type information item in the extraction result record; establishing the extraction result list; and then, establishing the general inverted index list for the extracted word.