Distributed retrieval method for full-life-cycle knowledge of equipment

By using HashMap and B+ trees to achieve inverted indexing in the distributed storage environment of device life cycle knowledge, index access efficiency and hot issues under large-scale data are solved, and fast retrieval and efficient communication are achieved.

CN119884208AActive Publication Date: 2025-04-25CHINA ORDNANCE EQUIP GRP AUTOMATION RES INST CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411899187.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-04-25
Estimated Expiration
2044-12-23

AI Technical Summary

Technical Problem

Under large-scale data, when a single machine stores index files, the access efficiency of multiple machines is limited, and frequent read and write operations may lead to hot issues. Especially in a distributed storage environment with full life cycle knowledge of the device, it is necessary to optimize the inverted index structure to adapt to widely distributed and autonomously isolated storage resources.

Method used

HashMap and B+ trees are used to implement inverted indexing, calculate the hash value of keywords through the hash function, determine the machine to which it belongs, and realize distributed storage. Each keyword is stored on only one node, avoiding cross-node data merging and reducing traffic.

Benefits of technology

Fast retrieval is realized in the case of unstable communication, reducing multi-node communication and reducing communication costs, and is suitable for distributed system environments with efficient retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119884208A_ABST
    Figure CN119884208A_ABST
Patent Text Reader

Abstract

The invention discloses an equipment full-life-cycle knowledge distributed retrieval method, and relates to the technical field of knowledge retrieval, the method uses HashMap and B + tree to realize reverse indexing, during equipment full-life-cycle knowledge distributed retrieval, a client only needs to send a request to one node, multi-node communication is avoided, and the reliability of equipment full-life-cycle knowledge distributed retrieval is improved. And each keyword is only stored on a machine corresponding to one node, and cross-node data does not need to be merged, so that the communication traffic is greatly reduced. And meanwhile, quick retrieval can be realized under the condition of unstable communication, and the method is suitable for efficient retrieval under the condition that the communication cost between distributed systems is relatively high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of knowledge retrieval technology, and in particular to a distributed retrieval method for equipment full life cycle knowledge. Background Art

[0002] Indexing multi-source, heterogeneous data stored in distributed systems using lists in inverted files allows for efficient location of relevant documents, making it a core data structure for large-scale search engines and social networks. The inverted index based on inverted files works by storing an ordered list of document identifiers for each term appearing in a document. When a keyword query is used, it retrieves all relevant identifiers for documents containing all or at least one term.

[0003] There are two problems with indexing large-scale data: first, when the index file is stored on a single machine, when multiple machines access it, the access efficiency is limited by the performance of the machine; second, when accessing storage resources based on the index file, frequent read and write operations may lead to hot spots.

[0004] Patent document CN1536509A describes an inverted index storage method based on an inverted file. This method includes multiple fixed-size index blocks, each of which includes multiple fixed-size index units, each of which stores one piece of index information. Based on the index structure of the inverted file, the invention proposes an indexing mechanism that allows for online insertion, online deletion, and online integration. Furthermore, because the multiple index units in each index block are only used to store index information related to the same index item, the method provides an online update method to avoid affecting other index items. However, the method does not explain how to perform inverted indexing when data files are distributed across multiple processors.

[0005] For example, the characteristic of equipment life cycle knowledge is that the data collected is widely dispersed throughout the entire process from equipment procurement to scrapping. Due to the interconnection problems between local area networks, wide area networks, and the Internet, the communication cost between servers storing knowledge is uncertain. Therefore, the inverted index structure needs to be optimized to adapt to the difficulties faced by equipment life cycle knowledge, that is, distributed indexing in widely dispersed and autonomously isolated storage resources. Summary of the Invention

[0006] In view of the above problems, the present invention provides a distributed retrieval method for equipment full life cycle knowledge for overcoming the above problems or at least partially solving the above problems.

[0007] The present invention provides the following solutions:

