Inverted index method, device and equipment based on double-linked list structure and storage medium

By adopting double-linked list structure and cross-match technology in inverted indexes, the time complexity problem of inverted indexes in multi-keyword searches is solved, and the search and query efficiency is improved.

CN119719252APending Publication Date: 2025-03-28CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411797385.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

Inverted indexes have time complexity problems when dealing with multi-keyword searches, resulting in inefficient indexes.

Method used

The inverted indexing method based on the double-linked list structure is adopted. By obtaining the target characters in the target word and their corresponding inverted list, the inverted index collection of each character is queried, and the document index results are generated through cross-match, reducing the data processing amount and calculation complexity.

Benefits of technology

The search efficiency and query efficiency of inverted indexes are improved, and the full search is avoided. Only intersection operations are performed between the relevant inverted index sets are performed, which significantly reduces unnecessary calculations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719252A_ABST
    Figure CN119719252A_ABST
Patent Text Reader

Abstract

The invention provides a reverse indexing method and device based on a double-linked list structure, equipment and a storage medium, and relates to the field of data processing. According to the method, at least one target character in the target word and the corresponding first inverted list are obtained, and the inverted list of each character may contain different document ID sets, so that the data volume needing to be processed can be reduced. According to the method and the device, the inverted index sets corresponding to the first character and the second character in the target word are inquired respectively, so that a document containing all keywords can be positioned more quickly when multi-keyword search is processed, and the search efficiency of the inverted indexes is improved. According to the method, the document index result of the target word is generated by performing effective intersection operation on the two inverted index sets through cross matching of the characters of the same reference bit, so that full search of the whole document set is avoided, unnecessary calculation is remarkably reduced, and the query efficiency of the inverted index is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to an inverted index method, device, equipment and storage medium based on a double linked list structure. Background Art

[0002] An inverted index is a data structure widely used in information retrieval systems that allows the system to quickly retrieve documents containing specific words. Unlike a traditional forward index, an inverted index uses words in the document content as index keys and document IDs containing these words as values. This structure is particularly suitable for full-text search because it can quickly locate documents containing specific keywords. The main features of an inverted index include recording a list of documents where a word appears, the number of times a word appears in a document (TF, Term Frequency), and the position of the word in the document (POS). This data structure enables search engines to efficiently process queries and return a list of relevant documents.

[0003] However, when dealing with multi-keyword searches, the inverted index faces the problem of time complexity. If the searched keyword consists of multiple characters, each character needs to be searched separately, and then the intersection of these search results is taken to get the final document list. For example, if you search for a keyword consisting of 3 characters, you need to perform 3 searches, each with a time complexity of O(1), and then perform 2 intersection operations, each with a time complexity of O(1), so the total time complexity is O(4). For a keyword of n characters, the total time complexity is O(n+1). This means that as the length of the keyword increases, the time complexity of the search increases linearly, resulting in inefficient indexing.

[0004] Therefore, how to improve the efficiency of inverted indexing has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] The present application provides an inverted index method, apparatus, device and storage medium based on a double linked list structure, aiming to improve the efficiency of inverted indexing.

[0006] In a first aspect, the present application provides an inverted index method based on a double linked list structure, and the inverted index method based on a double linked list structure comprises the following steps:

[0007] Obtaining at least one target character in a target word and a first inverted list corresponding to at least one first document;

[0008] Based on the first inverted list, query a first inverted index set corresponding to the first character in the target word;

[0009] Based on the first inverted list, query a second inverted index set corresponding to the second character in the target word;

[0010] Based on the same reference position character corresponding to the first character and the second character, the first inverted index set and the second inverted index set are cross-matched to generate a document index result of the target word.

[0011] In a second aspect, the present application further provides an inverted index device based on a double linked list structure, the inverted index device based on a double linked list structure comprising:

[0012] A first posting list acquisition module, used to acquire at least one target character in a target word and a first posting list corresponding to at least one first document;

