主权项 |
1. A method for indexing references to documents of a database, the method comprising:
receiving a document, at the database, from a server; storing the document in the database; extracting a searchable term from the document, the searchable term being associated with a posting list; dividing the posting list into blocks, each block comprising M database references; for each block:
determining an encoding pattern based on values of the M database references, the determining the encoding pattern comprises:
determining a number n of patches according to a number of references, among the M database references, that are greater than or equal to 2b; andif n>0:
calculating, for each of n patches, a patch value vk by deleting b least significant bits from a corresponding one of the M database references that are greater than or equal to 2b, wherein k is in a range from 1 to n, anddetermining, for each of the n patches, a patch position pk corresponding to a position, in a range of 0 to M−1, of the corresponding one of the M database references that are greater than or equal to 2b;wherein the encoding pattern comprises b, n, p1 . . . pn, v1 . . . vn;locating an encoding pattern table entry corresponding to the encoding pattern;inserting a pointer corresponding to the located encoding pattern table entry in a header for the block; andinserting in the block a sequence of M truncated references, each truncated reference comprising b least significant bits of a corresponding one of the M database references. |