[0008] A distributed retrieval method for device lifecycle knowledge is applied to a distributed system, wherein the distributed system includes several nodes, each node includes at least one machine, and the machines included in each node are communicably connected to each other; each machine stores inverted index data of all machines in the distributed system; each machine is provided with a HashMap, wherein the key and value of the HashMap are keywords and B+ trees, respectively, and the B+ tree is used to store a keyword and metadata corresponding to the keyword; different B+ trees are stored in the HashMaps of different machines, and the keyword hash value of the B+ tree stored in each machine is the same as the preset hash value corresponding to the machine, and the keyword hash value is calculated by combining the keyword with a preset hash function; the method includes:

[0009] Obtaining a document set on a current machine, where the current machine is any one of all the machines in the distributed system;

[0010] Traversing the document collection to extract keywords from each document in the document collection to obtain at least one keyword to be created;

[0011] Obtain the document ID and metadata corresponding to each keyword to be created;

[0012] Creating a corresponding B+ tree for each keyword to be created; inserting metadata corresponding to each keyword to be created into the corresponding B+ tree;

[0013] Calculating a keyword hash value for each of the keywords to be created by using the hash function;

[0014] Determining the machine to which each keyword to be created belongs according to a relationship between each keyword hash value and all the preset hash values;

[0015] Sending the B+ tree and the corresponding document ID corresponding to each keyword to be created to the HashMap on the machine to which they belong for storage;

[0016] After the traversal is completed, the inverted index data generated by the current machine is sent to all the machines included in the distributed system except the current machine;

[0017] A query client receives a query request input by a user, wherein the query client is any one of all the machines in the distributed system;

[0018] Calculating a query hash value of the keyword to be queried contained in the query request by using the hash function;

[0019] Sending the query request to a target machine corresponding to the preset hash value that is the same as the query hash value, the target machine being any one of all the machines in the distributed system;

[0020] The target machine performs a hash search, locates and traverses all documents in the B+ tree corresponding to the keyword to be queried, and returns all document IDs and corresponding metadata.

[0021] Preferably, the metadata includes word frequency, user access frequency and word position.

[0022] Preferably, the documents corresponding to each keyword are sorted in the corresponding B+ tree according to the user access frequency.

[0023] Preferably: when a new document is inserted into the current machine, segmenting the new document and extracting at least one new keyword;

[0024] Calculate the new keyword hash value of each new keyword by using the hash function;

[0025] Obtain the document ID and metadata corresponding to each of the new keywords;

[0026] Determine whether each of the new keywords already exists;

[0027] Inserting metadata corresponding to the new keyword determined to already exist into the corresponding B+ tree;

[0028] Determining that the new keyword does not exist, respectively initializing a corresponding new B+ tree for each of the new keywords that does not exist, and inserting metadata corresponding to each of the new keywords into the corresponding new B+ tree;

[0029] Determine the machine to which each new keyword belongs according to the relationship between each new keyword hash value and all the preset hash values;

[0030] The new B+ tree and the corresponding document ID corresponding to each new keyword are sent to the HashMap on the machine to which they belong for storage.

[0031] Preferably: extracting a keyword list of the document to be deleted;

[0032] Calculate the machine to which the keyword to be deleted belongs by the hash function; send the deletion command and the corresponding keyword to other nodes storing the keyword;

[0033] After receiving the delete command, it traverses each keyword to be deleted, searches for the B+ tree corresponding to each keyword to be deleted, and deletes the entry of the document corresponding to each keyword to be deleted in the B+ tree.

[0034] Preferably, the document is used to store equipment failure knowledge throughout its entire life cycle.

[0035] Preferably, the hash function is as follows:

[0036] NodeID=h(keyword)mod X

[0037] Where: X is the number of machine nodes in the distributed system, keyword is the keyword, h(·) is the hash function, and NodeID is the node in the distributed system.

[0038] Preferably, the hash function h(·) includes any one of SHA-1, MD5, CRC, Lookup3, and MurmurHash3.