[0013] A first character query module, configured to query a first inverted index set corresponding to a first character in the target word based on the first inverted list;

[0014] A second character query module, configured to query a second inverted index set corresponding to a second character in the target word based on the first inverted list;

[0015] The index result generating module is used to cross-match the first inverted index set and the second inverted index set based on the same reference position character corresponding to the first character and the second character, so as to generate a document index result of the target word.

[0016] In a third aspect, the present application also provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the inverted index method based on a double linked list structure as described above are implemented.

[0017] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the inverted index method based on a double linked list structure as described above are implemented.

[0018] The present application provides an inverted index method, device, computer equipment and storage medium based on a double linked list structure. The method of the present application includes obtaining at least one target character in a target word and a first inverted list corresponding to at least one first document; based on the first inverted list, querying a first inverted index set corresponding to the first character in the target word; based on the first inverted list, querying a second inverted index set corresponding to the second character in the target word; based on the same reference position character corresponding to the first character and the second character, cross-matching the first inverted index set and the second inverted index set to generate a document index result of the target word. In the above manner, the present application obtains at least one target character in the target word and the corresponding first inverted list. The inverted list of each character may contain a different document ID set, thereby reducing the amount of data to be processed. The inverted index sets corresponding to the first character and the second character in the target word are queried separately, so that when processing multi-keyword searches, documents containing all keywords can be located more quickly, thereby improving the search efficiency of the inverted index. By cross-matching characters at the same reference position, the two inverted index sets are effectively intersected to generate the document index result of the target word, avoiding a full search of the entire document set. Instead, the intersection operation is only performed between related, smaller inverted index sets, significantly reducing unnecessary calculations and thus improving the query efficiency of the inverted index. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1 A schematic diagram of a flow chart of a first embodiment of an inverted index method based on a double linked list structure provided by the present application;

[0021] Figure 2 A schematic diagram of the document list structure of the inverted index provided in an embodiment of the present application;

[0022] Figure 3 A schematic diagram of the inverted list structure of characters of the inverted index provided in an embodiment of the present application;

[0023] Figure 4 A schematic diagram of a flow chart of a second embodiment of an inverted index method based on a double linked list structure provided by the present application;

[0024] Figure 5 It is a structural diagram of a first embodiment of an inverted index device based on a double linked list structure provided by the present application;

[0025] Figure 6 It is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application.

[0026] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0028] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0029] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0030] Please refer to Figure 1 , Figure 1 A flowchart of a first embodiment of an inverted index method based on a double linked list structure provided in the present application.

[0031] like Figure 1 As shown, the inverted index method based on the double linked list structure includes steps S101 to S104.

[0032] S101, obtaining at least one target character in a target word and a first posting list corresponding to at least one first document;

[0033] In one embodiment, in information retrieval, an inverted index is an index data structure that maps each word to a list of documents containing the word.

[0034] In one embodiment, a target word or phrase to be searched is determined. The target word may be composed of one character or multiple characters, such as a word composed of two characters or a word composed of three characters, such as "hospital", "tab page", etc. It may also be a phrase, such as "describe the specific operation steps in detail".

[0035] In one embodiment, the first document may be all documents in which the target word appears. First, the target word is retrieved from multiple documents, and all documents containing the target word are identified as the first document for performing an inverted index of the target character in the target word.

[0036] In this embodiment, the nodes in the inverted index structure are first changed into a double linked list structure. The inverted list based on the double linked list structure includes the following characteristics:

[0037] (1) Record the list of documents where the target word appears

[0038] (2) Inverted list element data structure:

[0039] 2.1) Record the number of occurrences and offset position of the character before the target character in all documents

[0040] 2.2) Record the number of occurrences and offset positions of the characters in all documents

[0041] 2.3) Record the number of occurrences and offset position of the character after the character in all documents

[0042] Specifically, the inverted list information can be expressed as:

[0043] (DocID; TF; <value>),(DocID;TF; <pos>),(DocID;TF; <value>)

