JP5346156B2 - Program, inverted index storage method and search method - Google Patents

Program, inverted index storage method and search method Download PDF

Info

Publication number
JP5346156B2
JP5346156B2 JP2007070697A JP2007070697A JP5346156B2 JP 5346156 B2 JP5346156 B2 JP 5346156B2 JP 2007070697 A JP2007070697 A JP 2007070697A JP 2007070697 A JP2007070697 A JP 2007070697A JP 5346156 B2 JP5346156 B2 JP 5346156B2
Authority
JP
Japan
Prior art keywords
byte
posting
document
identification number
index
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2007070697A
Other languages
Japanese (ja)
Other versions
JP2008140357A5 (en
JP2008140357A (en
Inventor
知弘 安田
真 岩山
修 今一
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP2007070697A priority Critical patent/JP5346156B2/en
Priority to US11/936,277 priority patent/US8321485B2/en
Publication of JP2008140357A publication Critical patent/JP2008140357A/en
Publication of JP2008140357A5 publication Critical patent/JP2008140357A5/ja
Application granted granted Critical
Publication of JP5346156B2 publication Critical patent/JP5346156B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

本発明は、大規模文書集合を対象に、高速な全文検索をするための、転置インデックスの圧縮方法、及びその転置インデックスを用いた検索方法に関する。   The present invention relates to an inverted index compression method and a search method using the inverted index for performing a high-speed full-text search for a large-scale document set.

現代社会では、膨大な量の電子文書が日々作成され、その量はますます増え続けている。オフィスでは文書作成やプレゼンテーションに、電子文書は不可欠なものとなっている。インターネットの拡大も、爆発的な数の電子文書が生み出される要因となっている。電子文書の量の増大とともに、多数の膨大な文書から、必要な情報が記された文書を、短時間で検索し出力できる文書検索技術が必須となっており、技術開発も進んでいる。   In today's society, an enormous amount of electronic documents are created every day, and the amount continues to increase. In offices, electronic documents are indispensable for document creation and presentation. The expansion of the Internet is also a factor in creating an explosive number of electronic documents. Along with the increase in the amount of electronic documents, a document retrieval technique capable of retrieving and outputting a document in which necessary information is recorded from a large number of enormous documents in a short time is indispensable, and technological development is progressing.

図1は、検索対象となる文書集合と、それに基づき構築される転置インデックスの概略図である。文書検索の典型的なスタイルは、与えられた文書集合101から、指定された単語を含む文書を、極力短時間で出力するというものである。この目的のために、転置インデックス102と呼ばれるデータ構造が使用される。ある単語103がある文書104に出現するとき、その文書の識別番号105、その文書中の当該単語の出現回数106から構成される情報をポスティング107と呼ぶ。検索対象文書の全単語について、全ポスティングのリストを格納したデータ構造が、転置インデックス102である。   FIG. 1 is a schematic diagram of a set of documents to be searched and a transposed index constructed based on the set. A typical style of document search is to output a document including a specified word from a given document set 101 in as short a time as possible. For this purpose, a data structure called the transposed index 102 is used. When a certain word 103 appears in a certain document 104, information composed of the identification number 105 of the document and the number of appearances 106 of the word in the document is referred to as posting 107. A transposed index 102 is a data structure that stores a list of all postings for all words in the search target document.

ポスティングにおいて、当該単語の出現回数は用途により省略される場合があるが、本明細書では出現回数も格納する転置インデックスを扱う。なぜなら、出現回数は、検索された文書の重要度を計算する際に必要となる場合が多いためである。一方、ポスティングは当該単語の位置情報を含む場合もあるが、本明細書の技術は、文書識別番号と出現回数から成る部分の処理に適用される。   In posting, the number of appearances of the word may be omitted depending on the application, but in this specification, an inverted index that stores the number of appearances is used. This is because the number of appearances is often required when calculating the importance of the retrieved document. On the other hand, posting may include position information of the word, but the technique of the present specification is applied to processing of a part composed of a document identification number and the number of appearances.

英語、フランス語、スペイン語のような単語がスペースで区切られている言語と異なり、日本語、韓国語や中国語では、文書を正確に単語に分割することが困難である。そこでn-gramと呼ばれる、連続するn文字からなる、文書中の任意の部分文字列を単語の代わりに用いて、転置インデックスを構築する場合があり、実用上有用であることが知られている(情報検索アルゴリズム、北研二他著、共立出版)。nは、主に1〜10の整数である。本明細書では、単語及び長さnの部分文字列を、索引語と表記する。   Unlike languages in which words such as English, French and Spanish are separated by spaces, it is difficult to accurately divide a document into words in Japanese, Korean and Chinese. Therefore, a transposed index may be constructed by using an arbitrary partial character string in a document consisting of consecutive n characters called n-gram instead of a word, and is known to be useful in practice. (Information Retrieval Algorithm, Kenji Kita et al., Kyoritsu Publishing). n is an integer of 1 to 10 mainly. In the present specification, a word and a partial character string of length n are referred to as an index word.

ポスティングを構成する文書識別番号及び出現回数は、いずれも整数値である。整数値を圧縮せず固定長のバイト列で表現する場合、数値を32ビットで表現するなら1つの整数を表現するために4バイトが必要であるが、数値を32ビットよりも小さいビット数で表現する複数の公知技術が存在する。Eliasγ符号(非特許文献1)は、小さな数値を少ないビット数で表現できる数値圧縮法であり、索引語の出現回数の圧縮に適している。Eliasγ符号は文書の識別番号を圧縮するためにも利用できるが、識別番号は出現回数ほどには小さい数値に集中しないため、Eliasδ符号(非特許文献1)が適している。Golomb符号(非特許文献2)、Rice符号(非特許文献3)は、整数値を可変長ビット列で圧縮するものの、Eliasγ、δ符号よりも高速に処理できる上に、圧縮率も高いと言われている。   Both the document identification number and the number of appearances constituting the posting are integer values. If an integer value is expressed as a fixed-length byte sequence without compression, if the numerical value is expressed in 32 bits, 4 bytes are required to express one integer, but the numerical value is expressed in a number of bits smaller than 32 bits. There are several known techniques for expressing. The Eliasγ code (Non-Patent Document 1) is a numerical compression method that can express a small numerical value with a small number of bits, and is suitable for compression of the number of appearances of an index word. Although the Elias γ code can be used to compress the document identification number, the Elias δ code (Non-Patent Document 1) is suitable because the identification number does not concentrate on a numerical value as small as the number of appearances. Golomb code (Non-patent document 2) and Rice code (Non-patent document 3) compress integer values with variable-length bit strings, but are said to be able to process faster than Elias γ and δ codes and have a high compression rate ing.

整数値を可変長のバイト列で表現する方法も知られている。Variable byte法(非特許文献3、4)では、数値を2進数表現し、7ビットずつ可変長バイト列202に格納していく。図2は、variable byte法により圧縮された整数値の例を示す図である。最上位ビット201は、それを含む1バイトがバイト列の終端か否かを判別するために用いられる。最上位ビット201が1のバイトは、バイト列202の終端以外のバイトであり、最上位ビット201が0のバイトは、バイト列202の終端である。最上位ビット201の0と1の意味は、逆であっても構わない。図2の例は、整数123456(2進数表記では0000111 1000100 1000000)をvariable byte法で圧縮した場合を示している。この場合は3バイトで表現可能なので、もとの整数123456が32ビットで記録されていれば3/4=75%の圧縮ができたことになる。図2では、上位ビットから順に符号化しているが、下位ビットからでも構わない。Variable byte法の長所は、復号処理が簡便なため高速処理が可能なことである。   A method of expressing an integer value as a variable-length byte sequence is also known. In the variable byte method (Non-Patent Documents 3 and 4), numerical values are expressed in binary numbers and stored in the variable-length byte sequence 202 in units of 7 bits. FIG. 2 is a diagram illustrating an example of integer values compressed by the variable byte method. The most significant bit 201 is used to determine whether one byte including the most significant bit 201 is the end of the byte string. The byte with the most significant bit 201 being 1 is a byte other than the end of the byte sequence 202, and the byte with the most significant bit 201 being 0 is the end of the byte sequence 202. The meanings of 0 and 1 of the most significant bit 201 may be reversed. The example of FIG. 2 shows a case where an integer 123456 (0000111 1000100 1000000 in binary notation) is compressed by the variable byte method. In this case, since it can be expressed in 3 bytes, if the original integer 123456 is recorded in 32 bits, 3/4 = 75% compression has been achieved. In FIG. 2, encoding is performed in order from the upper bit, but it may be performed from the lower bit. The advantage of the variable byte method is that the decoding process is simple and high-speed processing is possible.

バイト列のみならず、32ビット又は64ビット計算機ワードごとに複数のポスティングをまとめて符号化する技術も知られている(非特許文献5)。非特許文献5の技術を拡張し、計算機ワードの境界を跨った符号化を行なう技術も提案されている(非特許文献6)。これらの他に、全文検索用の転置インデックスをコンパクトに表現する技術としては、特許文献1、特許文献2の技術が知られている。また、非特許文献7には、単語毎に用意されたポスティングのリスト、すなわち転置リスト108(図23)を大きさの等しい複数のブロックに分割して2分探索を行なうことにより、転置リスト中で特定の文書に関するポスティングを高速に探索する技術が記載されている。   A technique for encoding a plurality of postings not only for byte strings but for each 32-bit or 64-bit computer word is also known (Non-Patent Document 5). A technique for extending the technique of Non-Patent Document 5 and performing coding across the boundaries of computer words has also been proposed (Non-Patent Document 6). In addition to these, the techniques of Patent Document 1 and Patent Document 2 are known as techniques for compactly expressing an inverted index for full-text search. Further, Non-Patent Document 7 discloses that a posting list prepared for each word, that is, a transposed list 108 (FIG. 23) is divided into a plurality of equal-sized blocks and a binary search is performed to perform a binary search. Describes a technique for quickly searching for a posting related to a specific document.

特開2001-312517号公報JP 2001-312517 特開平6-243009号公報Japanese Patent Laid-Open No. 6-24309 P. Elias, Universal codeword sets and representations of the integers, IEEE Transactions on Information Theory, IT-21(2):194-203, 1975.P. Elias, Universal codeword sets and representations of the integers, IEEE Transactions on Information Theory, IT-21 (2): 194-203, 1975. S. Golomb, Run-length encodings, IEEE Transactions on Information Theory, IT-12(3):399-401, 1966.S. Golomb, Run-length encodings, IEEE Transactions on Information Theory, IT-12 (3): 399-401, 1966. F. Scholer, H.E. Williams, J. Zobel, Compression of Inverted Indexes for Fast Query Evaluation, Proc. 25th Ann. Int’l ACM SIGIR Conf. Research and Development in Information Retrieval, pp.222-229, 2002.F. Scholer, H.E. Williams, J. Zobel, Compression of Inverted Indexes for Fast Query Evaluation, Proc. 25th Ann. Int’l ACM SIGIR Conf. Research and Development in Information Retrieval, pp. 222-229, 2002. H. Williams and J. Zobel, Compressing integers for fast file access, Computer Journal, 42(3):193-201, 1999.H. Williams and J. Zobel, Compressing integers for fast file access, Computer Journal, 42 (3): 193-201, 1999. V.N. Anh and A. Moffat, Inverted Index Compression Using Word-Aligned Binary Codes, Information Retrieval, 8(1):151-166, 2005.V.N.Anh and A. Moffat, Inverted Index Compression Using Word-Aligned Binary Codes, Information Retrieval, 8 (1): 151-166, 2005. V.N. Anh and A. Moffat, Improved Word-Aligned Binary Compression For Text Indexing, IEEE Transactions on Knowledge and data engineering, 18(6):857-861, 2006.V.N.Anh and A. Moffat, Improved Word-Aligned Binary Compression For Text Indexing, IEEE Transactions on Knowledge and data engineering, 18 (6): 857-861, 2006. I.H.Witten, A. Moffat, and T.C.Bell, Managing Gigabytes: Compressing and Indexing Documents and Images, second ed. San Francisco: Morgan Kaufmann, 1999.I.H.Witten, A. Moffat, and T.C.Bell, Managing Gigabytes: Compressing and Indexing Documents and Images, second ed.San Francisco: Morgan Kaufmann, 1999.

転置インデックスのデータ構造は、高速な文書検索を実現するために、2つの相反する要求に答えなくてはならない。まず、転置インデックスのデータ構造は、高速なアクセスを実現するために、単純なものがよい。転置インデックスを計算機メモリに配置する場合に、簡明なデータ構造とすることで転置インデックスの読取時間を短縮できる。その一方で、転置インデックスは、可能な限り圧縮しデータサイズを小さく抑えることが望ましい。大規模な文書集合を扱うときは、転置インデックスがハードディスクを始めとする補助記憶装置上に配置されることが多いが、データサイズを小さくすればオンメモリ処理が可能となり、検索速度を大きく向上させることができる。転置インデックス全体をメモリに載せることが不可能でも、頻繁にアクセスされる部分をオンメモリ化するだけで大幅な高速化が期待される。また、補助記憶装置上で転置インデックスが占有する領域を抑制できれば、文書検索システムを小規模なストレージで稼動させることができる。   The data structure of the inverted index must answer two conflicting requirements in order to achieve fast document retrieval. First, the data structure of the inverted index should be simple in order to realize high-speed access. When the inverted index is arranged in the computer memory, the reading time of the inverted index can be shortened by using a simple data structure. On the other hand, it is desirable to compress the inverted index as much as possible to keep the data size as small as possible. When dealing with a large collection of documents, the inverted index is often placed on an auxiliary storage device such as a hard disk. However, if the data size is reduced, on-memory processing becomes possible and the search speed is greatly improved. be able to. Even if it is impossible to put the entire inverted index in the memory, a significant increase in speed can be expected simply by making the frequently accessed part on-memory. Further, if the area occupied by the inverted index on the auxiliary storage device can be suppressed, the document search system can be operated with a small storage.

転置インデックスの圧縮方法の性能は、その大部分を占めるポスティングの圧縮方法に大きく依存する。前述したように、ポスティングは文書の識別番号と索引語の出現回数から成る。これらの数値データを、検索の高速性及びデータサイズの観点から、適切な方法で圧縮する必要がある。また、検索対象により、文書集合の文書が頻繁に追加・更新されることがある。これに対応するために、文書識別番号の分布について、事前情報無しに使用できる圧縮方法が望ましい。   The performance of the inverted index compression method depends greatly on the posting compression method that occupies the majority. As described above, the posting consists of the document identification number and the number of occurrences of the index word. It is necessary to compress these numerical data by an appropriate method from the viewpoint of search speed and data size. Also, documents in a document set may be frequently added / updated depending on the search target. In order to cope with this, a compression method that can be used without prior information on the distribution of document identification numbers is desirable.

更に、ブーリアン検索やフレーズ検索といった高度な検索を2分探索(アルゴリズムとデータ構造、平田富夫、森北出版)により高速化できるよう、転置リスト108の途中から、ポスティングを読み取ることができるデータ構造とすることが望ましく、そのために付加しなければならないデータの量を抑制する必要がある。   Furthermore, in order to speed up advanced searches such as Boolean search and phrase search by binary search (algorithm and data structure, Tomio Hirata, Morikita Publishing), a data structure that can read postings from the middle of the transposed list 108 is adopted. It is desirable to reduce the amount of data that must be added for this purpose.

Eliasγ、δ符号による圧縮方法は、整数値を可変長ビット列で表現するため、圧縮率は高いが復号化に時間が掛かる。Golomb符号、Rice符号は、文書識別番号の分布に依存するパラメータが事前に適切に与えられなければ、その性能を発揮することはできない。   In the compression method using Elias γ and δ codes, since the integer value is expressed by a variable length bit string, the compression rate is high, but decoding takes time. The Golomb code and the Rice code cannot exhibit their performance unless parameters that depend on the distribution of document identification numbers are appropriately given in advance.

variable byte法は、小さい値であっても最低1バイトが必要な短所があり、可変長ビット列で整数を表現する方法に比べ、索引語の出現回数の圧縮には不向きである。   The variable byte method has a disadvantage that even a small value requires at least 1 byte, and is not suitable for compression of the number of occurrences of an index word compared to a method of expressing an integer with a variable-length bit string.

非特許文献5の技術は、圧縮対象とする文書識別番号の分布が前もってわからなければ、最適な符号化ができない。また、この技術は、各文書における単語の出現回数の圧縮を考慮していない。非特許文献6の技術でも、非特許文献5の技術の上記の問題は解決されていない。特許文献1は文書識別番号のみの圧縮をしており、索引語出現頻度は考慮されていない。また、特許文献2は文書の識別番号と文書中の単語出現位置の圧縮に関する技術であり、文書の識別番号と出現回数から成るポスティングを圧縮する技術ではない。また、非特許文献7に記載の方法は、ポスティングを複数のブロックに分割する際に未使用領域ができ、記憶領域を浪費してしまうほか、ブロックの大きさより狭い範囲の2分探索ができないという問題がある。   The technique of Non-Patent Document 5 cannot perform optimal encoding unless the distribution of document identification numbers to be compressed is known in advance. Further, this technique does not consider compression of the number of appearances of words in each document. Even with the technique of Non-Patent Document 6, the above-described problem of the technique of Non-Patent Document 5 is not solved. In Patent Document 1, only the document identification number is compressed, and the index word appearance frequency is not considered. Patent Document 2 is a technique related to compression of a document identification number and a word appearance position in the document, and is not a technique for compressing posting composed of a document identification number and the number of appearances. In addition, the method described in Non-Patent Document 7 creates an unused area when dividing posting into a plurality of blocks, wastes a storage area, and cannot perform a binary search in a narrower range than the block size. There's a problem.

本発明の目的は、高速な文書検索のために、高速に復号可能な符号化により、可変長ビットを用いた数値圧縮法に比肩しうるポスティングの圧縮率を実現することにある。また本発明は、転置リストを途中から読んでもポスティングの境界がわかるようにする手段も提供する。   An object of the present invention is to realize a posting compression rate comparable to a numerical compression method using variable-length bits by encoding that can be decoded at high speed for high-speed document retrieval. The present invention also provides a means for making it possible to recognize the boundaries of posting even if the transposed list is read from the middle.

本発明は、variable byte法を拡張し、ポスティングをバイト列で表現しつつ、索引語の出現回数を少ないビット数で格納する。Variable byte法で単純に出現回数を圧縮すれば、最低でも1バイトが必要である。しかし、特定の索引語の1文書中での出現回数は多くの場合3以下であり、2ビットあれば表現できる。そこで、本発明では文書識別番号を表現するバイト列の中に、図3に示すように、出現回数を表現するための長さwビットのビットフィールド301(以下、出現回数フィールド)を設ける。ここに、wはパラメータである。wは、1バイトの中に収めるために高々8とすることが好ましく、圧縮効率を上げるために極力小さな値とするべきである。3以下の出現回数を表現できるようw=2とすることが好ましいが、出現回数1の場合が多ければ、w=1としてもよい。これにより、出現回数が2のw乗から1を減じた値までの場合、文書識別番号を表現するバイト列に埋め込んで符号化できる。2のw乗から1を減じた値より大きな出現回数を表現するときは、前記長さwビットのビットフィールドに特殊な値を書き込み、出現回数のvariable byte表現を後置する。   The present invention extends the variable byte method to store the number of occurrences of an index word with a small number of bits while expressing posting as a byte string. If the number of appearances is simply compressed using the variable byte method, at least 1 byte is required. However, the number of appearances of a specific index word in one document is often 3 or less, and can be expressed with 2 bits. Therefore, in the present invention, as shown in FIG. 3, a bit field 301 having a length of w bits (hereinafter referred to as an appearance count field) is provided in the byte string expressing the document identification number, as shown in FIG. Here, w is a parameter. w is preferably at most 8 so as to fit in one byte, and should be as small as possible in order to increase the compression efficiency. It is preferable to set w = 2 so that the number of appearances of 3 or less can be expressed. However, if there are many cases of the number of appearances 1, w = 1 may be used. As a result, when the number of appearances is from a power of 2 to a value obtained by subtracting 1 from the 2nd power, it can be encoded by being embedded in a byte string representing a document identification number. When expressing the appearance count larger than the value obtained by subtracting 1 from 2 to the power of w, a special value is written in the bit field of length w bits, and the variable byte expression of the appearance count is postfixed.

ポスティングには、文書識別番号や索引語出現回数以外の属性情報を記録する必要が生じる場合がある。想定される例として、検索対象文書から特定の文書が外れたときに、転置インデックス内の当該文書に対応するポスティングが無効になったことを示すフラグがある。そこで本発明では、図4に示すように、文書識別番号を表現するバイト列の中に、出現回数を表現するためのビットフィールド301に加え、さらに長さxビットのビットフィールド401(以下、属性フィールド)を確保し、ポスティングの属性情報を書き込めるようにする。ここに、xはパラメータである。   In posting, it may be necessary to record attribute information other than the document identification number and the index word appearance count. As an assumed example, there is a flag indicating that posting corresponding to the document in the inverted index has become invalid when a specific document is removed from the search target document. Therefore, in the present invention, as shown in FIG. 4, in addition to a bit field 301 for expressing the number of appearances in a byte string expressing a document identification number, a bit field 401 (hereinafter referred to as attribute) having a length of x bits. Field) and posting attribute information can be written. Here, x is a parameter.

出現回数フィールド及び属性フィールドは、1バイトで表現できるよう1≦x+w≦8を満たすことが好ましい。x+w≧8の場合には、図13に示すように、文書識別番号及び出現回数・属性フィールドの一部のビットを格納する可変長バイト列の後に、出現回数・属性フィールドの残りの部分を格納した固定長バイト列を加えてポスティングを表現することが好ましい。この場合も、可変長バイト列部分の終端を、最上位ビット201を用いて表現すればよい。   The appearance frequency field and the attribute field preferably satisfy 1 ≦ x + w ≦ 8 so that they can be expressed by 1 byte. In the case of x + w ≧ 8, as shown in FIG. 13, the remaining part of the appearance count / attribute field is stored after the variable-length byte string for storing the document identification number and some bits of the appearance count / attribute field. It is preferable to express the posting by adding the fixed-length byte sequence. In this case as well, the end of the variable-length byte string portion may be expressed using the most significant bit 201.

なお、出現回数及び属性情報用のビットフィールドを設けることにより、文書識別番号を表現するためのビットが不足し、x+w<8でも、追加の1バイトが必要になる場合がある。その場合でも、出現回数及び属性情報を表現するための専用の1バイトを追加する場合に比べれば、データサイズは増加しない。   By providing a bit field for the number of appearances and attribute information, there are insufficient bits for expressing the document identification number, and an additional 1 byte may be required even if x + w <8. Even in such a case, the data size does not increase as compared with the case of adding a dedicated byte for expressing the number of appearances and attribute information.

また、転置インデックスを先頭から読まなくても、途中から読んでポスティングの境界がわかるようにすることもできる。例えば図16に示すように、出現回数を表すバイト列1603において、各バイトの最上位ビット1601を1に固定して文書識別番号を表すバイト列と混同されることを防ぎつつ、その次のビット1602を用いて出現回数を表すバイト列の最後の1バイトかどうかを表現すればよい。   Even if the transposed index is not read from the beginning, it can be read from the middle so that the boundary of posting can be understood. For example, as shown in FIG. 16, in the byte string 1603 representing the number of appearances, the most significant bit 1601 of each byte is fixed to 1, and the next bit is prevented from being confused with the byte string representing the document identification number. 1602 may be used to represent whether or not it is the last byte of the byte string representing the number of appearances.

本発明により、特徴語の特定文書中の出現回数を、多くの場合に1バイト未満の少ないビット数で表現しつつも、バイト単位の符号により高速アクセスが可能な転置インデックスのデータ構造が提供される。また、転置インデックスを先頭から読まずに、途中から読んでもポスティングの境界がわかる手段を提供し、2分探索を可能とする。これにより、各索引語の転置リストにおいて特定の文書に対応するポスティングを探索する際、該文書に対応するポスティングが存在すれば該ポスティングに短時間で到達でき、該文書に対応するポスティングが存在しなければ存在しないことを短時間で判別できる。   According to the present invention, there is provided a data structure of a transposed index that can be accessed at high speed by a code in byte units while expressing the number of appearances of a feature word in a specific document in many cases with a small number of bits of less than 1 byte. The In addition, a means for understanding the posting boundary even if the transposed index is read from the middle without being read from the head is provided, and a binary search is made possible. As a result, when searching for a posting corresponding to a specific document in the transposed list of each index word, if the posting corresponding to the document exists, the posting can be reached in a short time, and there is a posting corresponding to the document. Otherwise, it can be determined in a short time that it does not exist.

本発明の方法による、ポスティングの圧縮形態の一例を説明する。
[実施例1]
図4に示すように、variable byte法における文書識別番号の表現において、最後の1バイトの下位wビット301を出現回数の記録に使用し、その左側(上位側)のxビット401を属性情報の記録に使用する。この図は、w=2,x=1の場合の例であるが、本発明ではw,xの値は2,1に限定されない。出現回数が2のw乗から1を減じた値以下の場合には、wビットの出現回数フィールドが、そのまま出現回数の2進数表現となる。それ以上の出現回数を記録する場合は、図5に示すように、出現回数フィールド301の全てのビットに0を書き込んでwビットでは表現できない出現回数であることを表現した上で、variable byte法で表現した出現回数を表すバイト列501を後置する。図5は、文書識別番号1234(2進数で100110 10010)、出現回数4321(2進数で0100001 1100001)のポスティングを符号化した例を示す。
An example of a compression format for posting according to the method of the present invention will be described.
[Example 1]
As shown in FIG. 4, in the expression of the document identification number in the variable byte method, the lower w bit 301 of the last 1 byte is used for recording the number of appearances, and the x bit 401 on the left side (upper side) is used as attribute information. Used for recording. This figure is an example in the case of w = 2 and x = 1, but in the present invention, the values of w and x are not limited to 2,1. When the number of appearances is equal to or less than the value obtained by subtracting 1 from the power of 2 to 2, the appearance number field of w bits is directly expressed as a binary number of the number of appearances. When recording the number of appearances more than that, as shown in FIG. 5, after writing 0 in all the bits of the appearance number field 301 and expressing that the number of appearances cannot be represented by w bits, the variable byte method is used. A byte string 501 representing the number of appearances represented by is appended. FIG. 5 shows an example in which posting of document identification number 1234 (binary number 100110 10010) and appearance number 4321 (binary number 0100001 1100001) is encoded.

次に、本発明の方法によって圧縮された転置インデックスを作成する装置の一形態を説明する。装置全体の概観を図6に示す。中央演算装置(CPU)601に、主記憶602が接続されている。必要に応じ、補助記憶603、CD−ROM・DVD等のリムーバブルメディア604、ネットワーク605、ユーザ端末606が接続される。本実施形態の装置は、CPU 601により実行される主記憶602上のプログラムとして索引語切り出し手段S701、索引語出現回数取得手段S702、文書識別番号割り当て手段S703、ポスティング圧縮手段S704を備える。   Next, an embodiment of an apparatus for creating an inverted index compressed by the method of the present invention will be described. An overview of the entire apparatus is shown in FIG. A main memory 602 is connected to a central processing unit (CPU) 601. An auxiliary storage 603, a removable medium 604 such as a CD-ROM / DVD, a network 605, and a user terminal 606 are connected as necessary. The apparatus according to the present embodiment includes index word extraction means S701, index word appearance number acquisition means S702, document identification number assignment means S703, and posting compression means S704 as programs on the main memory 602 executed by the CPU 601.

本装置におけるデータ及び処理の流れを、図7に示す。まず、入力として検索対象文書104を、CPU 601が必要に応じ主記憶602、補助記憶603、リムーバブルメディア604、ネットワーク605に配置された検索対象文書集合101から取得する。各々の検索対象文書104に、2通りの処理が行なわれる。まず、索引語切り出し手段S701により、文書中の索引語が切り出される。前述のように、切り出し手段として、公知の形態素解析方法又はn-gramが使用できる(情報検索アルゴリズム、北研二他著、共立出版)。さらに、それぞれの索引語が、検索対象となる文書104において出現する回数が、出現回数取得手段S702により取得される。出現回数を取得するためには、単純に索引語ごとに整数変数をひとつ用意して0に初期化した後、文書中に当該索引語の出現が検出される度に1ずつ増加させればよい。さらに文書識別番号割り当て手段S703により、検索対象文書毎に文書識別番号を割り当てる。この手段の好ましい実施形態の1つは、1に初期化された整数変数を1つ保持し、新しい文書識別番号が必要な際にこの変数の値を割り当て、その直後に前記変数の値を1増やすことである。S701、S702、S703により、各々の索引語について、文書識別番号105及び索引語出現回数106からなるポスティング107が得られる。このポスティングを、ポスティング圧縮手段S704を用いて圧縮し、得られたバイト列402を、必要に応じ主記憶602、補助記憶603、リムーバブルメディア604、ネットワーク605に配置される圧縮転置インデックス607へ出力する。   FIG. 7 shows the flow of data and processing in this apparatus. First, the search target document 104 is acquired as an input from the search target document set 101 arranged in the main memory 602, the auxiliary storage 603, the removable medium 604, and the network 605 as necessary. Two types of processing are performed on each search target document 104. First, an index word in the document is cut out by the index word cut-out means S701. As described above, a known morpheme analysis method or n-gram can be used as the extraction means (information search algorithm, Kitakenji et al., Kyoritsu Shuppan). Further, the number of appearances of each index word in the document 104 to be searched is acquired by the appearance number acquisition unit S702. In order to obtain the number of appearances, one integer variable is simply prepared for each index word, initialized to 0, and then incremented by 1 each time the occurrence of the index word is detected in the document. . Further, the document identification number assigning unit S703 assigns a document identification number to each search target document. One preferred embodiment of this means keeps one integer variable initialized to 1, assigning the value of this variable when a new document identification number is needed, and immediately following that variable's value of 1 It is to increase. Through S701, S702, and S703, a posting 107 including the document identification number 105 and the index word appearance count 106 is obtained for each index word. This posting is compressed using the posting compression means S704, and the obtained byte sequence 402 is output to the main storage 602, the auxiliary storage 603, the removable medium 604, and the compression transposition index 607 arranged in the network 605 as necessary. .

ポスティング圧縮手段S704が実行する処理のフローを、図8に示す。入力として、ポスティングの文書識別番号d 105と、索引語出現回数f 106が与えられ、パラメータである整数x,wも与えられる。まず、ポスティング圧縮手段S704は、出力するバイト列402の出現回数フィールド301に格納する値f’を決定する。ステップS801において、fがwビットで表現できるか判定し、表現できればf’=f、表現できなければf’=0とする。次に、ステップS802において、dとf’を合成した整数d’を構築する。この整数d’は、下位wビットがf’に等しく、下位x+wビットを除いた値がdに等しい。ステップS803において、この整数d’のvariable byte表現を出力する。variable byte表現の出力方法は、後述する。fがwビットで表現可能か否かを、ステップS804でf’=0か否かにより判定する。f’≠0ならば表現可能で、圧縮処理は終了である。f’=0ならばfはwビットで表現できないことを意味し、fの値をステップS805においてvariable byte表現で出力する。   FIG. 8 shows a flow of processing executed by the posting compression unit S704. As input, a document identification number d 105 of posting and an index word appearance frequency f 106 are given, and integers x and w as parameters are also given. First, the posting compression unit S704 determines a value f ′ to be stored in the appearance number field 301 of the byte string 402 to be output. In step S801, it is determined whether f can be expressed by w bits. If it can be expressed, f '= f, and if it cannot be expressed, f' = 0. Next, in step S802, an integer d 'obtained by combining d and f' is constructed. This integer d 'has the lower w bits equal to f' and the value excluding the lower x + w bits is equal to d. In step S803, the variable byte representation of this integer d 'is output. The output method of variable byte expression will be described later. Whether or not f can be expressed by w bits is determined by whether or not f ′ = 0 in step S804. If f ′ ≠ 0, it can be expressed and the compression process is completed. If f '= 0, it means that f cannot be expressed in w bits, and the value of f is output in variable byte expression in step S805.

図9を用いて、整数Aのvariable byte表現の出力方法の一形態を説明する。まず、ステップS901-S903において、変数Lを、2の7×n乗がAより大きい最小の自然数nにセットする。次に、S904-S905のループで、Aの下位7ビット以外のAの値を、7ビットずつ上位ビットから出力する。このとき、Aを右へL×7ビットシフトした後、127と論理積をとることにより下位7ビット以外のビットを0とし、128を加えることで下位から8ビット目を1とする。最後に、Aの下位7ビットをステップS906で出力する。ステップS906では、127と論理積を取ることで、下位7ビット以外のビットを0とする。   With reference to FIG. 9, one form of an output method of the variable byte representation of the integer A will be described. First, in steps S901 to S903, the variable L is set to the smallest natural number n in which 2 to the power of 7 × n is larger than A. Next, in the loop of S904 to S905, the value of A other than the lower 7 bits of A is output from the upper bits 7 bits at a time. At this time, after A is shifted L × 7 bits to the right, a logical product with 127 is used to set bits other than the lower 7 bits to 0, and 128 is added to set the 8th bit from the lower order to 1. Finally, the lower 7 bits of A are output in step S906. In step S906, bits other than the lower 7 bits are set to 0 by performing a logical product with 127.

なお、本装置に検索対象文書ではなくポスティングが直接与えられる場合には、ステップS701からS703を省略して、ポスティング圧縮手段S704だけを実行すれば圧縮された転置インデックスを構築できる。   If posting is directly given to the apparatus instead of the search target document, the compressed transposed index can be constructed by omitting steps S701 to S703 and executing only the posting compression unit S704.

本発明の方法で、図1の転置インデックス102を圧縮した形態の1つを、図14に示す。この図は、x=0,w=2の場合の例である。索引語103ごとにその索引語が出現する文書の識別番号と当該文書中の出現回数が複数記録されている。この例では、文書数が高々4であるため、文書識別番号は全て、最終バイト中の文書識別番号に割り当てられたビット領域203内で表現されている。出現回数も高々2でw=2ビットで表現可能なため、全てのポスティングが1バイトで表現可能である。このため、バイト列の終端か否かを表す最上位ビット201は、全て0となっている。なお、転置インデックスには、各索引語に対するポスティングの列の終端を表す情報が必要である。図14では、存在しない文書の文書識別番号0を表現するバイト1401をリストの終端の印として用いている。このような1バイトをリストの終端に置く代わりに、各索引語のポスティングの数あるいはポスティングの総バイト数を記録し、ポスティングの終端を認識させてもよい。   One form in which the transposed index 102 of FIG. 1 is compressed by the method of the present invention is shown in FIG. This figure is an example when x = 0 and w = 2. For each index word 103, a plurality of identification numbers of documents in which the index word appears and the number of appearances in the document are recorded. In this example, since the number of documents is at most 4, all document identification numbers are expressed in the bit area 203 assigned to the document identification number in the last byte. Since the number of appearances is at most 2 and can be expressed by w = 2 bits, all postings can be expressed by 1 byte. For this reason, all the most significant bits 201 indicating whether or not the end of the byte string is 0. Note that the transposed index requires information indicating the end of the posting column for each index word. In FIG. 14, a byte 1401 representing the document identification number 0 of a nonexistent document is used as a mark at the end of the list. Instead of placing one byte at the end of the list, the number of postings of each index word or the total number of posting bytes may be recorded to recognize the end of posting.

当業者には、本発明のポスティング圧縮方法に様々なバリエーションがあることが明らかであろう。図4の例では、文書識別番号の最上位ビットが先頭のバイトで最下位ビットが最終バイトに格納されているが、バイトの並び順を変更し、例えば図10に示すように逆順としてもよい。最上位ビットによりバイト列の終端か否かを表現していたが、最下位ビットを用いてもよい(図11)。出現回数フィールドと属性フィールドを最終バイトの下位ビットとしたが、上位ビットに配置してもよい(図12)。また、出現回数フィールドと属性フィールドを先頭・末尾以外のバイトに格納してもよい。整数のvariable byte表現において、最下位から7ビット以外が出力される場合には、前記整数を右に7ビットシフトして得られる整数は常に1以上である。このように1以上の値を扱うとわかっている場合には、出力する前に1を減じ、復号する際に1を加えて、前記整数を表現するビット数の削減を試みても良い(F. Scholer, H.E. Williams, J. Zobel, Compression of Inverted Indexes for Fast Query Evaluation, Proc. 25th Ann. Int’l ACM SIGIR Conf. Research and Development in Information Retrieval, pp.222-229, 2002.)。上記のバリエーションを、組み合わせて使用してもよい。さらに、文書識別番号を昇順にソートし差分を取ることにより、圧縮率の向上を図っても良い(I.H.Witten, A. Moffat, and T.C.Bell, Managing Gigabytes: Compressing and Indexing Documents and Images, second ed. San Francisco: Morgan Kaufmann, 1999)。 It will be apparent to those skilled in the art that there are various variations of the posting compression method of the present invention. In the example of FIG. 4, the most significant bit of the document identification number is the first byte and the least significant bit is stored in the last byte. However, the order of the bytes may be changed, for example, as shown in FIG. . Although the most significant bit represents the end of the byte string, the least significant bit may be used (FIG. 11). Although the appearance number field and the attribute field are the lower bits of the last byte, they may be arranged in the upper bits (FIG. 12). Further, the appearance number field and the attribute field may be stored in bytes other than the head and tail. In the variable byte representation of an integer, when other than 7 bits from the least significant bit are output, the integer obtained by shifting the integer to the right by 7 bits is always 1 or more. In this way, when it is known that a value of 1 or more is handled, 1 may be subtracted before output, and 1 may be added at the time of decoding to try to reduce the number of bits representing the integer (F Scholer, HE Williams, J. Zobel, Compression of Inverted Indexes for Fast Query Evaluation, Proc. 25 th Ann. Int'l ACM SIGIR Conf. Research and Development in Information Retrieval, pp. 222-229, 2002.). The above variations may be used in combination. Furthermore, the compression rate may be improved by sorting the document identification numbers in ascending order and taking the difference (IHWitten, A. Moffat, and TCBell, Managing Gigabytes: Compressing and Indexing Documents and Images, second ed. San Francisco : Morgan Kaufmann, 1999).

本発明の方法で圧縮した転置インデックスの大きさ及び転置インデックスの読込速度を他の方式と実験により比較した。実験の対象としたのは、以下の各方式である。
(A) 本発明の方法。
(B) 文書識別番号、出現回数ともに圧縮なし。
(C) 文書識別番号、出現回数ともにvariable byte法。
(D) 文書識別番号、出現回数ともにEliasγ符号。
(E) 文書識別番号はEliasδ符号、出現回数はEliasγ符号。
The size of the inverted index compressed by the method of the present invention and the reading speed of the inverted index were compared by experiment with other methods. The following methods were used for the experiment.
(A) The method of the present invention.
(B) No compression for document identification number and number of appearances.
(C) The document identification number and the number of appearances are both variable byte methods.
(D) Both the document identification number and the number of appearances are Eliasγ codes.
(E) The document identification number is an Elias δ code, and the number of appearances is an Elias γ code.

実験に用いたデータは、日経新聞3年分の文書で、索引語は形態素解析で得られた単語とした。メインメモリ1GB、CPUがPentiumIV 1.7GHzのLinuxをOSとする計算機を使用した。処理の実装には、C++言語を使用した。転置インデックス全体の圧縮には、各索引語のポスティングのリストの終端を表現する手段が必要である。本発明の方法及び圧縮なしの場合には、文書識別番号が0の場合をポスティングの終端とした。その他の方式では、出現回数が4の場合に終端とし、4以上の出現回数nはn+1で表現することとした。実験では、文書識別番号を昇順にソートし差分を取った上で、各種圧縮法で実際に全てのポスティングを圧縮し、圧縮後のポスティング全体の大きさを計測した。さらに、全ポスティングを読み取る時間を測定し、読取速度を計算した。時間測定では、10回測定を行ない、平均値を使用した。実験結果を表1に示す。   The data used in the experiment was a document for 3 years of Nikkei Shimbun, and the index word was a word obtained by morphological analysis. A computer with 1GB main memory and Pentium IV 1.7GHz Linux OS was used. C ++ language was used to implement the process. In order to compress the entire inverted index, a means for expressing the end of the posting list of each index word is required. In the case of the method of the present invention and no compression, the case where the document identification number is 0 is set as the end of posting. In other methods, the termination is when the number of appearances is 4, and the number of appearances n of 4 or more is expressed as n + 1. In the experiment, the document identification numbers were sorted in ascending order, the differences were taken, and all postings were actually compressed using various compression methods, and the size of the entire posting after compression was measured. In addition, the time to read all postings was measured and the reading speed was calculated. In the time measurement, the measurement was performed 10 times and the average value was used. The experimental results are shown in Table 1.

Figure 0005346156
Figure 0005346156

圧縮しない場合(B)にほぼ400MBにも達する転置インデックスの大きさは、(B)以外のどの方式でも圧縮前の1/3以下となった。文書識別番号の圧縮にEliasδ符号を使用したとき(E)に最大の圧縮率が得られ、Eliasγ符号の場合(D)がこれに続いた。Eliasδ符号は、Eliasγ符号に比べ大きな整数の圧縮に適しており、これが圧縮率向上つながっている。一方、圧縮されたポスティングの展開速度については、Eliasδ符号、Eliasγ符号では、圧縮率の高さと引き換えに復号処理の速度が遅くなっているが、variable byte法(C)は大幅に速いという結果が得られた。   When not compressed (B), the size of the inverted index reaching almost 400MB was less than 1/3 of that before compression in any method other than (B). When the Elias δ code was used to compress the document identification number (E), the maximum compression rate was obtained, followed by the Elias γ code (D). The Elias δ code is suitable for compression of a larger integer than the Elias γ code, which leads to an improvement in the compression rate. On the other hand, with regard to the decompression speed of compressed posting, Elias δ code and Elias γ code are slow in decoding processing in exchange for high compression ratio, but variable byte method (C) is significantly faster. Obtained.

これらの方式と比較した場合、本発明の方法(A)の第一の特徴は、圧縮されたポスティングの復号速度にある。今回の実験では、他の全ての圧縮方法を上回る処理速度が得られた。第二の特徴は、圧縮率の高さである。最も圧縮率が高かった(E)の方法に比べ、インデックスサイズの増加は84.70/68.55=1.23倍に止まり、(C)の方法のサイズに対して84.70/114.16=74.2%にまで圧縮できた。   When compared with these methods, the first feature of the method (A) of the present invention is the decoding speed of compressed posting. In this experiment, the processing speed exceeded all other compression methods. The second feature is a high compression rate. Compared with the method (E), which had the highest compression rate, the increase in index size was only 84.70 / 68.55 = 1.23 times, and the size of the method (C) was reduced to 84.70 / 114.16 = 74.2%.

各方式の、圧縮後の転置インデックスの大きさと、圧縮転置インデックス全体を読み取るために要した時間の、2次元プロットを図15に示す。この図において原点に近いほど、圧縮率及び復号速度が優れていることを表す。圧縮率では「*」で表される(E)の方法、処理速度では「■」で表される(B)すなわち圧縮無しの場合が最も優れていたが、現実の応用では、圧縮率と復号速度の両方が優れていなければならない。図15において「◆」で表される本発明の方法(A)は、圧縮率及び処理速度のいずれにおいても、最善ではないものの他のほとんどの手法よりも優れた結果を示しており、応用上有用な技術といえる。   FIG. 15 shows a two-dimensional plot of the size of the inverted index after compression and the time required to read the entire compressed inverted index for each method. In this figure, the closer to the origin, the better the compression rate and decoding speed. In the compression rate, the method (E) represented by “*” and the processing speed represented by “■” (B), that is, the case of no compression was the best, but in actual application, the compression rate and decoding Both speeds must be excellent. The method (A) of the present invention represented by “♦” in FIG. 15 shows results superior to most other methods that are not the best in terms of both compression rate and processing speed. This is a useful technique.

[実施例2]
次に、転置リスト108を先頭から読まずに途中から読んでも、ポスティングの境界がわかるようにする実施例について説明する。図22は、本実施例の方法によって圧縮される転置インデックスを作成し、それを用いて検索を行う装置の概略図である。本装置は、中央演算装置(CPU)601に、主記憶602が接続されている。必要に応じ、補助記憶603、CD−ROM・DVD等のリムーバブルメディア604、ネットワーク605、ユーザ端末606が接続される。本装置は、CPU 601により実行される主記憶602上のプログラムとして索引語切り出し手段S701、索引語出現回数取得手段S702、文書識別番号割り当て手段S703、ポスティング圧縮手段S704を備える。また、作成された圧縮転置インデックス607を用いて検索を実行する検索手段S705を備える。検索質問は主としてユーザ端末606から入力され、検索手段S705に渡される。
[Example 2]
Next, an embodiment will be described in which the posting boundary can be recognized even if the transposition list 108 is read from the middle without being read from the top. FIG. 22 is a schematic diagram of an apparatus that creates an inverted index compressed by the method of the present embodiment and performs a search using the inverted index. In this apparatus, a main memory 602 is connected to a central processing unit (CPU) 601. An auxiliary storage 603, a removable medium 604 such as a CD-ROM / DVD, a network 605, and a user terminal 606 are connected as necessary. This apparatus includes index word extraction means S701, index word appearance number acquisition means S702, document identification number assignment means S703, and posting compression means S704 as programs on the main memory 602 executed by the CPU 601. Further, a search means S705 for executing a search using the created compressed transposed index 607 is provided. The search question is mainly input from the user terminal 606 and passed to the search means S705.

本実施例では、図5にて説明したポスティングの圧縮形式を図16に示すように一部変更する。すなわち、出現回数を表すバイト列1603の最上位ビット1601にはいずれも1を書き込み、その次のビット1602が1か0かによって前記バイト列1603の終端バイトかどうかを表現する。本実施例では、最上位ビット1601の次のビット1602が0であるとき、そのバイトは、出現回数を表すバイト列1603の最後の1バイトであるとする。出現回数自体は、variable byte法で各バイト中の7ビットを用いて表現したように、上位2ビット(1601, 1602)を除いた6ビットを用いて表現する。こうすることにより、1つのポスティングを表すバイト列中で最上位ビットが0であるバイトは、文書識別番号を格納する可変長バイト列の末尾の1バイトのみになる。図16は、文書識別番号1234(2進数で100110 10010)、出現回数4321(2進数で1 000011 10001)のポスティングを圧縮した例である。   In this embodiment, the posting compression format described in FIG. 5 is partially changed as shown in FIG. That is, 1 is written in the most significant bit 1601 of the byte sequence 1603 representing the number of appearances, and whether the next bit 1602 is 1 or 0 indicates whether it is the end byte of the byte sequence 1603. In this embodiment, when the next bit 1602 of the most significant bit 1601 is 0, the byte is assumed to be the last 1 byte of the byte string 1603 representing the number of appearances. The appearance number itself is expressed using 6 bits excluding the upper 2 bits (1601, 1602), as expressed using 7 bits in each byte by the variable byte method. By doing this, the byte having the highest bit of 0 in the byte string representing one posting is only the last byte of the variable-length byte string storing the document identification number. FIG. 16 is an example in which the posting of the document identification number 1234 (binary number 100110 10010) and the number of appearances 4321 (binary number 1 000011 10001) is compressed.

転置リストを途中から読めるようにしたポスティング圧縮手段の処理フローを図18に示す。この処理は、図8に示したフローとほぼ同様であるが、fを表すバイト列を出力するステップS1801のみが異なる。このステップの処理内容を、図19を用いて説明する。まず、ステップS1901-S1903において、変数Aをfに、変数Lを2の6×n乗がAより大きい最小の自然数nにセットする。次にL≧2の間、S1904-S1905のループで、Aの下位6ビット以外のAの値を、6ビットずつ上位ビットから出力する。このとき、Aを右へL×6ビットシフトした後、63(2進数で111111)と論理積を取ることにより下位6ビット以外のビットを0とし、192(2進数で11000000)を加えることで下位から8ビット目および7ビット目を1とする。最後にステップS1906で、Aの下位6ビットを出力する。このとき、63と論理積を取った上で128(2進数で10000000)を加えることで、下位から8ビット目を1、7ビット目を0とする。   FIG. 18 shows a processing flow of the posting compression means that allows the transposed list to be read from the middle. This process is almost the same as the flow shown in FIG. 8 except for step S1801 for outputting a byte string representing f. The processing contents of this step will be described with reference to FIG. First, in steps S1901-S1903, the variable A is set to f, and the variable L is set to the smallest natural number n in which 2 to the power of 6 × n is larger than A. Next, while L ≧ 2, in the loop of S1904-S1905, the value of A other than the lower 6 bits of A is output from the upper bits by 6 bits. At this time, after shifting A by L × 6 bits to the right, by ANDing with 63 (111111 in binary), bits other than the lower 6 bits are set to 0, and 192 (11000000 in binary) is added. The 8th and 7th bits from the lower order are set to 1. Finally, in step S1906, the lower 6 bits of A are output. At this time, after ANDing 63 and adding 128 (binary number 10000000), the lower 8th bit is set to 1 and the 7th bit is set to 0.

文書検索にあたっては、例えば「(半導体 AND 電力)OR 磁気」のように単語の組み合わせを論理式で指定して検索するブーリアン検索、あるいは例えば「情報技術の未来」のように複数の単語が連続するフレーズを含む文書を検索するフレーズ検索が頻繁に用いられるため、これらの検索を高速に実行する必要がある。このような複数の索引語を含む文書の検索要求、例えば「索引語Aと索引語Bを同時に含む文書」という検索質問に対しては、もし索引語Aが少数の文書にしか出現しないのであれば、索引語Aが出現する文書に索引語Bが現れるかどうかをチェックするだけで、検索処理を実行できるようになる。すなわち、索引語Aの転置リストから、索引語Aが含まれる文書の文書識別番号を抽出し、それらの文書識別番号が索引語Bの転置リストに存在するかどうかをチェックすればよい。索引語Bの転置リストが文書識別番号の順に配列され、かつ、転置リストの途中からポスティングを読むことができれば、このチェックを2分探索によって高速化できる。   In document search, for example, a Boolean search that specifies a combination of words by a logical expression such as “(semiconductor AND power) OR magnetism”, or a plurality of consecutive words such as “the future of information technology”. Phrase searches that search for documents containing phrases are frequently used, and these searches must be performed at high speed. For such a search request for a document including a plurality of index words, for example, a search query “document including index word A and index word B simultaneously”, index word A may appear only in a small number of documents. For example, the search process can be executed only by checking whether or not the index word B appears in the document in which the index word A appears. That is, a document identification number of a document including the index word A may be extracted from the transposed list of the index word A, and it may be checked whether or not those document identification numbers exist in the transposed list of the index word B. If the transposed list of the index word B is arranged in the order of document identification numbers and the posting can be read from the middle of the transposed list, this check can be speeded up by binary search.

本実施例における、転置リストを対象とする2分探索の方法を説明する。本実施例によって圧縮されたポスティングでは、出現頻度が2のw乗から1を減じた値以下のとき「最上位ビットが1ならばポスティングの途中、0ならばポスティングの終端」という条件が成立する。出現頻度が2のw乗以上のときには、出現頻度を表すバイト列1603が存在するために最上位ビットが0のバイトがポスティングの終点にはならないが、最上位ビットが0であるバイトは1つのポスティングを構成するバイト列にただ一つだけである。これらのことを利用してポスティング内の情報を読み取り、2分探索を行う。   A binary search method for the transposed list in this embodiment will be described. In the posting compressed according to this embodiment, when the appearance frequency is equal to or less than the value obtained by subtracting 1 from the power of 2 to 2, the condition of “in the middle of posting if the most significant bit is 1, and the end of posting if 0” is satisfied. . When the appearance frequency is greater than or equal to 2 to the power of w, since the byte string 1603 representing the appearance frequency exists, the byte with the most significant bit of 0 is not the end point of posting, but there is only one byte with the most significant bit of 0. There is only one byte sequence that makes up a posting. Using these things, the information in the posting is read and a binary search is performed.

図20は、2分探索にあたって、所望の索引語に対する転置リストの途中の読みたい位置の周辺で、ポスティングの先頭を探索する処理の概略図である。図21は、ポスティングの先頭検出処理の流れを示したフローチャートである。これらの図を用いて、ポスティングの先頭検出処理を説明する。
(1) 最初に、転置リスト中の、2分探索で読みたい途中位置に移動する(S2101)。2分探索の最初における移動であれば、このステップで転置リストの中央位置に移動する。2回目以降の移動であれば、このステップS1701では未探索範囲の中央の位置に移動する。
(2) 次に、その位置またはその位置の上流側のなるべく近いバイトで、最上位ビットが0のバイトを探す。そのためには、まず、ステップS2101で移動したバイトの最上位ビットが0かどうかを判定する(S2102)。ステップS2102の判定で、最上位ビットが0であれば、次の処理S2104に移る。最上位ビットが0でない場合には、リストの先頭方向に遡って1バイトずつ読み込み、最上位ビットが0であるバイトを探す(S2102,S2103)。
(3) 最上位ビットが0であるバイトが見つかると、そのバイトを含むポスティングの終端バイトを探す。ポスティングの終端バイトを見つけるにあたっては、ステップS2102で見つけた最上位ビットが0であるバイト中の出現回数フィールド301を読み取る。ステップS2104の判定で、そこに書き込まれているのが0以外であれば、そのバイトがポスティングの終端である。出現回数フィールドの全てのビットに0が書き込まれている場合は、その後に出現回数を表すバイト列1603が続いている。その場合、最上位ビット1601に隣接するビット1602が0であるバイトが見つかるまで1バイト下流に移動することを繰り返す(S2105,S2106)。最上位ビット1601の次のビット1602が0であるバイトが見つかれば、そのバイトがポスティングを表現するバイト列の終端である。ポスティングの終端バイトが分かれば、その次の1バイトは新しいポスティングの先頭の1バイトであるため、1バイト下流に移動してから(S2107)、ポスティングの読み取りを開始する(S2108)。
FIG. 20 is a schematic diagram of a process of searching for the beginning of posting in the vicinity of a position to be read in the middle of a transposed list for a desired index word in a binary search. FIG. 21 is a flowchart showing the flow of a posting head detection process. The posting head detection process will be described with reference to these drawings.
(1) First, it moves to the halfway position to be read in the binary search in the transposed list (S2101). If it is the movement at the beginning of the binary search, it moves to the center position of the transposed list at this step. If it is the second and subsequent movements, in step S1701, the movement is made to the center position of the unsearched range.
(2) Next, look for a byte with the most significant bit of 0 at the position or the closest byte upstream of the position. For this purpose, first, it is determined whether or not the most significant bit of the byte moved in step S2101 is 0 (S2102). If it is determined in step S2102 that the most significant bit is 0, the process proceeds to the next process S2104. If the most significant bit is not 0, the byte is read back one byte at a time in the direction of the list, and a byte having the most significant bit of 0 is searched (S2102, S2103).
(3) When a byte having the most significant bit of 0 is found, the posting end byte including that byte is searched. In finding the posting end byte, the appearance number field 301 in the byte having the most significant bit found in step S2102 is read. If it is determined in step S2104 that the value written therein is other than 0, that byte is the end of posting. When 0 is written in all the bits of the appearance number field, a byte string 1603 indicating the number of appearances follows. In that case, the process of moving 1 byte downstream is repeated until a byte whose bit 1602 adjacent to the most significant bit 1601 is 0 is found (S2105, S2106). If a byte in which the next bit 1602 after the most significant bit 1601 is 0 is found, that byte is the end of a byte string representing posting. If the end byte of the posting is known, the next 1 byte is the first byte of the new posting, and after moving downstream by 1 byte (S2107), the reading of the posting is started (S2108).

このようにして、本実施例の方法によって圧縮されたポスティングを含む転置リストは、先頭から読むことなく途中から読めるようになり、2分探索が可能になる。その結果、転置インデックスを先頭から順に読まなくても、特定の文書に対応するポスティングに素早くアクセスできるようになる。ある索引語の転置リストの長さをLとするとき、特定の文書に対応するポスティングに到達するために、先頭から順に読み場合には平均L/2個のポスティングを読む必要があるが、上記の2分探索を行なえば読む必要のあるポスティングの数はlog(L)のオーダーに減少し、検索処理の高速化が図れる。   In this way, the transposed list including the posting compressed by the method of the present embodiment can be read from the middle without being read from the head, and a binary search is possible. As a result, posting corresponding to a specific document can be quickly accessed without reading the inverted index sequentially from the top. When the length of the transposed list of a certain index word is L, in order to reach the posting corresponding to a specific document, it is necessary to read an average of L / 2 postings when reading in order from the top. If the binary search is performed, the number of postings that need to be read is reduced to the order of log (L), and the search process can be speeded up.

図22に示した装置のユーザ端末606から複数の検索語を論理式で結合したブーリアン検索式あるいは複数の索引語が連続するフレーズが検索式として入力されたとき、2分探索は次のようにして行われる。いま、例えば検索式「(索引語A)and(索引語B)」がユーザ端末606から入力されたとする。すると、検索手段S705は、ANDで結合された索引語Aと索引語Bに対応する転置リストのうち、ポスティングの数が少ないもの(仮に、索引語Aとする)を選択し、索引語Aの転置リストから、索引語Aが含まれる文書識別番号d1,d2,d3,…を抽出する。次に、検索手段S705は、索引語Bの転置リスト中に先に取得した文書識別番号d1,d2,d3,…のそれぞれが存在するかどうかを2分探索によって探索する。その際、図20及び図21にて説明したポスティングの先頭位置検出処理を実行してポスティングを読み取りながら、探索中の文書識別番号が索引語Bの転置リスト中に含まれているか否かを判断する。具体的には、文書識別番号d1については、最初、図21に示した方法により索引語Bの転置リストの中央位置のポスティングの文書識別番号d’を読み取る。d’がd1より大きいとき、もし、索引語Bの転置リストに文書識別番号d1が含まれているとすれば、それは今読み取ったポスティングより前にあるはずなので、中央より前で同様に2分探索を行う。逆にd’がd1より小さければ、中央より後の配列で同様に2分探索を行う。この操作を反復することにより、文書識別番号d1が索引語Bの転置リストに存在するかどうか探索する。文書識別番号d2,d3が索引語Bの転置リストに存在するかどうかも、同様に2分探索で探索することができる。索引語Aの転置リストに含まれる文書識別番号(d1,d2,d3 等)のうち、索引語Bの転置リストに含まれる文書識別番号の文書は検索式「(索引語A)and(索引語B)」を満たす文書であるので、検索手段S705は、それらの文書の識別番号またはそれらの文書そのものをユーザ端末606に出力して検索が完了する。   When a Boolean search expression obtained by combining a plurality of search terms with a logical expression or a phrase in which a plurality of index words are consecutively input as a search expression from the user terminal 606 of the apparatus shown in FIG. 22, the binary search is performed as follows. Done. For example, it is assumed that a search expression “(index word A) and (index word B)” is input from the user terminal 606. Then, the search means S705 selects a transposed list corresponding to the index word A and the index word B connected by AND and that has a small number of postings (assuming that the index word A is assumed). Document identification numbers d1, d2, d3,... Containing the index word A are extracted from the transposed list. Next, the search means S705 searches by binary search whether each of the document identification numbers d1, d2, d3,... Acquired previously in the transposed list of the index word B exists. At this time, it is determined whether or not the document identification number being searched is included in the transposed list of the index word B while executing the posting start position detection process described with reference to FIGS. 20 and 21 and reading the posting. To do. Specifically, for the document identification number d1, first, the posting document identification number d 'at the center position of the transposed list of the index word B is read by the method shown in FIG. When d 'is greater than d1, if the document ID number d1 is included in the transposed list of index word B, it should be before the posting that was just read, so two minutes before the center as well Perform a search. On the other hand, if d 'is smaller than d1, a binary search is similarly performed on the array after the center. By repeating this operation, it is searched whether or not the document identification number d1 exists in the transposed list of the index word B. Whether or not the document identification numbers d2 and d3 exist in the transposed list of the index word B can be similarly searched by the binary search. Among the document identification numbers (d1, d2, d3, etc.) included in the transposed list of the index word A, the document with the document identification number included in the transposed list of the index word B is searched by the search expression “(index word A) and (index word B) ”, the search unit S705 outputs the identification numbers of those documents or the documents themselves to the user terminal 606, and the search is completed.

当業者には、実施例1と同様に、本実施例のポスティング圧縮方法にも様々なバリエーションがあることが明らかであろう。文書識別番号の最上位ビットを先頭のバイトに格納し最下位ビットを最終バイトに格納するのに代えて、バイトの並び順を変更し、逆順としてもよい。最上位ビットにより文書識別番号を表現する可変長バイト列の終端か否かを表現するのに代えて、最下位ビットを用いてもよい。この場合、図17に示すように、出現回数を表す追加のバイト列1703は、最下位ビット1702には常に1を書き込み、それに隣接する次のビット1701によって追加のバイト列の終端かどうかを示せばよい。整数のvariable byte表現において、最下位から7ビット以外が出力される場合には、前記整数を右に7ビットシフトして得られる整数は常に1以上である。このように1以上の値を扱うとわかっている場合には、出力する前に1を減じ、復号する際に1を加えて、前記整数を表現するビット数の削減を試みても良い(F. Scholer, H.E. Williams, J. Zobel, Compression of Inverted Indexes for Fast Query Evaluation, Proc. 25th Ann. Int’l ACM SIGIR Conf. Research and Development in Information Retrieval, pp.222-229, 2002.)。同様の技術が、出現回数を6ビットずつ出力する処理S1801でも使用できる。さらに、文書識別番号を昇順にソートし差分を取ることにより、圧縮率の向上を図っても良い(I.H.Witten, A. Moffat, and T.C.Bell, Managing Gigabytes: Compressing and Indexing Documents and Images, second ed. San Francisco: Morgan Kaufmann, 1999)。上記のバリエーションを、組み合わせて使用してもよい。 なお、転置リストは、ひとつながりのメモリ領域ではなく、不連続な複数の領域に格納されることがある。前述の通り、ポスティング中の文書識別番号は1つ前のポスティングの文書識別番号との差分を記録することで圧縮率を向上できるが、前記不連続な領域の個々の連続領域内で2分探索を可能とするためには、文書識別番号を差分をとらずにそのまま記録するか、または、ブロックの先頭の文書識別番号のみ差分を取らずに直接記録し、先頭以外の文書識別番号についてはブロックの先頭の文書識別番号との差分を書く、といった修正が必要である。 It will be apparent to those skilled in the art that, as in the first embodiment, there are various variations in the posting compression method of the present embodiment. Instead of storing the most significant bit of the document identification number in the first byte and storing the least significant bit in the last byte, the order of the bytes may be changed and reversed. Instead of expressing whether or not the end of the variable-length byte string expressing the document identification number by the most significant bit, the least significant bit may be used. In this case, as shown in FIG. 17, the additional byte string 1703 representing the number of appearances always writes 1 in the least significant bit 1702, and the next bit 1701 adjacent to it indicates whether or not the end of the additional byte string. That's fine. In the variable byte representation of an integer, when other than 7 bits from the least significant bit are output, the integer obtained by shifting the integer to the right by 7 bits is always 1 or more. In this way, when it is known that a value of 1 or more is handled, 1 may be subtracted before output, and 1 may be added at the time of decoding to try to reduce the number of bits representing the integer (F Scholer, HE Williams, J. Zobel, Compression of Inverted Indexes for Fast Query Evaluation, Proc. 25 th Ann. Int'l ACM SIGIR Conf. Research and Development in Information Retrieval, pp. 222-229, 2002.). A similar technique can be used in step S1801 for outputting the number of appearances by 6 bits. Furthermore, the compression rate may be improved by sorting the document identification numbers in ascending order and taking the difference (IHWitten, A. Moffat, and TCBell, Managing Gigabytes: Compressing and Indexing Documents and Images, second ed. San Francisco : Morgan Kaufmann, 1999). The above variations may be used in combination. Note that the transposed list may be stored in a plurality of discontinuous areas instead of a continuous memory area. As described above, the compression rate can be improved by recording the difference between the document identification number of the posting and the document identification number of the previous posting. However, the binary search is performed in each continuous area of the discontinuous area. In order to enable this, the document identification number is recorded as it is without taking a difference, or only the first document identification number of the block is directly recorded without taking a difference, and the document identification numbers other than the beginning are blocked. It is necessary to make corrections such as writing the difference from the first document identification number.

2分探索において、ある程度範囲を絞り込んだら、線形探索(ポスティングを順番に読んで特定の文書に対応するポスティングを探す方法)に切り替えることが好ましい。本実施例の2分探索はポスティングの先頭位置検出処理が必要なため、探索範囲が小さいとき(例えば、10バイト程度)は線形探索の方が速くなると考えられるからである。   In the binary search, after narrowing the range to some extent, it is preferable to switch to a linear search (a method of searching for postings corresponding to a specific document by reading postings in order). This is because the binary search of the present embodiment requires a posting head position detection process, and therefore, the linear search is considered to be faster when the search range is small (for example, about 10 bytes).

本発明は、高速な文書全文検索を実現するための技術である。簡便な圧縮方式のため、高速な検索処理を可能とする一方、圧縮率が高い可変長ビット列で圧縮する方式と比べても、データ量の増加は少ない。さらに、転置リスト上の2分探索が可能なため、フレーズ検索やブーリアン検索のような高度な検索を高速化できる。   The present invention is a technique for realizing a high-speed document full-text search. The simple compression method enables high-speed search processing, but the increase in data amount is small compared to a method of compressing with a variable-length bit string having a high compression rate. Furthermore, since a binary search on the transposed list is possible, advanced searches such as phrase search and Boolean search can be speeded up.

検索対象となる文書集合と、それに基づき構築される転置インデックスの概略図。FIG. 3 is a schematic diagram of a document set to be searched and a transposed index constructed based on the set. Variable byte法により圧縮された整数値の例を示す図。The figure which shows the example of the integer value compressed by the Variable byte method. 本発明の方法により圧縮されたポスティングの例を示す図。The figure which shows the example of the posting compressed by the method of this invention. 本発明の方法により圧縮されたポスティングの例を示す図。The figure which shows the example of the posting compressed by the method of this invention. 本発明の方法により圧縮されたポスティングの例を示す図。The figure which shows the example of the posting compressed by the method of this invention. 本発明を実施する装置の1つの形態を示す概略図。1 is a schematic diagram showing one form of an apparatus for carrying out the present invention. 本発明を実施する装置の一形態における、データ及び処理の流れを示す図。The figure which shows the flow of data and the process in one form of the apparatus which implements this invention. 本発明のポスティング圧縮手段の処理の一形態を表すフローチャート。The flowchart showing one form of the process of the posting compression means of this invention. 整数のvariable byte表現を出力する処理の一形態を表すフローチャート。The flowchart showing one form of the process which outputs the variable byte expression of an integer. 図4に示す圧縮の形態を変更し、1つのポスティングに対応するバイト列の前後を入替えた形態を示す図。The figure which shows the form which changed the form of the compression shown in FIG. 4, and replaced the order of the byte sequence corresponding to one posting. 図4に示す圧縮の形態を変更し、バイト列の終端か否かを表現するビットを、最上位ビットから最下位ビットに移した形態を示す図。The figure which shows the form which changed the compression form shown in FIG. 4, and moved the bit expressing whether it is the end of a byte sequence from the most significant bit to the least significant bit. 図4に示す圧縮の形態を変更し、出現回数フィールド及び属性フィールドを、バイト列の最終バイトの下位ビットから上位ビットに移動した形態を示す図。The figure which shows the form which changed the compression form shown in FIG. 4, and moved the appearance frequency field and the attribute field from the low-order bit of the last byte of a byte sequence to the high-order bit. x+w≧8の場合に、本発明の方法により圧縮されたポスティングの例を示す図。The figure which shows the example of the posting compressed by the method of this invention in the case of x + w> = 8. 本発明の方法により圧縮された転置インデックスの例を示す図。The figure which shows the example of the transposed index compressed by the method of this invention. 本発明の方法及び、公知の数値圧縮法により圧縮された転置インデックスの大きさと、前記転置インデックス全体の読み込み処理に要した時間の2次元プロット。The two-dimensional plot of the magnitude | size of the transposition index compressed by the method of this invention and the well-known numerical compression method, and the time required for the reading process of the said transposition index whole. 本発明の方法により圧縮されたポスティングの例を示す図。The figure which shows the example of the posting compressed by the method of this invention. 本発明の方法により圧縮されたポスティングの例を示す図。The figure which shows the example of the posting compressed by the method of this invention. 転置リストの途中からポスティングを読むことを可能とする、ポスティング圧縮処理の一形態を表すフローチャート。The flowchart showing one form of the posting compression process which makes it possible to read posting from the middle of a transposition list. 転置リストの途中からポスティングを読むことを可能とする、ポスティング圧縮処理の一形態において、出現回数を表現するバイト列を出力する処理のフローチャート。The flowchart of the process which outputs the byte sequence showing the frequency | count of appearance in one form of the posting compression process which makes it possible to read posting from the middle of a transposition list. 転置リストの途中でポスティングの先頭を探索する処理の概略図。Schematic of the process which searches the head of posting in the middle of a transposition list. ポスティングの先頭位置検出処理の流れを示したフローチャート。The flowchart which showed the flow of the head position detection process of posting. 本発明を実施する装置の1つの形態を示す概略図。1 is a schematic diagram showing one form of an apparatus for carrying out the present invention. 転置リストの説明図。Explanatory drawing of a transposition list.

符号の説明Explanation of symbols

101: 検索対象文書の集合
102: 転置インデックス
103: 索引語
104: 検索対象文書
105: 文書の識別番号
106: 出現回数
107: ポスティング
108: 転置リスト
201: 当該バイトが、1つの整数値を表すバイト列の最終バイトか否かを表すビット
202: 整数123456のvariable byte表現
203: 圧縮したい整数を表現するビット領域
301: 出現回数フィールド
401: 属性フィールド
402: 本発明の方法により圧縮されたポスティングを表現するバイト列
501: Variable byte法で表現された出現回数を表すバイト列
601: 中央演算装置(CPU)
602: 主記憶装置
603: 補助記憶装置
604: リムーバブルメディア
605: ネットワーク
606: ユーザ端末
607: 圧縮された転置インデックス
1401: 1つの索引語に関するポスティングリストの終端を表すデータ
1601: 文書識別番号の終端でないことを表現するためのビット
1602: 出現回数を表現するバイト列の終端を表現するためのビット
1603: 出現回数を表すバイト列
1701: 出現回数を表現するバイト列の終端を表現するためのビット
1702: 文書識別番号の終端でないことを表現するためのビット
1703: 出現回数を表すバイト列
101: Set of search target documents
102: Inverted index
103: Index terms
104: Search target document
105: Document identification number
106: Number of appearances
107: Posting
108: Transpose list
201: A bit indicating whether or not the byte is the last byte of a byte string representing one integer value
202: Variable byte representation of integer 123456
203: Bit area representing the integer to be compressed
301: Occurrence count field
401: Attribute field
402: Byte string representing a posting compressed by the method of the present invention
501: A byte sequence representing the number of occurrences expressed using the Variable byte method
601: Central processing unit (CPU)
602: Main memory
603: Auxiliary storage device
604: Removable media
605: Network
606: User terminal
607: compressed inverted index
1401: Data representing the end of the posting list for one index word
1601: Bit to express that it is not the end of the document identification number
1602: Bit for expressing the end of the byte sequence that represents the number of occurrences
1603: Byte string indicating the number of occurrences
1701: Bit for expressing the end of the byte sequence that represents the number of occurrences
1702: Bit for expressing that it is not the end of the document identification number
1703: Byte string indicating the number of occurrences

Claims (7)

記憶装置に入力された複数の電子文書を含む文書集合中の個々の電子文書から単語あるいは連続する複数の文字からなる索引語を切り出す工程と、
それぞれの索引語が各電子文書中に出現する回数を取得する工程と、
前記文書集合中の各電子文書にそれぞれ異なる文書識別番号を割り当てる工程と、
各々の索引語について得られた文書識別番号と索引語出現回数の組であるポスティングをデータ圧縮する工程とをコンピュータに実行させると共に、
前記ポスティングをデータ圧縮する工程は、各ポスティング中の電子文書の文書識別番号を可変長のバイト列に書き込み、wを1以上8以下の与えられた整数とするとき、前記バイト列中のwビットに1から(2W−1)までの索引語出現回数を書き込み、2W以上の索引語出現回数を追加のバイト列に書き込む
ことを特徴とするプログラム。
Cutting out a word or an index word consisting of a plurality of consecutive characters from each electronic document in a document set including a plurality of electronic documents input to a storage device;
Obtaining the number of times each index word appears in each electronic document;
Assigning a different document identification number to each electronic document in the document set;
Causing the computer to perform a data compression process of posting, which is a set of the document identification number and index word appearance count obtained for each index word;
The step of compressing the posting data includes writing the document identification number of the electronic document in each posting to a variable-length byte string, and assuming that w is a given integer between 1 and 8, w bits in the byte string. The index word appearance count from 1 to (2 W −1) is written in the program, and the index word appearance count of 2 W or more is written in an additional byte string.
請求項1記載のプログラムにおいて、xを、x+wが1以上8以下となる与えられた整数とする場合、前記ポスティングを符号化するバイト列中のxビットに追加情報を書き込む
ことを特徴とするプログラム。
2. The program according to claim 1, wherein when x is a given integer such that x + w is 1 or more and 8 or less, additional information is written to x bits in a byte sequence for encoding the posting. .
請求項記載のプログラムにおいて、
前記ポスティングをデータ圧縮する工程は、各バイト中の特定の位置のビットに電子文書の文書識別番号を符号化したバイト列の最終バイトか否かを示す情報を書き込むと共に、前記追加のバイト列について、各バイト中の前記特定の位置のビットに電子文書の文書識別番号を符号化したバイト列の最終バイトではないことを示す情報を書き込み、前記特定の位置のビットに隣接するビットに当該追加のバイト列の最終バイトか否かを示す情報を書き込む
ことを特徴とするプログラム。
The program according to claim 2 ,
The step of data compressing the posting writes information indicating whether or not it is the last byte of the byte sequence in which the document identification number of the electronic document is encoded in the bit at a specific position in each byte, and for the additional byte sequence , Information indicating that it is not the last byte of the byte string in which the document identification number of the electronic document is encoded is written in the bit at the specific position in each byte, and the additional bit is added to the bit adjacent to the bit at the specific position. A program that writes information indicating whether or not it is the last byte of a byte string.
コンピュータが、複数の電子文書を含む文書集合を記憶装置に入力する工程と、
コンピュータが、前記入力された文書集合中の個々の電子文書から単語あるいは連続する複数の文字からなる索引語を切り出す工程と、
コンピュータが、それぞれの索引語が各電子文書中に出現する回数を取得する工程と、
コンピュータが、前記文書集合中の各電子文書にそれぞれ異なる文書識別番号を割り当てる工程と、
コンピュータが、各々の索引語について得られた文書識別番号と索引語出現回数からなるポスティングをデータ圧縮する工程と、
コンピュータが、データ圧縮されたポスティングを含む転置インデックスを生成する工程とを有し、
前記ポスティングをデータ圧縮する工程では、各ポスティング中の電子文書の文書識別番号を可変長のバイト列に書き込み、wを1以上8以下の与えられた整数とするとき、索引語出現回数が1から(2W−1)までのときは当該索引語出現回数を前記バイト列中のwビットに書き込み、索引語出現回数が2W以上のときは当該索引語出現回数を前記wバイトと追加のバイト列を用いて書き込む
ことを特徴とする転置インデックス作成方法。
A computer inputting a document set including a plurality of electronic documents to a storage device;
A computer cutting out an index word consisting of words or a plurality of consecutive characters from each electronic document in the input document set;
A computer obtaining the number of times each index word appears in each electronic document;
A computer assigning a different document identification number to each electronic document in the document set;
A computer data compressing a posting consisting of a document identification number obtained for each index word and the number of occurrences of the index word;
Generating a transposed index including data-compressed posting,
In the step of compressing the posting data, when the document identification number of the electronic document in each posting is written in a variable-length byte string and w is a given integer between 1 and 8, the index word appearance count is 1 When up to (2 W −1), the index word appearance count is written to w bits in the byte string, and when the index word appearance count is 2 W or more, the index word appearance count is set to the w byte and an additional byte. A transposed index creation method characterized by writing using columns.
請求項4記載の転置インデックス作成方法において、xを、x+wが1以上8以下となる与えられた整数とする場合、コンピュータが、前記ポスティングを符号化するバイト列中のxビットに追加情報を書き込む
ことを特徴とする転置インデックス作成方法。
5. The transposed index creation method according to claim 4, wherein when x is a given integer such that x + w is 1 or more and 8 or less, the computer writes additional information in x bits in a byte string encoding the posting. A transposed index creation method characterized by that.
請求項記載の転置インデックス作成方法において、
コンピュータが前記ポスティングをデータ圧縮する工程は、各バイト中の特定の位置のビットに電子文書の文書識別番号を符号化したバイト列の最終バイトか否かを示す情報を書き込むと共に、前記追加のバイト列について、各バイト中の前記特定の位置のビットに電子文書の文書識別番号を符号化したバイト列の最終バイトではないことを示す情報を書き込み、前記特定の位置のビットに隣接するビットに当該追加のバイト列の最終バイトか否かを示す情報を書き込む
ことを特徴とする転置インデックス作成方法。
In the transposed index creation method according to claim 5 ,
The step of data compression of the posting includes writing information indicating whether or not it is the last byte of a byte sequence in which a document identification number of an electronic document is encoded in a bit at a specific position in each byte, and the additional byte. For the column, information indicating that it is not the last byte of the byte sequence in which the document identification number of the electronic document is encoded is written in the bit at the specific position in each byte, and the bit adjacent to the bit at the specific position A transposed index creation method, wherein information indicating whether or not the last byte of an additional byte sequence is written is written.
それぞれに識別番号が割り当てられた複数の電子文書からなる文書集合の全ての索引語について、前記索引語が出現する電子文書の識別番号と前記電子文書中での当該索引語の出現回数の組であるポスティングを格納した転置インデックスを用いた検索手段による検索方法であって、
前記転置インデックスは、各ポスティング中の電子文書の識別番号が可変長のバイト列としてコンピュータにより作成され、wを1以上8以下の与えられた整数とするとき、コンピュータは、前記バイト列中のwビットに1から(2W−1)までの出現回数を書き込み、2W以上の出現回数を前記wバイトと追加のバイト列を用いて書き込み、前記電子文書の識別番号を符号化したバイト列については、各バイト中の特定の位置のビットに当該バイト列の最終バイトか否かを示す情報を書き込み、前記追加のバイト列については、各バイト中の前記特定の位置のビットにより文書識別番号の最終バイトではないことを示す情報を書き込み、前記特定の位置のビットに隣接するビットに当該追加のバイト列の最終バイトか否かを示す情報を書き込むとき、
コンピュータが、入力部から第1の索引語と第2の索引語を受け付ける工程と、
コンピュータが、前記転置インデックス中の前記第1の索引語の転置リストに含まれる電子文書の識別番号を取得する工程と、
コンピュータが、前記取得した識別番号が前記第2の索引語の転置リストに含まれているかどうかを2分探索によって判定する工程と、
コンピュータが、前記取得した識別番号のうち前記第2の索引語の転置リストに含まれている識別番号またはその識別番号に対応する電子文書を検索する工程とを有し、
前記2分探索に際し、コンピュータが、読み取り位置を前記第2の索引語の転置リストの中央位置のバイトに移動し、当該バイトが前記電子文書の識別番号を符号化したバイト列の最終バイトか否かを判定し、最終バイトでない場合には最終バイトが見つかるまで前記転置リストの先頭の方向に1バイトずつ読み進み、前記電子文書の識別番号を符号化したバイト列の最終バイト中の出現回数が書き込まれるwビットの情報から前記出現回数を書き込む追加のバイト列が存在するか否かを判定し、追加のバイト列が存在しないと判定されたときは当該バイトの次のバイトをポスティングの先頭としてポスティングを読み取り当該ポスティング中の識別番号を取得し、追加のバイト列が存在すると判定されたときは追加のバイト列の最終バイトが見つかるまで前記転置リストの下流側に1バイトずつ読み進み、追加のバイト列の最終バイトの次のバイトをポスティングの先頭としてポスティングを読み取り当該ポスティング中の識別番号を取得する処理を実行する
ことを特徴とする検索方法。
For all index words of a document set consisting of a plurality of electronic documents each assigned an identification number, the combination of the identification number of the electronic document in which the index word appears and the number of occurrences of the index word in the electronic document A search method using a search means using a transposed index storing a posting,
The transposed index is created by a computer in which the identification number of the electronic document in each posting is a variable-length byte sequence, and when w is a given integer between 1 and 8, the computer uses the w in the byte sequence. Write the number of appearances from 1 to (2 W -1) in a bit, write the number of appearances of 2 W or more using the w byte and an additional byte string, and encode the identification number of the electronic document Writes information indicating whether or not it is the last byte of the byte sequence to a bit at a specific position in each byte, and for the additional byte sequence, the bit of the document identification number is indicated by the bit at the specific position in each byte. Information indicating that it is not the last byte is written, and information indicating whether or not it is the last byte of the additional byte sequence is written in a bit adjacent to the bit at the specific position. Mutoki,
A computer receiving a first index word and a second index word from an input unit;
A computer obtaining an identification number of an electronic document included in the inverted list of the first index word in the inverted index;
A computer determining by binary search whether the acquired identification number is included in the transposed list of the second index word;
A computer searching for an identification number included in the transposed list of the second index word among the acquired identification numbers or an electronic document corresponding to the identification number;
During the binary search, the computer moves the reading position to the byte at the center position of the transposed list of the second index word, and whether or not the byte is the last byte of the byte string obtained by encoding the identification number of the electronic document. If it is not the last byte, it reads one byte at a time in the direction of the head of the transposition list until the last byte is found, and the number of occurrences in the last byte of the byte string in which the identification number of the electronic document is encoded is It is determined whether or not there is an additional byte sequence for writing the number of occurrences from the w-bit information to be written. If it is determined that there is no additional byte sequence, the next byte of the byte is used as the head of posting. Read the posting, get the identification number in the posting, and if it is determined that there is an additional byte sequence, the last byte of the additional byte sequence Read one byte at a time downstream of the transposition list until it is found, read the posting with the next byte of the last byte of the additional byte string as the head of the posting, and execute the process of obtaining the identification number in the posting Search method.
JP2007070697A 2006-11-08 2007-03-19 Program, inverted index storage method and search method Active JP5346156B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2007070697A JP5346156B2 (en) 2006-11-08 2007-03-19 Program, inverted index storage method and search method
US11/936,277 US8321485B2 (en) 2006-11-08 2007-11-07 Device and method for constructing inverted indexes

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP2006303195 2006-11-08
JP2006303195 2006-11-08
JP2007070697A JP5346156B2 (en) 2006-11-08 2007-03-19 Program, inverted index storage method and search method

Publications (3)

Publication Number Publication Date
JP2008140357A JP2008140357A (en) 2008-06-19
JP2008140357A5 JP2008140357A5 (en) 2009-08-27
JP5346156B2 true JP5346156B2 (en) 2013-11-20

Family

ID=39601702

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007070697A Active JP5346156B2 (en) 2006-11-08 2007-03-19 Program, inverted index storage method and search method

Country Status (1)

Country Link
JP (1) JP5346156B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9600565B2 (en) 2010-10-15 2017-03-21 Nec Corporation Data structure, index creation device, data search device, index creation method, data search method, and computer-readable recording medium
JP7006462B2 (en) * 2018-04-02 2022-01-24 富士通株式会社 Data generation program, data generation method and information processing equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3531281B2 (en) * 1995-04-18 2004-05-24 富士ゼロックス株式会社 Document registration search device
JP3898717B2 (en) * 1997-02-28 2007-03-28 富士通株式会社 Data compression / decompression apparatus and data compression / decompression method
JP2001312517A (en) * 2000-05-02 2001-11-09 Mitsubishi Electric Corp Index generation system and document retrieval system

Also Published As

Publication number Publication date
JP2008140357A (en) 2008-06-19

Similar Documents

Publication Publication Date Title
US8321485B2 (en) Device and method for constructing inverted indexes
US8838551B2 (en) Multi-level database compression
TWI676903B (en) Lossless reduction of data by deriving data from prime data elements resident in a content-associative sieve
Adjeroh et al. The Burrows-Wheeler Transform:: Data Compression, Suffix Arrays, and Pattern Matching
KR101527994B1 (en) Search index format optimizations
KR101157693B1 (en) Multi-stage query processing system and method for use with tokenspace repository
US10389378B2 (en) Computer product, information processing apparatus, and information search apparatus
JP5812188B2 (en) Program, compressed data generation method, decompression method, information processing apparatus, and recording medium
JP5831298B2 (en) Program, information processing apparatus, and index generation method
JPH08255155A (en) Device and method for full-text registered word retrieval
Claude et al. Universal indexes for highly repetitive document collections
González et al. Locally compressed suffix arrays
US20040225497A1 (en) Compressed yet quickly searchable digital textual data format
TW202147787A (en) Exploiting locality of prime data for efficient retrieval of data that has been losslessly reduced using a prime data sieve
JP2010198425A (en) Document management method and device
JP5346156B2 (en) Program, inverted index storage method and search method
KR20000069633A (en) File processing method, data processing device, and storage medium
Arroyuelo et al. Practical approaches to reduce the space requirement of lempel-ziv--based compressed text indices
Dao et al. An indexing scheme for structured documents and its implementation
Gagie et al. Efficient and compact representations of prefix codes
JP5207721B2 (en) Inverted index creation device and forward index creation device
Awajan et al. Hybrid technique for Arabic text compression
US6731229B2 (en) Method to reduce storage requirements when storing semi-redundant information in a database
Nguyen et al. Decision tree algorithms for image data type identification
JP4985096B2 (en) Document analysis system, document analysis method, and computer program

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090709

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20090709

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20111116

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20111122

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120120

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20120605

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120831

A911 Transfer to examiner for re-examination before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20120911

A912 Re-examination (zenchi) completed and case transferred to appeal board

Free format text: JAPANESE INTERMEDIATE CODE: A912

Effective date: 20121116

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130816

R151 Written notification of patent or utility model registration

Ref document number: 5346156

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151