[0039] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0040] The present invention provides a distributed retrieval method for device lifecycle knowledge, using a HashMap and B+ tree to implement an inverted index. During a distributed retrieval of device lifecycle knowledge, the client only needs to send a request to a single node, avoiding multi-node communication. Each keyword is stored on the machine corresponding to only one node, eliminating the need to merge cross-node data and significantly reducing communication traffic. Furthermore, fast retrieval is possible even in unstable communication situations, making it suitable for efficient retrieval under conditions where communication costs between distributed systems are high.

[0041] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be derived from these drawings without inventive effort.

[0043] Figure 1 is a keyword provided by an embodiment of the present invention i The B+ tree diagram below;

[0044] Figure 2 This is a schematic diagram of a distributed index constructed by each machine provided by an embodiment of the present invention. DETAILED DESCRIPTION

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

[0046] See also Figure 1 , is a distributed retrieval method for device life cycle knowledge provided by an embodiment of the present invention, such as Figure 1 As shown, the method is applied to a distributed system, the distributed system including several nodes, each of which includes at least one machine, and the machines included in each node are communicably connected to each other; each machine stores inverted index data of all the machines in the distributed system; each machine is provided with a HashMap, the key and value of the HashMap are keywords and B+ trees respectively, and the B+ tree is used to store a keyword and metadata corresponding to the keyword; different B+ trees are stored in the HashMaps of different machines, and the keyword hash value of the B+ tree stored in each machine is the same as the preset hash value corresponding to the machine, and the keyword hash value is obtained by combining the keyword with a preset hash function; the method may include:

[0047] Obtaining a document set on a current machine, where the current machine is any one of all the machines in the distributed system;

[0048] Traversing the document collection to extract keywords from each document in the document collection to obtain at least one keyword to be created;

[0049] Obtain the document ID and metadata corresponding to each keyword to be created; in specific implementation, the embodiment of the present application can provide the metadata including word frequency, user access frequency and word position.

[0050] A corresponding B+ tree is created for each keyword to be created; metadata corresponding to each keyword to be created is inserted into the corresponding B+ tree; in specific implementation, the embodiment of the present application can provide that each document corresponding to each keyword is sorted in the corresponding B+ tree using the user access frequency.

[0051] Calculating a keyword hash value for each of the keywords to be created by using the hash function;

[0052] Determining the machine to which each keyword to be created belongs according to a relationship between each keyword hash value and all the preset hash values;

[0053] Sending the B+ tree and the corresponding document ID corresponding to each keyword to be created to the HashMap on the machine to which they belong for storage;

[0054] After the traversal is completed, the inverted index data generated by the current machine is sent to all the machines included in the distributed system except the current machine;

[0055] A query client receives a query request input by a user, wherein the query client is any one of all the machines in the distributed system;

[0056] Calculating a query hash value of the keyword to be queried contained in the query request by using the hash function;

[0057] Sending the query request to a target machine corresponding to the preset hash value that is the same as the query hash value, the target machine being any one of all the machines in the distributed system;

[0058] The target machine performs a hash search, locates and traverses all documents in the B+ tree corresponding to the keyword to be queried, and returns all document IDs and corresponding metadata.

[0059] The distributed retrieval method for device life cycle knowledge provided in the embodiment of the present application can be applied to distributed retrieval under widely dispersed and autonomously isolated storage resources. There are two problems in indexing large-scale data: one is that when the index file is stored on a single machine, the access efficiency is limited by the performance of the machine when multiple machines access it; the other is that when accessing storage resources based on the index file, frequent read and write operations may cause hot spot problems. The retrieval method provided in the embodiment of the present application can achieve fast retrieval under unstable communication conditions, and is suitable for efficient retrieval under conditions where the communication cost between distributed systems is high. Based on the inverted index structure, update, deletion and retrieval operations are proposed.