[0044] Among them, DocID refers to the document ID where the target word appears; TF (Term Frequency) refers to the number of times a character appears in the document; POS refers to the position of the character in the document; and value refers to the value of the character itself.

[0045] Exemplarily, assuming the target word is "Baidu", you can create Figure 2 The document list shown in Figure 3 The inverted list corresponding to the target character shown.

[0046] S102: Based on the first inverted list, query a first inverted index set corresponding to the first character in the target word;

[0047] In one embodiment, the inverted list of the first document is accessed. This table will contain each word and its corresponding document list. Using the extracted first character as a keyword, the first inverted list is queried to find all inverted index sets containing the first character.

[0048] Each inverted index usually contains the document ID and the position information of the character in the document. Therefore, after the query is completed, a list of all documents containing the first character of the target word will be obtained, that is, the first inverted index set.

[0049] S103: Based on the first inverted list, query a second inverted index set corresponding to the second character in the target word;

[0050] In one embodiment, the inverted indexing process of the first character is the same as in the above step. The inverted list of the first document is accessed. The first inverted list is queried using the second character as a keyword to find all second inverted index sets containing the second character.

[0051] S104: Based on the same reference position character corresponding to the first character and the second character, cross-match the first inverted index set and the second inverted index set to generate a document index result of the target word.

[0052] In one embodiment, the information contained in the first inverted index set and the second inverted index set are all inverted index information corresponding to a single character in the target word, and the target of the index is actually the complete target word. In the target word, the first character and the second character have a fixed positional relationship, such as the character after the first character is the second character, or the character after the first character and the character before the second character point to the same character, etc. Therefore, the first inverted index set and the second inverted index set can be cross-matched based on the relative positional relationship between the first character and the second character in the target word, and the inverted index information pointing to the target word can be extracted as the document index result of the target word.

[0053] Furthermore, first position information of the first character in the target word and second position information of the second character in the target word are obtained; based on the first position information and the second position information, a relative offset position between the first character and the second character is determined; based on the relative offset position, the reference position character is extracted in the target word.

[0054] In one embodiment, the position of the first character in the target word is determined. For example, in "moonshot", if "m" is the first character, its position is 1. The position of the second character in the target word is determined. In "moonshot", if "o" is the second character, its position is 4. The relative offset position between the first character and the second character is calculated. This can be achieved by subtracting the position of the first character from the position of the second character. For example, in "moonshot", the offset position of "o" relative to "m" is 4-1=3, which means that "o" is three positions after "m".

[0055] In one embodiment, the position of the reference position character is determined based on the fixed position relationship between the first character and the second character in the target word. For example, if the fixed position relationship between the first character and the second character is "the first character is followed by the second character", then the reference position character is the second character. If the fixed position relationship is more complex, such as "the character after the first character and the character before the second character point to the same character", then the reference position character may be the character after the first character and the character before the second character.

[0056] Specifically, the target word is analyzed to determine the positions of the first character and the second character, as well as the fixed relationship between them (for example, the first character is followed by the second character), and based on the positional relationship between the first character and the second character, determine which documents contain both characters and their positional relationship meets the requirements of the target word. An intersection set is obtained, which contains documents that simultaneously meet the positional relationship between the first character and the second character. The document set obtained by cross matching is analyzed to extract the document index containing the complete target word.

[0057] Exemplarily, as Figure 3 shown in the inverted list, when querying "of Baidu", querying the character "Bai", the inverted index set where the character following "Bai" is "Du" can be obtained; querying the character "of", the inverted index set where the character preceding "of" is "Du" can be obtained. If the document IDs are retrieved from the intersection of the above two sets, they are the document IDs that query for documents containing "of Baidu".