[0060] The method provided in the embodiments of this application provides an improved inverted index structure that combines HashMap and B+ tree methods, leveraging the fast location capabilities of HashMap and the efficient range query characteristics of B+ tree. The inverted list is stored in HashMap, with the Key being the keyword and the Value being the corresponding inverted list, as shown in Table 1.

[0061] Table 1 Local hash table

[0062] Key Value <![CDATA[t1]]> <![CDATA[B+ tree constructed from DocID and MetaData corresponding to the t1 term]]> … …… <![CDATA[t n ]]> <![CDATA[t n B+ tree constructed by DocID and MetaData corresponding to the term]]>

[0063] Use B+ tree for storage and sort by user access frequency. An example of B+ tree is Figure 1This structure can quickly locate keywords, support range queries and sorting, and is highly flexible, but requires additional storage overhead. It is suitable for the scenario proposed by this method, namely, the retrieval of equipment failure knowledge throughout its entire life cycle.

[0064] When a new document needs to be inserted, the embodiment of the present application can provide that when a new document is inserted on the current machine, the new document is segmented and at least one new keyword is extracted;

[0065] Calculate the new keyword hash value of each new keyword by using the hash function;

[0066] Obtain the document ID and metadata corresponding to each of the new keywords;

[0067] Determine whether each of the new keywords already exists;

[0068] Inserting metadata corresponding to the new keyword determined to already exist into the corresponding B+ tree;

[0069] Determining that the new keyword does not exist, respectively initializing a corresponding new B+ tree for each of the new keywords that does not exist, and inserting metadata corresponding to each of the new keywords into the corresponding new B+ tree;

[0070] Determine the machine to which each new keyword belongs according to the relationship between each new keyword hash value and all the preset hash values;

[0071] The new B+ tree and the corresponding document ID corresponding to each new keyword are sent to the HashMap on the machine to which they belong for storage.

[0072] When it is necessary to delete existing documents, the embodiment of the present application can provide a keyword list for extracting the documents to be deleted;

[0073] Calculate the machine to which the keyword to be deleted belongs by the hash function; send the deletion command and the corresponding keyword to other nodes storing the keyword;

[0074] After receiving the delete command, it traverses each keyword to be deleted, searches for the B+ tree corresponding to each keyword to be deleted, and deletes the entry of the document corresponding to each keyword to be deleted in the B+ tree.

[0075] It can be understood that the method provided in the embodiment of the present application is applicable to document storage and retrieval in a variety of distributed systems. For example, in one implementation, the embodiment of the present application can provide the document for storing device knowledge throughout its life cycle.

[0076] In the method provided in the embodiment of the present application, the relationship between the hash value obtained by calculating the hash function and the preset hash value is used to determine the machine to which each keyword belongs. In specific implementation, the embodiment of the present application can provide the hash function as shown in the following formula:

[0077] NodeID=h(keyword)mod X

[0078] Where: X is the number of machine nodes in the distributed system, keyword is the keyword, h(·) is the hash function, and NodeID is the node in the distributed system.

[0079] Furthermore, the hash function h(·) includes any one of MurmurHash3, SHA-1, MD5, CRC, and Lookup3.

[0080] The method provided in this application is introduced in detail below.

[0081] The present invention provides an index construction method initially on each machine based on the improved inverted index structure.

[0082] Step 1: Create an empty HashMap to store keywords and their corresponding B+ trees;

[0083] Step 2: Traverse the document collection and extract the keyword list for each document;

[0084] Step 3: Initialize a new B+ tree with the keyword as the key and the B+ tree as the value. Use a hash function to calculate the machine corresponding to the distributed system node to which the keyword belongs. Record the document ID and metadata (MetaData) corresponding to the keyword. The metadata includes term frequency (TF), user access frequency (UAF), and term position (POS). Insert the keyword and its metadata into the corresponding B+ tree.

[0085] Step 4: After the traversal is completed, the locally generated inverted index data is sent to the machines of other nodes to ensure data consistency among all nodes in the distributed system.

[0086] The following is a time complexity analysis. Suppose the document collection contains N documents, each document contains an average of M terms, and the number of documents associated with each term in the inverted index is D. Then, term parsing takes O(N·M), HashMap insertion or search complexity is O(1), and searching for each term requires a total of O(N·M). The time complexity of the B+ tree insertion operation is O(log D), where D is the length of the inverted list corresponding to each term, and the total number of insertions is O(N·M). Therefore, for a single machine, the time required to build an index is O(N·M) + O(N·M) + O(N·M·log D) = O(N·M·log D).

[0087] The following is a space complexity analysis. HashMap needs to store a pointer or reference for each term, and the space complexity is O(K), where K is the total number of terms. The number of nodes in each B+ tree depends on the length D of the inverted list and the order B of the B+ tree. Assuming that there are K terms on average and the average length of the inverted list for each term is D, the total number of nodes is O(K·D / B). Each inverted list needs to store the document ID and metadata, and the space complexity is O(K·D). In summary, under the condition that D / B<<D, the space complexity required for the inverted index on a single machine is O(K·D).

[0088] The embodiment of the present application also provides an index insertion method based on the improved inverted index structure.

[0089] Step 1: When inserting a new document, perform word segmentation and extract new keywords.

[0090] Step 2: Use a hash function to calculate the machine corresponding to the distributed system node to which the keyword belongs. Generate metadata MetaData for each new keyword, including the term frequency (TF), user access frequency (UAF), and word position (POS). The user access frequency is initialized to 0. Send the locally generated inverted index data to the machines on other nodes.

[0091] Step 3: On each machine in the distributed system, for each new keyword in the received data, traverse it. If the new keyword does not exist, initialize a new B+ tree, use the keyword as the key and the B+ tree as the value, and insert it into the HashMap. If the keyword already exists, insert the document ID and metadata MetaData corresponding to the new keyword into the corresponding B+ tree.

[0092] Let's analyze the time complexity. Assume the document has M terms, and term parsing takes O(M). The time complexity of inserting each term into the B+ tree is O(log D), where D is the length of the inverted list corresponding to each term. The total complexity is O(M·log D).

[0093] The following is a space complexity analysis. Each keyword requires adding a document entry, and the space complexity is O(M).

[0094] The embodiment of the present application also provides an index deletion method on each machine based on the improved inverted index structure.

[0095] Step 1: Extract the keyword list of the documents to be deleted.

[0096] Step 2: Use the hash function to calculate the distributed system node to which the keyword belongs. Send the locally generated inverted index data to other nodes.

[0097] Step 3: On each machine in the distributed system, traverse each keyword, find the B+ tree corresponding to the keyword, and delete the entry of the document in the B+ tree.

[0098] Let's analyze the time complexity. Assume the document has M terms, and term parsing takes O(M). The time complexity of deleting each term's B+ tree entry is O(log D), where D is the length of the inverted list corresponding to each term. The total complexity is O(M·log D).

[0099] The embodiment of the present application also provides a keyword query method based on the improved inverted index structure.

[0100] Step 1: The machine that issues the query (hereinafter referred to as the client) directly locates the machine that stores the keyword using a hash algorithm;

[0101] Step 2: The client sends a query request to the machine that stores the target keyword;

[0102] Step 3: The machine performs a hash lookup to locate all documents in the B+ tree, that is, to traverse the records of the leaf nodes, and returns all document IDs and their metadata.

[0103] The time complexity of performing a hash lookup is O(1), and traversing the leaf nodes of the B+ tree is O(D), where D is the length of the inverted list, for a total time complexity of O(D). During the query, only the results need to be stored, so the space complexity is O(K), where K is the number of documents returned.

[0104] The method provided in the embodiment of this application is described below using the example of full life cycle fault knowledge distributed in 5 machines and 10 English documents.

[0105] The equipment life cycle fault knowledge is distributed in 5 machines. There are 10 English documents, namely Doc1, Doc2, ..., Doc10, and every two English documents are stored in one machine.