[0058] Specifically, assume the target word is "of Baidu", the first character is "Bai", and the second character is "Du". Query the inverted index to obtain the document sets corresponding to "Bai" and "Du". For example, the inverted index set of "Bai": [Document 1, Document 2]; the inverted index set of "Du": [Document 1, Document 3]. Cross-match these two sets to find the documents that contain both "Bai" and "Du" and "Du" follows "Bai" immediately. The cross-match result is obtained: [Document 1]. Then, extract the document index that contains "of Baidu" from the cross-match result, that is, the document index result of the target word "of Baidu": [Document 1]. Thus, the documents containing a specific target word can be quickly located from a large number of documents effectively, improving the accuracy and efficiency of the query.

[0059] Furthermore, based on the first inverted index set, obtain the first adjacent character information of the first character in the first document; based on the second inverted index set, obtain the second adjacent character information of the second character in the first document; when both the first adjacent character information and the second adjacent character information represent the same reference position character, generate the document index result of the target word based on the first adjacent character information and the second adjacent character information.

[0060] Specifically, traverse all the documents containing the first character and record the characters following the first character; similarly, traverse all the documents containing the second character and record the characters preceding the second character; obtain two sets of adjacent character information, corresponding to the adjacent characters of the first character and the second character respectively. Compare the two sets of adjacent character information to find the reference position characters that are both the character following the first character and the character preceding the second character, obtaining a set of common reference position characters. For each common reference position character, search for the documents that contain the first character, the reference position character, and the second character to obtain the document index set that contains the target word.

[0061] Exemplarily, assuming that the target word is "Baidu's", the first character is "bai" and the second character is "degree". Get the adjacent character information of "bai" and "degree", such as: the adjacent character information of "bai": [{"document 1": "degree"}, {"document 2": "home"}]; the adjacent character information of "degree": [{"document 1": "bai"}, {"document 3": "de"}]. Cross-match the adjacent character information, the common reference position character of "bai" and "degree": ["degree"], you can filter out the document index result containing "Baidu's": ["document 1"].

[0062] In one embodiment, the document index result includes the document number of the first document where the target word is located, the number of occurrences of the target word in each of the first documents, the occurrence position of the target word in each of the first documents, and the encoding value of the target word.

[0063] In one embodiment, each first document has a uniquely identified document number, so as to distinguish different documents, and facilitate users or service terminals to quickly locate and access specific documents containing target words. The number of occurrences of the target word in each of the first documents can help evaluate the importance or relevance of the target word in the document. The more the number of occurrences, the higher the relevance of the document and the query word. The position of the occurrence of the target word in each of the first documents refers to the specific position (such as character index or paragraph position) of the target word in the document each time it appears, which can provide contextual information of the target word in the document, help users understand the use context of the target word, and perform more accurate information retrieval and text analysis. The encoding representation of the target word in the computer system is usually in the form of a byte sequence, such as UTF-8 encoding. The encoding value is used to ensure the correct representation and processing of the target word in different computer systems and network transmissions, and avoid errors caused by inconsistent character encodings.

[0064] In one embodiment, by providing the occurrence count and position information, it can help users more accurately determine the relevance of the document to the query term. The occurrence position information helps users understand the context in which the target word is used in the document, so as to better grasp the content of the document. The encoding value ensures that the target word can be correctly processed and transmitted at the technical level, especially in a multilingual environment.

[0065] The present embodiment provides an inverted index method based on a double linked list structure. The present method obtains at least one target character in the target word and the corresponding first inverted list. The inverted list of each character may contain different document ID sets, thereby reducing the amount of data that needs to be processed. The inverted index sets corresponding to the first character and the second character in the target word are queried separately, so that when processing multi-keyword searches, the documents containing all keywords can be located more quickly, thereby improving the search efficiency of the inverted index. By cross-matching characters in the same reference position, the two inverted index sets are effectively intersected to generate the document index result of the target word, avoiding a full search of the entire document set. Instead, the intersection operation is only performed between related, smaller inverted index sets, which significantly reduces unnecessary calculations, thereby improving the query efficiency of the inverted index.