[0106] For example, the document content of Doc1 is: Who are you? The document content of Doc2 is: Where are you from? Doc1 and Doc2 are stored in machine 1. Doc1 and Doc2 have been accessed by users three times. The steps to construct an inverted index for machine 1 (NodeID = 0) are as follows:

[0107] Create an empty HashMap to store keywords and their corresponding B+ trees;

[0108] Traverse Doc1 and Doc2 and extract a keyword list for each document. The keyword list is: {Who, are, you, ?, Where, from};

[0109] If the keyword does not exist in the HashMap, a new B+ tree is initialized with the keyword as the key and the B+ tree as the value. The distributed system node to which the keyword belongs is calculated using a hash function as shown below.

[0110] NodeID=h(keyword)mod X

[0111] Where X is the number of nodes in the distributed system, keyword is the keyword, h(·) is the hash function, and NodeID is the node in the distributed system. If X is 5 and the MurmurHash3 algorithm is used as the hash function, the hash values ​​of {"Who","are","you","?","Where","from"} are {4114073512, 1662505136, 814527388, 2522961926, 104668330, 2755325844}, respectively. These values ​​are stored in the machines corresponding to the distributed system nodes with NodeIDs 2, 1, 3, 1, 0, and 4, respectively.

[0112] It can be seen that for this machine Machine1 (NodeID=0), it is necessary to record the document ID and metadata (MetaData) corresponding to the keyword {Where}. The metadata includes term frequency (TF), user access frequency (UAF), and term position (POS). The keyword and its metadata are inserted into the corresponding B+ tree.

[0113] The remaining keywords, along with their corresponding document IDs and metadata (MetaData), are sent to other machines. The keyword {"are", "?"} is sent to Machine 2 (NodeID=1), the keyword {"Who"} is sent to Machine 3 (NodeID=2), the keyword {"you"} is sent to Machine 4 (NodeID=3), and the keyword {"from"} is sent to Machine 5 (NodeID=4).

[0114] Similarly, the above operations are performed on each machine, and each machine can complete the construction of the distributed index, such as Figure 2 shown.

[0115] If the user searches for the keyword "are" on machine 3, the search steps are as follows:

[0116] According to the hash value obtained by the hash function calculation, it can be determined that the distributed system node of the keyword "are" is 1, that is, Machine 2.

[0117] Send the query request to Machine2.

[0118] Machine 2 performs a hash search to locate all documents in the B+ tree, that is, to traverse the records of leaf nodes, and returns all document IDs and their metadata.

[0119] In summary, the distributed retrieval method for device lifecycle knowledge provided in this application uses HashMap and B+ tree to implement an inverted index. When performing a distributed retrieval of device lifecycle fault knowledge, the client only needs to send a request to a single node, avoiding multi-node communication. Each keyword is stored only on the machine corresponding to a single node, eliminating the need to merge cross-node data and significantly reducing communication traffic. Furthermore, fast retrieval is possible even in unstable communication conditions, making it suitable for efficient retrieval under conditions where communication costs between distributed systems are high.

[0120] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0121] Through the description of the above embodiments, it can be seen that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or certain parts of the embodiments of the present application.

[0122] Each embodiment in this specification is described in a progressive manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple. For relevant parts, refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.

[0123] The above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention are included in the scope of protection of the present invention.

Claims

1. A distributed retrieval method for equipment life cycle knowledge, characterized in that: Applied to a distributed system, the distributed system includes several nodes, each of which includes at least one machine, and the machines included in each node can communicate with each other; each of the machines stores inverted index data of all the machines in the distributed system; each of the machines is provided with a HashMap, the key and value of the HashMap are keywords and B+ trees respectively, and the B+ tree is used to store a keyword and metadata corresponding to the keyword; different B+ trees are stored in HashMaps of different machines, and the keyword hash value of the B+ tree stored in each machine is the same as the preset hash value corresponding to the machine, and the keyword hash value is calculated by combining the keyword with a preset hash function; the method includes: Obtain a document set on a current machine, where the current machine is any one of all the machines in the distributed system; Traversing the document collection to extract keywords from each document in the document collection to obtain at least one keyword to be created; Obtain the document ID and metadata corresponding to each keyword to be created; Creating a corresponding B+ tree for each keyword to be created; inserting metadata corresponding to each keyword to be created into the corresponding B+ tree; Calculate the keyword hash value of each of the keywords to be created by using the hash function; Determine the machine to which each keyword to be created belongs according to the relationship between each keyword hash value and all the preset hash values; Send the B+ tree and the corresponding document ID corresponding to each keyword to be created to the HashMap on the machine to which they belong for storage; After the traversal is completed, the inverted index data generated by the current machine is sent to all the machines included in the distributed system except the current machine; A query client receives a query request input by a user, wherein the query client is any one of all the machines in the distributed system; Calculate the query hash value of the keyword to be queried contained in the query request by using the hash function; Sending the query request to a target machine corresponding to the preset hash value that is the same as the query hash value, the target machine being any one of all the machines in the distributed system; The target machine performs a hash search to locate and traverse all documents in the B+ tree corresponding to the keyword to be queried, and returns all document IDs and corresponding metadata.

2. The distributed retrieval method for equipment life cycle knowledge according to claim 1 is characterized in that: The metadata includes word frequency, user access frequency, and word position.

3. The distributed retrieval method for equipment life cycle knowledge according to claim 2 is characterized in that: The documents corresponding to each keyword are sorted in the corresponding B+ tree using the user access frequency.

4. The distributed retrieval method for equipment life cycle knowledge according to claim 1 is characterized in that: When a new document is inserted into the current machine, segment the new document and extract at least one new keyword; Calculate the new keyword hash value of each new keyword by using the hash function; Obtain the document ID and metadata corresponding to each of the new keywords; Determine whether each of the new keywords already exists; Inserting metadata corresponding to the new keyword determined to already exist into the corresponding B+ tree; Determine that it does not exist, initialize a corresponding new B+ tree for each of the new keywords that does not exist, and insert metadata corresponding to each of the new keywords into the corresponding new B+ tree; Determine the machine to which each new keyword belongs according to the relationship between each new keyword hash value and all the preset hash values; The new B+ tree and the corresponding document ID corresponding to each new keyword are sent to the HashMap on the machine to which they belong for storage.

5. The distributed retrieval method for equipment life cycle knowledge according to claim 1 is characterized in that: Extract the keyword list of the documents to be deleted; Calculate the machine to which the keyword to be deleted belongs by using the hash function; send the deletion command and the corresponding keyword to other nodes storing the keyword; After receiving the delete command, each keyword to be deleted is traversed, the B+ tree corresponding to each keyword to be deleted is searched, and the entry of the document corresponding to each keyword to be deleted is deleted in the B+ tree.

6. The distributed retrieval method for equipment life cycle knowledge according to claim 1 is characterized in that: The document is used to store equipment failure knowledge throughout its life cycle.

7. The distributed retrieval method for equipment life cycle knowledge according to claim 1 is characterized in that: The hash function is shown below: NodeID=h(keyword)mod X Where: X is the number of machine nodes in the distributed system, keyword is the keyword, h(·) is the hash function, and NodeID is the node in the distributed system.

8. The distributed retrieval method for equipment life cycle knowledge according to claim 7 is characterized in that: The hash function h(·) includes any one of SHA-1, MD5, CRC, Lookup3, and MurmurHash3.

Citation Information

Patent Citations

  • Inverted index storage method, inverted index mechanism and on-line updating method

    CN1536509A

  • Method, medium and system for locally searching files based on keywords for IPFS nodes

    CN114297145A

  • Distributed storage keyword retrieval method based on IPFS

    CN114780486A

  • Method and apparatus for processing data in knowledge base, and computer device and storage medium

    WO2021164171A1