[0066] Please refer to Figure 4 , Figure 4 A flowchart diagram of a second embodiment of an inverted index method based on a double linked list structure provided in the present application.

[0067] In this embodiment, Figure 4 As shown, based on the above Figure 1 In the illustrated embodiment, step S101 specifically includes:

[0068] S201, based on the inverted list structure, recording a second inverted list corresponding to at least one preset word in at least one of the first documents;

[0069] In one embodiment, before constructing the second inverted list of the first document, the document is first subjected to preprocessing steps such as word segmentation, stop word removal, stem extraction or lemmatization. For each document, each word appearing in the document and its position information in the document are recorded, which may include but is not limited to the number of occurrences of the word in the document and the position (such as sentence number, paragraph number, etc.) of the word.

[0070] In one embodiment, a preset word list may be defined, and these words may be common words in the query, or keywords screened according to specific requirements. Based on the preset word list, an inverted list of documents containing at least one preset word is screened from the complete inverted list, that is, for each preset word, all documents containing the word are searched, and relevant information of these documents is recorded.

[0071] In one embodiment, for the filtered documents, a new inverted list, namely, a second inverted list, is constructed to specifically record the occurrence of preset words in these documents, thereby facilitating a quick response to a query request containing the preset words.

[0072] Furthermore, based on the inverted list structure, the first index data of at least one preset character in the first document is recorded; the adjacent characters of each of the preset characters in the first document are retrieved; when the adjacent characters and the preset characters form the preset word, the second index data of the adjacent characters are recorded; based on the first index data and the second index data, a second inverted list corresponding to the preset characters is generated; based on the second inverted list corresponding to at least one of the preset characters, the first inverted list corresponding to the first document is obtained.

[0073] In one embodiment, the preset characters and preset words may be predefined characters or words for retrieval.

[0074] In one embodiment, for each document, the first index data of each preset character (which may be a part of a word) appearing in the document is recorded, which may include the position information of the preset character appearing in the document.

[0075] In one embodiment, the first index data includes a document number of a first document where the preset character is located, and a first document position of the preset character in the first document.

[0076] The document number of the first document is unique and is used to identify the document. The first document position is used to record the specific position of the preset character in the first document, which can be the index position of the character, such as the paragraph number, line number and the character number in the document.

[0077] In one embodiment, for each occurrence position of each preset character in the document, its adjacent characters are retrieved, including forward and backward searches, to determine which characters are adjacent to the preset character. When the adjacent characters are combined with the preset characters to form a preset word, the second index data of these adjacent characters are recorded, such as the position information of the adjacent characters in the document, and the relative position relationship between the adjacent characters and the preset characters.

[0078] In one embodiment, the second index data includes an adjacent character code of the preset character, a relative position of the adjacent character to the preset character, a second document position of the adjacent character in the first document, and a document number of the first document where the adjacent character is located.

[0079] In one embodiment, the adjacent character code refers to the code of the character adjacent to the preset character, such as the ASCII code or Unicode code of the character. The relative position refers to the relative position relationship between the adjacent character and the preset character, for example, whether the adjacent character is the previous character or the next character of the preset character. The second document position includes the specific position of the adjacent character in the first document, which, similar to the first document position, may include the paragraph number and line number of the adjacent character in the document, and the relative position of the adjacent character relative to the preset character. The document number can be used to trace the number of the first document where the adjacent character is located.

[0080] In one embodiment, based on the first index data (the position of the preset character) and the second index data (the position of the adjacent characters forming the preset word), a second inverted list corresponding to each preset character is generated. The second inverted list records the position information of the preset character and the adjacent characters in all documents containing the preset word. Based on the second inverted list corresponding to at least one preset character, a first inverted list corresponding to the entire document is obtained, and the first inverted list records the occurrence of all preset words in the document and the position information of each character in these words.

[0081] S202: Generate the first inverted list corresponding to the first document based on the second inverted list corresponding to each of the preset words in the first document.

[0082] In one embodiment, for each preset word in the first document, there is already a corresponding second inverted list. The second inverted list contains index data of all preset characters and their adjacent characters related to the preset word. Necessary information is extracted from the second inverted list of each preset word, including the preset word itself, the position where each preset character in the preset word appears in the document (first document position), the encoding, relative position, second document position in the document of the characters adjacent to each preset character in the preset word, and the document number where they are located. Using the information extracted from the second inverted list, a first inverted list corresponding to the first document is constructed, and the first inverted list records detailed information of each preset word, all occurrence positions of each preset word in the first document, and the constituent characters of each preset word and its adjacent characters.

[0083] This embodiment can quickly respond to user query requests by pre-building the posting list, without traversing the entire document collection when querying, thereby significantly improving retrieval efficiency. By compressing and optimizing the data structure of the posting list, the storage space requirement can be reduced while maintaining efficient query performance.

[0084] See also Figure 5 , Figure 5 It is a structural diagram of a first embodiment of an inverted index device based on a double linked list structure provided by the present application. The inverted index device based on a double linked list structure is used to execute the aforementioned inverted index method based on a double linked list structure.

[0085] like Figure 5 As shown, the inverted index device 300 based on the double linked list structure includes: a first inverted list acquisition module 301, a first character query module 302, a second character query module 303 and an index result generation module 304.

[0086] A first posting list acquisition module 301 is used to acquire a first posting list corresponding to at least one target character in a target word and at least one first document;

[0087] A first character query module 302, configured to query a first inverted index set corresponding to a first character in the target word based on the first inverted list;

[0088] A second character query module 303, configured to query a second inverted index set corresponding to a second character in the target word based on the first inverted list;

[0089] The index result generating module 304 is used to perform cross matching on the first inverted index set and the second inverted index set based on the same reference position character corresponding to the first character and the second character, so as to generate a document index result of the target word.

[0090] In one embodiment, the first posting list acquisition module 301 includes:

[0091] A second posting list recording unit, configured to record, based on the posting list structure, a second posting list corresponding to at least one preset word in at least one of the first documents;

[0092] The first inverted list generating unit is used to generate the first inverted list corresponding to the first document based on the second inverted list corresponding to each of the preset words in the first document.

[0093] In one embodiment, the second posting list recording unit includes:

[0094] A first index data recording subunit, configured to record first index data of at least one preset character in the first document based on an inverted list structure;

[0095] An adjacent character search subunit, used for searching adjacent characters of each of the preset characters in the first document;

[0096] A second index data recording subunit, used for recording second index data of the adjacent characters when the adjacent characters and the preset characters form the preset word;

[0097] A second inverted list generating subunit, configured to generate a second inverted list corresponding to the preset character based on the first index data and the second index data;

[0098] The first posting list obtaining subunit is used to obtain the first posting list corresponding to the first document based on the second posting list corresponding to at least one of the preset characters.

[0099] In one embodiment, the first index data includes a document number of a first document in which the preset character is located, and a first document position of the preset character in the first document;

[0100] The second index data includes an adjacent character code of the preset character, a relative position of the adjacent character to the preset character, a second document position of the adjacent character in the first document, and a document number of the first document where the adjacent character is located.

[0101] In one embodiment, the index result generating module 304 includes:

[0102] A first adjacent character indexing unit, configured to obtain first adjacent character information of the first character in the first document based on the first inverted index set;

[0103] A second adjacent character indexing unit, configured to obtain second adjacent character information of the second character in the first document based on the second inverted index set;

[0104] The adjacent character information matching unit is used to generate a document index result of the target word based on the first adjacent character information and the second adjacent character information when the first adjacent character information and the second adjacent character information both represent the same reference position character.

[0105] In one embodiment, the inverted index device 300 based on the double linked list structure further includes a reference position character determination module, including:

[0106] a position information determining unit, configured to obtain first position information of the first character in the target word and second position information of the second character in the target word;

[0107] a relative offset position determining unit, configured to determine a relative offset position between the first character and the second character based on the first position information and the second position information;

[0108] A reference position character determination unit is used to extract the reference position character in the target word based on the relative offset position.

[0109] In one embodiment, the document index result includes the document number of the first document where the target word is located, the number of occurrences of the target word in each of the first documents, the occurrence position of the target word in each of the first documents, and the encoding value of the target word.

[0110] It should be noted that technicians in the relevant field can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described device and each module can refer to the corresponding process in the aforementioned inverted index method embodiment based on the double linked list structure, and will not be repeated here.

[0111] The apparatus provided in the above embodiment may be implemented in the form of a computer program. The computer program may be Figure 6 Runs on the computer device shown.

[0112] See also Figure 6 , Figure 6 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server.

[0113] See also Figure 6 The computer device includes a processor, a memory and a network interface connected through a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.

[0114] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any inverted index method based on a double linked list structure.

[0115] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.

[0116] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any inverted index method based on a double linked list structure.

[0117] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0118] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0119] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:

[0120] Obtaining at least one target character in a target word and a first inverted list corresponding to at least one first document;

[0121] Based on the first inverted list, query a first inverted index set corresponding to the first character in the target word;

[0122] Based on the first inverted list, query a second inverted index set corresponding to the second character in the target word;

[0123] Based on the same reference position character corresponding to the first character and the second character, the first inverted index set and the second inverted index set are cross-matched to generate a document index result of the target word.

[0124] In one embodiment, when implementing the obtaining of the first posting list corresponding to at least one first document, the processor is configured to implement:

[0125] Based on the inverted list structure, recording a second inverted list corresponding to at least one preset word in at least one of the first documents;

[0126] Based on the second inverted list corresponding to each of the preset words in the first document, the first inverted list corresponding to the first document is generated.

[0127] In one embodiment, when the processor implements the second inverted list corresponding to at least one preset word in at least one first document based on the inverted list structure, it is used to implement:

[0128] Based on the inverted list structure, recording first index data of at least one preset character in the first document;

[0129] Retrieving adjacent characters of each of the preset characters in the first document;

[0130] When the adjacent characters and the preset characters form the preset word, recording the second index data of the adjacent characters;

[0131] Based on the first index data and the second index data, generating a second inverted list corresponding to the preset character;

[0132] Based on the second inverted list corresponding to at least one of the preset characters, the first inverted list corresponding to the first document is obtained.

[0133] In one embodiment, the first index data includes a document number of a first document in which the preset character is located, and a first document position of the preset character in the first document;

[0134] The second index data includes an adjacent character code of the preset character, a relative position of the adjacent character to the preset character, a second document position of the adjacent character in the first document, and a document number of the first document where the adjacent character is located.

[0135] In one embodiment, when the processor implements the cross-matching of the first inverted index set and the second inverted index set based on the same reference position character corresponding to the first character and the second character to generate the document index result of the target word, it is used to implement:

[0136] Based on the first inverted index set, obtaining first adjacent character information of the first character in the first document;

[0137] Based on the second inverted index set, obtaining second adjacent character information of the second character in the first document;

[0138] When the first adjacent character information and the second adjacent character information both represent the same reference position character, a document index result of the target word is generated based on the first adjacent character information and the second adjacent character information.

[0139] In one embodiment, before implementing the cross-matching of the first inverted index set and the second inverted index set based on the same reference position character corresponding to the first character and the second character to generate the document index result of the target word, the processor is further configured to implement:

[0140] Acquire first position information of the first character in the target word and second position information of the second character in the target word;

[0141] Determine a relative offset position between the first character and the second character based on the first position information and the second position information;

[0142] Based on the relative offset position, the reference position character is extracted from the target word.

[0143] In one embodiment, the document index result includes the document number of the first document where the target word is located, the number of occurrences of the target word in each of the first documents, the occurrence position of the target word in each of the first documents, and the encoding value of the target word.

[0144] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement any of the inverted index methods based on a double linked list structure provided in the embodiments of the present application.

[0145] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.

[0146] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.< / value> < / pos> < / value>

Claims

1. An inverted index method based on a double linked list structure, characterized in that: The method comprises: Obtaining at least one target character in a target word and a first inverted list corresponding to at least one first document; Based on the first inverted list, query a first inverted index set corresponding to the first character in the target word; Based on the first inverted list, query a second inverted index set corresponding to the second character in the target word; Based on the same reference position character corresponding to the first character and the second character, the first inverted index set and the second inverted index set are cross-matched to generate a document index result of the target word.

2. The inverted index method based on a double linked list structure according to claim 1, characterized in that: The obtaining of a first posting list corresponding to at least one first document includes: Based on the inverted list structure, recording a second inverted list corresponding to at least one preset word in at least one of the first documents; Based on the second inverted list corresponding to each of the preset words in the first document, the first inverted list corresponding to the first document is generated.

3. The inverted index method based on a double linked list structure according to claim 2, characterized in that: The step of recording a second inverted list corresponding to at least one preset word in at least one of the first documents based on the inverted list structure includes: Based on the inverted list structure, recording first index data of at least one preset character in the first document; Retrieving adjacent characters of each of the preset characters in the first document; When the adjacent characters and the preset characters form the preset word, recording the second index data of the adjacent characters; Based on the first index data and the second index data, generating a second inverted list corresponding to the preset character; Based on the second inverted list corresponding to at least one of the preset characters, the first inverted list corresponding to the first document is obtained.

4. The inverted index method based on a double linked list structure according to claim 3, characterized in that: The first index data includes a document number of a first document in which the preset character is located, and a first document position of the preset character in the first document; The second index data includes an adjacent character code of the preset character, a relative position of the adjacent character to the preset character, a second document position of the adjacent character in the first document, and a document number of the first document where the adjacent character is located.

5. The inverted index method based on a double linked list structure according to claim 1, characterized in that: The cross-matching of the first inverted index set and the second inverted index set based on the same reference position character corresponding to the first character and the second character to generate a document index result of the target word includes: Based on the first inverted index set, obtaining first adjacent character information of the first character in the first document; Based on the second inverted index set, obtaining second adjacent character information of the second character in the first document; When the first adjacent character information and the second adjacent character information both represent the same reference position character, a document index result of the target word is generated based on the first adjacent character information and the second adjacent character information.

6. The inverted index method based on a double linked list structure according to claim 1, characterized in that: Before cross-matching the first inverted index set and the second inverted index set based on the same reference position character corresponding to the first character and the second character to generate the document index result of the target word, the method further includes: Acquire first position information of the first character in the target word and second position information of the second character in the target word; Determine a relative offset position between the first character and the second character based on the first position information and the second position information; Based on the relative offset position, the reference position character is extracted from the target word.

7. The inverted index method based on a double linked list structure according to claim 1, characterized in that: The document index result includes the document number of the first document where the target word is located, the number of occurrences of the target word in each of the first documents, the occurrence position of the target word in each of the first documents, and the encoding value of the target word.

8. An inverted index device based on a double linked list structure, characterized in that: The inverted index device based on the double linked list structure comprises: A first posting list acquisition module, used to acquire at least one target character in a target word and a first posting list corresponding to at least one first document; A first character query module, configured to query a first inverted index set corresponding to a first character in the target word based on the first inverted list; A second character query module, configured to query a second inverted index set corresponding to a second character in the target word based on the first inverted list; The index result generating module is used to cross-match the first inverted index set and the second inverted index set based on the same reference position character corresponding to the first character and the second character, so as to generate a document index result of the target word.

9. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the inverted index method based on a double linked list structure as described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the inverted index method based on a double linked list structure as claimed in any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Standard state tracking management method and system

    CN121030017A