An ID fuzzy query method and device, electronic equipment and storage medium

By establishing an ID query tree and using a prefix subset of ID queries based on preset hash values, the problem of low efficiency in querying variable-length IDs is solved, thus achieving efficient ID queries.

CN120316157BActive Publication Date: 2026-04-14CHANGAN COMM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510383153.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-28
Publication Date
2026-04-14
Estimated Expiration
2045-03-28

AI Technical Summary

Technical Problem

Existing technologies have low query efficiency for variable-length IDs and cannot efficiently distinguish between variable-length IDs and the data to be transmitted in a message.

Method used

An ID query tree is established. The prefix subset ID is determined by the preset hash value and preset byte length group in the preset ID set. The hash value is determined by the preset byte length corresponding to the byte length group of the target message, which reduces character matching and improves query efficiency.

Benefits of technology

By building an ID query tree and using a prefix subset of IDs with preset hash values, the query efficiency for variable-length IDs is improved, the number of character matches is reduced, and the query speed is increased.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120316157B_ABST
    Figure CN120316157B_ABST
Patent Text Reader

Abstract

The application relates to an ID fuzzy query method and device, electronic equipment and a storage medium. The method comprises the following steps: establishing an ID query tree; when a target message to be queried is received, determining the first target byte length corresponding to the ID of indefinite length in the target message; determining the first byte length group to which the first target byte length belongs from a plurality of preset byte length groups and determining the first preset byte length corresponding to the first byte length group; extracting the first N bytes from the target message, wherein N is the first preset byte length; determining the hash value of the first N bytes to obtain the target hash value corresponding to the ID of indefinite length in the target message; and according to the target hash value, querying the ID query tree and the prefix subset ID corresponding to each preset hash value to obtain the fuzzy query result corresponding to the ID of indefinite length in the target message. The application improves the efficiency of the query of the ID of indefinite length.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to an ID fuzzy query method, apparatus, electronic device and storage medium. Background Technology

[0002] Currently, variable-length IDs are widely used in various application scenarios, such as online mobile games. To improve network security, messages carrying variable-length IDs also include the data to be transmitted. Therefore, after receiving the message, it is impossible to distinguish between the variable-length ID and the data to be transmitted. Existing technologies typically require using a Trie algorithm to query the message in order to determine the variable-length ID from it.

[0003] When using the Trie algorithm to query variable-length IDs in a message, the IDs are determined by matching characters level by level, which affects the query speed for variable-length IDs in the message. Summary of the Invention

[0004] This application provides an ID fuzzy query method, apparatus, electronic device, and storage medium to solve the problem of low query efficiency in the prior art when querying IDs of variable length in messages.

[0005] Firstly, this application provides an ID fuzzy query method, applied to a query server, the method comprising:

[0006] An ID lookup tree is established, which is constructed by the preset hash values ​​corresponding to each preset ID in the preset ID set. The preset hash values ​​are determined by the preset byte length group to which the preset ID belongs, and the preset hash values ​​correspond to a prefix subset ID.

[0007] Upon receiving the target message to be queried, determine the length of the first target byte corresponding to the variable-length ID in the target message;

[0008] The first byte length group to which the first target byte length belongs is determined from a plurality of preset byte length groups, and the first preset byte length corresponding to the first byte length group is determined. The first preset byte length represents the byte length corresponding to the hash value of the variable-length ID in the target message.

[0009] Extract the first N bytes from the target message, where N is the length of the first preset byte;

[0010] Determine the hash values ​​of the first N bytes of the first byte to obtain the target hash value corresponding to the variable-length ID in the target message;

[0011] Based on the target hash value, the ID query tree and the prefix subset IDs corresponding to each preset hash value are queried to obtain fuzzy query results corresponding to the variable-length IDs in the target message.

[0012] In an optional implementation, the step of querying the ID query tree and the prefix subset IDs corresponding to each preset hash value based on the target hash value to obtain fuzzy query results corresponding to variable-length IDs in the target message includes:

[0013] Based on the target hash value, the preset hash value corresponding to the first byte length group in the ID query tree is queried to obtain the first query result;

[0014] When the first query result is that the target hash value and the preset hash value corresponding to the first byte length group are successfully matched, if the character corresponding to the variable-length ID remaining bytes in the target message is not found in the ID query tree, it is determined whether the target hash value corresponds to the prefix subset ID.

[0015] When the target hash value corresponds to the prefix subset ID, the prefix subset ID corresponding to the target hash value is determined as the fuzzy query result corresponding to the variable-length ID in the target message.

[0016] In an optional implementation, after obtaining the first query result, the method further includes:

[0017] When the first query result is that the target hash value fails to match the preset hash value corresponding to the first byte length group, or when the target hash value does not correspond to the prefix subset ID, if the first byte length group is not the smallest preset byte length group among the multiple preset byte length groups, a second byte length group is determined from the multiple preset byte length groups, the second byte length group is smaller than the first byte length group and the second byte length group is adjacent to the first byte length group;

[0018] Determine the second preset byte length corresponding to the second byte length group. The second preset byte length represents the byte length corresponding to the hash value determined by the variable-length ID in the target message.

[0019] Using the second byte length group as the first byte length group and the second preset byte length as the first preset byte length, the step of extracting the first N first bytes from the target message is executed to obtain the fuzzy query result corresponding to the variable-length ID in the target message.

[0020] In an optional implementation, the ID query tree is constructed as follows:

[0021] Obtain the preset ID set and multiple preset byte length groups;

[0022] Determine the length of the second target byte corresponding to each preset ID in the preset ID set;

[0023] For each preset ID in the preset ID set, based on the second target byte length corresponding to the preset ID, the third byte length group to which the preset ID belongs is determined from multiple preset byte length groups, and the third preset byte length corresponding to the third byte length group is determined. The third preset byte length represents the byte length corresponding to the preset ID determined by hash value.

[0024] Extract the first M second bytes from the preset ID, where M is the length of the third preset byte;

[0025] Determine the hash values ​​of the first M bytes of the second byte to obtain the preset hash value corresponding to the preset ID;

[0026] Based on the preset hash value corresponding to each preset ID in the preset ID set and the character corresponding to the remaining bytes of each preset ID, the ID query tree is established, and when the preset hash value is set with the prefix subset ID, the preset hash value is associated with the prefix subset ID.

[0027] In an optional implementation, receiving the target message to be queried includes:

[0028] When the first service server receives the target message, the first service server determines the source service server IP and the destination service server IP corresponding to the target message;

[0029] The first service server determines whether the source service server IP or the destination service server IP is in a preset service server IP set, and each preset service server IP in the preset service server IP set supports ID services of variable length.

[0030] When the source service server IP is in the preset service server IP set or the destination service server IP is in the preset service server IP set, the first service server determines the target packet as the target packet to be queried;

[0031] The first service server sends the target message to the query server, so that the query server receives the target message to be queried.

[0032] In an optional implementation, when the first service server receives the target message, the first service server determines the source service server IP and the destination service server IP corresponding to the target message, including:

[0033] When the first service server receives the target message, it determines whether the target message is a UDP message;

[0034] When the target message is the UDP message, if the target message is in the local variable-length ID service flow table and the target message is a variable-length ID service protocol message, the first service server determines the source service server IP and the destination service server IP corresponding to the target message; or,

[0035] When the target message is the UDP message, if the target message is not in the local variable-length ID service flow table, the first service server determines the source service server IP and the destination service server IP corresponding to the target message.

[0036] In an optional implementation, the fuzzy query result includes the target ID;

[0037] After obtaining the fuzzy query result corresponding to the variable-length ID in the target message, the method further includes:

[0038] Determine the second business server corresponding to the target ID, where the second business server is the business server that registered the target ID;

[0039] The target ID and the IP address of the second service server are sent to the first service server, so that the first service server sends the target message and the target ID to the second service server.

[0040] Secondly, this application provides an ID fuzzy query device, comprising:

[0041] A module is established to build an ID query tree. The ID query tree is built from the preset hash values ​​corresponding to each preset ID in the preset ID set. The preset hash values ​​are determined by the preset byte length group to which the preset ID belongs, and the preset hash values ​​correspond to a prefix subset ID.

[0042] The determination module is used to determine the length of the first target byte corresponding to the variable-length ID in the target message when the target message to be queried is received;

[0043] The determining module is further configured to determine the first byte length group to which the first target byte length belongs from the plurality of preset byte length groups and to determine the first preset byte length corresponding to the first byte length group, wherein the first preset byte length represents the byte length corresponding to the hash value determined by the variable-length ID in the target message;

[0044] The extraction module is used to extract the first N bytes from the target message, where N is the length of the first preset byte.

[0045] The determining module is further configured to determine the hash values ​​of the first N bytes of the first byte to obtain the target hash value corresponding to the variable-length ID in the target message;

[0046] The query module is used to query the ID query tree and the prefix subset IDs corresponding to each preset hash value based on the target hash value, so as to obtain the fuzzy query results corresponding to the variable-length IDs in the target message.

[0047] Thirdly, this application provides an electronic device, including a processor and a memory, wherein the processor is configured to execute an ID fuzzy query program stored in the memory to implement the ID fuzzy query method described above.

[0048] Fourthly, this application provides a storage medium storing one or more programs that can be executed by one or more processors to implement the ID fuzzy query method described above.

[0049] Compared with the prior art, the technical solution provided in this application has the following advantages: The ID fuzzy query method provided in this application establishes an ID query tree, which is built by the preset hash values ​​corresponding to each preset ID in the preset ID set. The preset hash values ​​are determined by the preset byte length group to which the preset ID belongs, and the preset hash values ​​correspond to a prefix subset ID. When a target message to be queried is received, the first target byte length corresponding to the variable-length ID in the target message is determined. The first byte length group to which the first target byte length belongs and the first preset byte length corresponding to the first byte length group are determined from multiple preset byte length groups. The first preset byte length represents the byte length corresponding to the hash value determination of the variable-length ID in the target message. The first N first bytes are extracted from the target message, where N is the first preset byte length. The hash values ​​of the first N first bytes are determined to obtain the target hash value corresponding to the variable-length ID in the target message. Based on the target hash value, the ID query tree and the prefix subset ID corresponding to each preset hash value are queried to obtain the fuzzy query result corresponding to the variable-length ID in the target message. By means of the above method, this application establishes an ID query tree based on the preset hash values ​​of each preset ID in the preset ID set corresponding to each preset byte length group, and sets a prefix subset ID for the preset hash values. When a target message carrying an ID of variable length is received, the hash value of the variable-length ID in the target message can be determined according to the preset byte length corresponding to the preset byte length group to which the variable-length ID belongs. Then, the determined hash value of the variable-length ID is used to query the ID query tree and the prefix subset ID corresponding to each preset hash value to obtain the final ID in the target message. In this way, when querying the variable-length ID in the target message, it is not necessary to match each character in the target message one by one, thus improving the efficiency of querying the variable-length ID. Attached Figure Description

[0050] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0051] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0052] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0053] Figure 1 A flowchart illustrating an ID fuzzy query method provided in an embodiment of this application;

[0054] Figure 2 A schematic diagram illustrating the process of building an ID query tree, provided for an embodiment of this application;

[0055] Figure 3 A flowchart illustrating another ID fuzzy query method provided in an embodiment of this application;

[0056] Figure 4 This is a schematic diagram of the structure of an ID fuzzy query device provided in an embodiment of this application;

[0057] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0058] In the attached diagrams above:

[0059] 401. Create module; 402. Define module; 403. Extract module; 404. Query module;

[0060] 500. Electronic device; 501. Processor; 502. Memory; 5021. Operating system; 5022. Application program; 503. User interface; 504. Network interface; 505. Bus system. Detailed Implementation

[0061] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0062] The following disclosure provides numerous different embodiments or examples for implementing various structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of the invention. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.

[0063] refer to Figure 1 , Figure 1 This is a flowchart illustrating an ID fuzzy search method provided in an embodiment of this application. The ID fuzzy search method provided in this embodiment includes the following steps:

[0064] S101: Build an ID query tree.

[0065] In this embodiment, the ID lookup tree is built from the preset hash values ​​corresponding to each preset ID in the preset ID set. The preset hash value is determined by the preset byte length group to which the preset ID belongs, and the preset hash value corresponds to a prefix subset ID. For example, when a preset ID in the preset ID set is abcdefg, the preset hash value corresponding to the preset ID determined by the preset byte length group to which the preset ID belongs is m. When another preset ID in the preset ID set is abcd, abcd can be associated with the preset hash value m to use abcd as a prefix subset ID of the preset hash value m.

[0066] In the ID query tree construction, a preset ID is composed of a preset hash value corresponding to that preset ID and characters corresponding to the remaining bytes of that preset ID. These remaining bytes can be understood as the characters corresponding to the remaining bytes after determining the preset hash value. When performing fuzzy ID queries based on the ID query tree, fuzzy ID queries can be quickly implemented using the ID query tree and the prefix subset IDs corresponding to each preset hash value within it, thus improving the speed of fuzzy ID queries.

[0067] Specifically, the preset byte length groups can be set according to actual needs, and this embodiment does not specifically limit the preset byte length groups. For example, there are three preset byte length groups: the first group is 3 to 7 bytes long, the second group is 8 to 15 bytes long, and the third group is 16 to 20 bytes long. The preset byte length group to which the preset ID belongs can be understood as follows: if the byte length of the preset ID is 14 bytes long, then the preset byte length group to which the preset ID belongs is the second group mentioned above. It should be noted that the preset ID belonging to the first group can be used as a prefix subset ID of the preset hash value corresponding to the preset ID belonging to the second and third groups, and the preset ID belonging to the second group can be used as a prefix subset ID of the preset hash value corresponding to the preset ID belonging to the third group.

[0068] More specifically, each preset byte length group corresponds to a third preset byte length. This third preset byte length is used to determine the preset hash value corresponding to the preset ID. That is, the hash value of the first three preset byte lengths of the preset ID is determined to obtain the preset hash value corresponding to the preset ID. For example, for the first, second, and third preset byte length groups mentioned above, the third preset byte length corresponding to the first group can be 3, the third preset byte length corresponding to the second group can be 8, and the third preset byte length corresponding to the third group can be 16. For example, when determining the preset hash value corresponding to the preset ID, if the preset byte length group to which the preset ID belongs is the first group, then the hash value of the first 3 bytes of the preset ID is determined, and the determined hash value is used as the preset hash value corresponding to the preset ID.

[0069] In the above, step S101, which establishes the ID query tree, includes:

[0070] Retrieve a preset ID set and multiple preset byte length groups;

[0071] Determine the length of the second target byte corresponding to each preset ID in the preset ID set;

[0072] For each preset ID in the preset ID set, based on the second target byte length corresponding to the preset ID, determine the third byte length group to which the preset ID belongs from multiple preset byte length groups and determine the third preset byte length corresponding to the third byte length group;

[0073] Extract the first M second bytes from the preset ID;

[0074] Determine the hash values ​​of the first M second bytes to obtain the preset hash value corresponding to the preset ID;

[0075] Based on the preset hash value corresponding to each preset ID in the preset ID set and the character corresponding to the remaining bytes in each preset ID, an ID query tree is built, and when the preset hash value is set with a prefix subset ID, the preset hash value is associated with the prefix subset ID.

[0076] In this embodiment, the third preset byte length represents the byte length corresponding to the hash value determination of the preset ID, and M is the third preset byte length. The preset ID set and preset byte length group can be referred to the above description, and will not be repeated here. The second target byte length can be understood as the length of all characters in the preset ID. After obtaining the second target byte length corresponding to each preset ID in the preset ID set, the third byte length group to which the preset ID belongs and the third preset byte length corresponding to the third byte length group can be determined from multiple preset byte length groups based on the second target byte length corresponding to the preset ID. Specifically, after obtaining the third preset byte length corresponding to the third byte length group, the first three preset byte lengths of second bytes (i.e., the first M second bytes) can be extracted from the preset ID, and the hash value of the first M second bytes can be determined to obtain the preset hash value corresponding to the preset ID. After obtaining the preset hash values ​​corresponding to each preset ID in the preset ID set, all identical preset hash values ​​are identified from all the obtained preset hash values. Preset IDs with the same preset hash value are grouped into one category (i.e., the preset hash value is used as an index for bucket searching). Based on the characters corresponding to the remaining bytes in each preset ID with the same preset hash value, an ID lookup tree is built. Furthermore, when a preset hash value has a corresponding prefix subset ID, the preset hash value is associated with the prefix subset ID to facilitate subsequent ID fuzzy queries and improve the efficiency of ID fuzzy queries. The characters corresponding to the remaining bytes in the preset ID can be understood as the characters corresponding to the remaining bytes after determining the preset hash value corresponding to the preset ID.

[0077] For example, the preset ID set includes a first preset ID, a second preset ID, and a third preset ID. The first preset ID is abcdefg, the second preset ID is abcdghi, and the third preset ID is abcdhij. The preset hash values ​​corresponding to the first, second, and third preset IDs are the same, and are all determined by the abcd values ​​in the first, second, and third preset IDs. Using these preset hash values ​​as indexes, and sequentially using characters e, f, and g as nodes on a path, characters g, h, and i as nodes on another path, and characters h, i, and j as nodes on yet another path, an ID query tree can be established. Furthermore, if other preset IDs in the preset ID set have prefix subsets of the preset hash values ​​corresponding to the first, second, and third preset IDs, these other preset IDs are associated with the preset hash values ​​corresponding to the first, second, and third preset IDs to facilitate subsequent fuzzy ID queries and improve the efficiency of fuzzy ID queries.

[0078] S102: Upon receiving the target message to be queried, determine the length of the first target byte corresponding to the variable-length ID in the target message.

[0079] In this embodiment, when the business server receives the target message, it uploads the target message to the query server, enabling the query server to use the ID fuzzy query method provided in this embodiment to query the variable-length ID in the target message. The range of the first target byte length corresponding to the variable-length ID in the target message is known in the registered ID, for example, 5 bytes, 6 bytes, etc. Since the target message carrying the variable-length ID also carries related data, it is impossible to directly distinguish the variable-length ID and related data from the target message. Therefore, the variable-length ID can only be obtained by matching each character of the target message, which affects the query efficiency of the variable-length ID.

[0080] In the ID fuzzy search process, to reduce invalid queries and improve ID search efficiency, the receiving of the target message to be queried in step S102 includes:

[0081] When the first service server receives the target message, the first service server determines the source service server IP and the destination service server IP corresponding to the target message;

[0082] The first service server determines whether the source service server IP or the destination service server IP is in the preset service server IP set;

[0083] When the source service server IP is in the preset service server IP set or the destination service server IP is in the preset service server IP set, the first service server will determine the target packet as the target packet to be queried.

[0084] The first service server sends the target message to the query server so that the query server receives the target message to be queried.

[0085] Specifically, each preset business server IP in the preset business server IP set supports variable-length ID services. The query server corresponds to multiple business servers. The query server performs fuzzy queries on the variable-length IDs in the messages sent by the business servers to retrieve the variable-length IDs from the messages and returns them to the corresponding business servers. When a business server supports variable-length ID services, it registers the IDs with the query server. After registering the IDs, the query server records the IPs of each business server supporting variable-length ID services to generate a preset business server IP set. After generating the preset business server IP set, the query server distributes the generated preset business server set to each business server so that each business server can store the preset business server set. It should be noted that after the query server updates the preset business server set, it distributes the updated preset business server set to each business server, thereby updating the preset business server set stored by each business server.

[0086] More specifically, when the first service server receives a target message, it queries a pre-stored set of service servers locally to check if the source service server IP (SIP) and destination service server IP (DIP) corresponding to the target message are in the pre-stored set of service servers. If either the source service server IP or the destination service server IP is in the pre-stored set of service servers, it indicates that the target message contains an ID of variable length. In this case, the first service server sends the target message to the query server for further querying, thereby reducing invalid queries. If neither the source service server IP nor the destination service server IP corresponding to the target message is in the pre-stored set of service servers locally, it indicates that the target message does not contain an ID of variable length. In this case, the first service server does not need to send the target message to the query server for further querying, thus reducing invalid queries.

[0087] In the above, when the first service server receives the target message, the first service server determines the source service server IP and the destination service server IP corresponding to the target message, including:

[0088] When the first service server receives the target message, it determines whether the target message is a UDP message;

[0089] When the target message is a UDP message, if the target message is in the variable-length ID service flow table and the target message is a variable-length ID service protocol message, the first service server determines the source service server IP and the destination service server IP corresponding to the target message; or,

[0090] When the target message is a UDP message, if the target message is not in the local variable-length ID service flow table, the first service server determines the source service server IP and the destination service server IP corresponding to the target message.

[0091] Specifically, to further reduce invalid queries, when the first service server receives a target packet, it determines whether the target packet is a UDP packet. If the target packet is not a UDP packet, it exits directly. If the target packet is a UDP packet, it queries the variable-length ID service flow table. If the target packet is in the variable-length ID service flow table and the target packet is Protected encrypted data, it is forwarded or discarded according to the flow standard. If the target packet is in the variable-length ID service flow table and the target packet is a variable-length ID service protocol packet, the first service server determines the source service server IP and destination service server IP corresponding to the target packet. If the target packet is in the variable-length ID service flow table and the target packet is an Initial packet, it is ignored. If the target packet is in the variable-length ID service flow table and the target packet is a Handshake packet, the target packet is reported. If the target packet is not in the local variable-length ID service flow table, the first service server determines the source service server IP and destination service server IP corresponding to the target packet.

[0092] More specifically, after the first service server determines the source and destination service server IPs corresponding to the target packet, it sends the target packet to the query server. This allows the query server to perform a fuzzy search on the variable-length ID in the target packet. When the first service server initiates a query request for the target packet to the query server, it establishes a local session, marking the status as "query request in progress," and related flow packets are discarded. After the query server finds the variable-length ID in the target packet, the first service server updates itself upon receiving the variable-length ID from the query server.

[0093] S103: Determine the first byte length group to which the first target byte length belongs from multiple preset byte length groups, and determine the first preset byte length corresponding to the first byte length group.

[0094] In this embodiment, the first preset byte length represents the byte length corresponding to the hash value determination of the variable-length ID in the target message. That is, the first preset byte length is used to determine the hash value of the first preset byte length of the target message, thereby obtaining the target hash value corresponding to the variable-length ID in the target message. For example, when the preset byte length group is between 16 and 20 bytes, the preset byte length corresponding to this preset byte length group is 16 bytes. Therefore, when the first target byte length belongs to the aforementioned preset byte length group, the first preset byte length is 16 bytes.

[0095] S104: Extract the first N bytes from the target message.

[0096] In this embodiment, N is the first preset byte length. When the first preset byte length corresponding to the first byte length group to which the first target byte length belongs is obtained, the first first preset byte length (i.e., N) first bytes can be extracted from the target message. Using the determined N first bytes, the target hash value corresponding to the variable-length ID in the target message can be determined. Thus, the established ID query tree can be queried using the determined target hash value, and the variable-length ID in the target message can be obtained based on the ID query tree.

[0097] S105: Determine the hash values ​​of the first N bytes to obtain the target hash value corresponding to the variable-length ID in the target message.

[0098] In this embodiment, the determination of the hash value of the first N first bytes can refer to the existing technology, which will not be elaborated here. After determining the hash value of the first N first bytes in the target message, the target hash value corresponding to the target message can be obtained.

[0099] S106: Based on the target hash value, query the ID query tree and the prefix subset IDs corresponding to each preset hash value to obtain the fuzzy query results corresponding to the variable-length IDs in the target message.

[0100] In this embodiment, the ID query tree is built based on the preset hash values ​​corresponding to each preset ID in the preset ID set. Therefore, after obtaining the target hash value corresponding to the variable-length ID in the target message, the target hash value can be used as an index to query the ID query tree and the prefix subset ID corresponding to each preset hash value in the ID query tree. This will yield the fuzzy query results corresponding to the variable-length ID in the target message. In this way, when performing fuzzy queries on variable-length IDs in the target message, it is not necessary to match each character in the target message one by one, which improves the efficiency of fuzzy queries on variable-length IDs.

[0101] In step S106, based on the target hash value, the ID query tree and the prefix subset IDs corresponding to each preset hash value are queried to obtain fuzzy query results corresponding to the variable-length IDs in the target message, including:

[0102] Based on the target hash value, query the preset hash value corresponding to the first byte length group in the ID query tree to obtain the first query result;

[0103] If the first query result is that the target hash value matches the preset hash value corresponding to the first byte length group, and if the character corresponding to the variable-length ID remaining bytes in the target message is not found in the ID query tree, determine whether the target hash value corresponds to a prefix subset ID.

[0104] When the target hash value corresponds to a prefix subset ID, the prefix subset corresponding to the target hash value is determined as the fuzzy query result corresponding to the variable-length ID in the target message.

[0105] In the above, the remaining bytes of the target message can be understood as the bytes corresponding to the first target byte length minus the first preset byte length of the variable-length ID in the target message. For example, when the variable-length ID is abcdefg, all characters corresponding to the first target byte length are abcdef, and all characters corresponding to the first preset byte length are abcd. Then, the characters corresponding to the remaining bytes of the variable-length ID in the target message are e, f, and g.

[0106] Specifically, when a match is successfully found between the target hash value and a preset hash value in the ID lookup tree, the characters corresponding to the remaining bytes of the variable-length ID in the target message are matched one by one with the characters on the path where the preset hash value is located. If all the characters corresponding to the remaining bytes of the variable-length ID in the target message are matched in the ID lookup tree, the variable-length ID in the target message is retrieved from the ID lookup tree. Compared to matching each character of the variable-length ID in the target message character by character in the ID lookup tree, this improves the efficiency of fuzzy ID lookup. If not all the characters corresponding to the remaining bytes of the variable-length ID in the target message are matched in the ID lookup tree, it is determined whether a preset hash value with the same name as the target hash value corresponds to a prefix subset ID. If a preset hash value with the same name as the target hash value corresponds to a prefix subset ID, then that prefix subset ID is determined as the fuzzy lookup result corresponding to the variable-length ID in the target message.

[0107] In the above-described fuzzy ID query method, after obtaining the first query result, the method further includes the following steps:

[0108] If the first query result fails to match the target hash value with the preset hash value corresponding to the first byte length group, or if the target hash value does not correspond to a prefix subset ID, and if the first byte length group is not the smallest preset byte length group among multiple preset byte length groups, the second byte length group is determined from the multiple preset byte length groups.

[0109] Determine the second preset byte length corresponding to the second byte length group;

[0110] Using the second preset byte length group as the first preset byte length group and the second preset byte length as the first preset byte length, execute step S104 to obtain the fuzzy query result corresponding to the variable-length ID in the target message.

[0111] Specifically, the second byte length group is smaller than the first byte length group and is adjacent to the first byte length group. The second preset byte length represents the byte length corresponding to the hash value determination of the variable-length ID in the target message. When the target hash value fails to match the preset hash value in the ID query tree, and when the characters corresponding to the remaining bytes of the variable-length ID in the target message are not all matched in the ID query tree and the preset hash value with the same target hash value does not correspond to a prefix subset ID, it is determined whether the first byte length group is the smallest preset byte length group among multiple preset byte length groups. If the first byte length group is the smallest preset byte length group among multiple preset byte length groups, the fuzzy query result corresponding to the variable-length ID in the target message is determined to be not found. If the first byte length group is not the smallest preset byte length group among multiple preset byte length groups, a preset byte length group that is adjacent to the first byte length group and smaller than the first byte length group is determined from multiple preset byte length groups, and this preset byte length group is determined as the second byte length group. A second preset byte length corresponding to the second byte length group is determined. This second preset byte length is then used to determine the hash value corresponding to the variable-length ID in the target message. The determined hash value is then used to achieve a fuzzy matching result for the variable-length ID in the target message. Specifically, when determining the fuzzy matching result for the variable-length ID in the target message using the second preset byte length, the first byte length group in step S103 is replaced with the second byte length group, and the first preset byte length is replaced with the second preset byte length, to execute the subsequent step S104, thereby obtaining the fuzzy matching result for the variable-length ID in the target message.

[0112] More specifically, for example, regarding the first byte length group being 16 to 20 bytes and the second byte length group being 8 to 15 bytes, the first preset byte length corresponding to the first byte length group is 16 bytes, and the second preset byte length corresponding to the second byte length group is 8 bytes. When the first query result shows that the target hash value fails to match the preset hash value corresponding to the first byte length group, or when the target hash value does not correspond to a prefix subset ID, since the first byte length group is not the smallest preset byte length group among multiple preset byte length groups, and the second byte length group is adjacent to the first byte length group and smaller than the first byte length group, the second preset byte length corresponding to the second byte length group is determined, and the second byte length group is replaced with the first byte length group and the second preset byte length is replaced with the first preset byte length, to execute step S104 until the fuzzy query result corresponding to the variable-length ID in the target message is obtained.

[0113] The ID fuzzy query method provided in this embodiment, after obtaining the fuzzy query result corresponding to the variable-length ID in the target message, further includes the following steps:

[0114] Determine the second business server corresponding to the target ID;

[0115] Send the target ID and the IP address of the second service server to the first service server, so that the first service server will send the target message and the target ID to the second service server.

[0116] The fuzzy query result includes the target ID, and the second service server is the service server that registered the target ID. Since only the service server that registered the target ID has the most complete information, to better process the target message, a mapping relationship between each preset service server and a preset ID can be stored in the query server. This preset service server is the service server that registered the preset ID with the query server. After obtaining the target ID, the above mapping relationship can be queried based on the target ID to obtain the second service server corresponding to the target ID. After determining the second service server corresponding to the target ID, the target ID and the IP address of the second service server can be sent to the first service server, so that the first service server sends the target message and the target ID to the second service server, allowing the second service server to process the target message according to the target ID.

[0117] This embodiment provides an ID fuzzy query method. It establishes an ID query tree using the preset hash values ​​of each preset ID in a preset ID set corresponding to each preset byte length group. A prefix subset ID is set for each preset hash value. When a target message carrying an ID of variable length is received, the hash value of the variable-length ID in the target message can be determined based on the preset byte length corresponding to the preset byte length group to which the variable-length ID belongs. Then, using the determined hash value of the variable-length ID, the ID query tree and the prefix subset ID corresponding to each preset hash value are queried to obtain the final ID in the target message. Thus, when querying a variable-length ID in a target message, it is not necessary to match each character in the target message one by one, improving the efficiency of variable-length ID queries.

[0118] The following is an example for reference. Figure 2 and Figure 3 As shown, this document details the process of building an entire ID query tree and performing a fuzzy ID query.

[0119] refer to Figure 2 As shown, when there are multiple preset byte length groups including three groups, namely the first group, the second group, and the third group, the first group is 3 to 7 bytes long, the second group is 8 to 15 bytes long, and the third group is 16 to 20 bytes long. The process of building the ID query tree is as follows: Obtain the preset ID set; for each preset ID in the preset ID set, determine whether the second target byte length corresponding to the preset ID belongs to the third group. If the second target byte length corresponding to the preset ID belongs to the third group, extract the first 16 bytes in the preset ID and determine the hash value of the first 16 bytes to obtain the preset hash value corresponding to the preset ID. Use the preset hash value as an index to find the bucket, and build a path in the ID query tree based on the preset hash value and the characters corresponding to the remaining bytes of the preset ID.

[0120] If the second target byte length corresponding to the preset ID does not belong to the third group, determine whether the second target byte length corresponding to the preset ID belongs to the second group. If the second target byte length corresponding to the preset ID belongs to the second group, extract the first 8 bytes of the preset ID and determine the hash value of the first 8 bytes to obtain the preset hash value corresponding to the preset ID. Use the preset hash value as an index to find the bucket and build a path in the ID lookup tree based on the preset hash value and the characters corresponding to the remaining bytes of the preset ID. Furthermore, determine whether the preset ID is a prefix subset ID of the preset hash value corresponding to the preset ID belonging to the third group. If the preset ID is a prefix subset ID of the preset hash value corresponding to the preset ID belonging to the third group, associate the preset ID as a prefix subset ID of the preset hash value corresponding to the preset ID belonging to the third group.

[0121] When the second target byte length corresponding to the preset ID does not belong to the third group, the first 3 bytes of the preset ID are extracted and their hash values ​​are determined to obtain the preset hash value corresponding to the preset ID. The preset hash value is used as an index to find the bucket, and a path in the ID lookup tree is built based on the preset hash value and the characters corresponding to the remaining bytes of the preset ID. Furthermore, it is determined whether the preset ID is a preset hash value corresponding to the preset ID of the third group and a prefix subset ID corresponding to the preset hash value of the preset ID of the second group. When the preset ID is a prefix subset ID corresponding to the preset hash value of the preset ID of the third group and a prefix subset ID corresponding to the preset hash value of the preset ID of the second group, the preset ID is associated with both the prefix subset ID corresponding to the preset hash value of the third group and the prefix subset ID corresponding to the preset hash value of the preset ID of the second group.

[0122] refer to Figure 3 As shown, when there are multiple preset byte length groups including three groups, namely the first group, the second group, and the third group, the first group has a length of 3 to 7 bytes, the second group has a length of 8 to 15 bytes, and the third group has a length of 16 to 20 bytes. If the first target byte length corresponding to the variable-length ID in the target message belongs to the third group, the ID fuzzy lookup process is as follows:

[0123] When the length of the first target byte belongs to the third group, the first 16 bytes are extracted from the target message, and the hash value of the first 16 bytes is determined to obtain the target hash value corresponding to the variable-length ID in the target message;

[0124] The target hash value is indexed in the ID lookup tree to find buckets and determine whether the target hash value is matched in the ID lookup tree. If the target hash value is matched in the ID lookup tree, the system queries whether the characters corresponding to the remaining bytes of the variable-length ID in the target message are matched one by one. If matched, the fuzzy matching result is obtained and returned. If not matched, it is determined whether the target hash value has a corresponding prefix subset ID. If the target hash value has a corresponding prefix subset ID, the prefix subset ID is used as the fuzzy matching result and returned.

[0125] When the target hash value is not matched in the ID lookup tree or when the target hash value does not correspond to a prefix subset ID, the first 8 bytes are extracted from the target message and the hash value of the first 8 bytes is determined to obtain the target hash value corresponding to the variable-length ID in the target message.

[0126] The target hash value is indexed in the ID lookup tree to find buckets and determine whether the target hash value is matched in the ID lookup tree. If the target hash value is matched in the ID lookup tree, the system queries whether the characters corresponding to the remaining bytes of the variable-length ID in the target message are matched one by one. If matched, the fuzzy matching result is obtained and returned. If not matched, it is determined whether the target hash value has a corresponding prefix subset ID. If the target hash value has a corresponding prefix subset ID, the prefix subset ID is used as the fuzzy matching result and returned.

[0127] When the target hash value is not matched in the ID lookup tree or when the target hash value does not correspond to a prefix subset ID, the first 3 bytes are extracted from the target message and the hash value of the first 3 bytes is determined to obtain the target hash value corresponding to the variable-length ID in the target message.

[0128] The target hash value is indexed in the ID query tree to determine whether the target hash value is matched in the ID query tree. When the target hash value is matched in the ID query tree, the characters corresponding to the variable-length ID remaining bytes in the target message are matched one by one based on the ID query tree. If matched, the fuzzy matching result is obtained and returned; if not matched, it is returned that no match was found.

[0129] refer to Figure 4 , Figure 4This is a schematic diagram of the structure of an ID fuzzy query device provided in an embodiment of this application. The ID fuzzy query device provided in this embodiment includes: a building module 401, a determining module 402, an extraction module 403, and a query module 404. The building module 401 is used to build an ID query tree, which is built from the preset hash values ​​corresponding to each preset ID in a preset ID set. The preset hash values ​​are determined by the preset byte length group to which the preset ID belongs, and the preset hash values ​​correspond to a prefix subset ID. The determining module 402 is used to determine the first target byte length corresponding to an ID of variable length in the target message when a target message to be queried is received. The determining module 402 is also used to determine the first byte length group to which the first target byte length belongs from multiple preset byte length groups and to determine the first preset character corresponding to the first byte length group. The first preset byte length represents the byte length corresponding to the hash value determination of the variable-length ID in the target message; the extraction module 403 is used to extract the first N first bytes from the target message, where N is the first preset byte length; the determination module 402 is also used to determine the hash value of the first N first bytes to obtain the target hash value corresponding to the variable-length ID in the target message; the query module 404 is used to query the ID query tree and the prefix subset ID corresponding to each preset hash value according to the target hash value to obtain the fuzzy query result corresponding to the variable-length ID in the target message.

[0130] In this embodiment, the query module 404 is further configured to:

[0131] Based on the target hash value, the preset hash value corresponding to the first byte length group in the ID query tree is queried to obtain the first query result;

[0132] When the first query result is that the target hash value and the preset hash value corresponding to the first byte length group are successfully matched, if the character corresponding to the variable-length ID remaining bytes in the target message is not found in the ID query tree, it is determined whether the target hash value corresponds to the prefix subset ID.

[0133] When the target hash value corresponds to the prefix subset ID, the prefix subset ID corresponding to the target hash value is determined as the fuzzy query result corresponding to the variable-length ID in the target message.

[0134] In this embodiment, the query module 404 is further configured to:

[0135] When the first query result is that the target hash value fails to match the preset hash value corresponding to the first byte length group, or when the target hash value does not correspond to the prefix subset ID, if the first byte length group is not the smallest preset byte length group among the multiple preset byte length groups, a second byte length group is determined from the multiple preset byte length groups, the second byte length group is smaller than the first byte length group and the second byte length group is adjacent to the first byte length group;

[0136] Determine the second preset byte length corresponding to the second byte length group. The second preset byte length represents the byte length corresponding to the hash value determined by the variable-length ID in the target message.

[0137] Using the second byte length group as the first byte length group and the second preset byte length as the first preset byte length, the step of extracting the first N first bytes from the target message is executed to obtain the fuzzy query result corresponding to the variable-length ID in the target message.

[0138] In this embodiment, the establishment module 401 is also used for:

[0139] Obtain the preset ID set and multiple preset byte length groups;

[0140] Determine the length of the second target byte corresponding to each preset ID in the preset ID set;

[0141] For each preset ID in the preset ID set, based on the second target byte length corresponding to the preset ID, the third byte length group to which the preset ID belongs is determined from multiple preset byte length groups, and the third preset byte length corresponding to the third byte length group is determined. The third preset byte length represents the byte length corresponding to the preset ID determined by hash value.

[0142] Extract the first M second bytes from the preset ID, where M is the length of the third preset byte;

[0143] Determine the hash values ​​of the first M bytes of the second byte to obtain the preset hash value corresponding to the preset ID;

[0144] Based on the preset hash value corresponding to each preset ID in the preset ID set and the character corresponding to the remaining bytes of each preset ID, the ID query tree is established, and when the preset hash value is set with the prefix subset ID, the preset hash value is associated with the prefix subset ID.

[0145] The ID fuzzy query device provided in this embodiment further includes a receiving module, which is used for:

[0146] When the first service server receives the target message, the first service server determines the source service server IP and the destination service server IP corresponding to the target message;

[0147] The first service server determines whether the source service server IP or the destination service server IP is in a preset service server IP set, and each preset service server IP in the preset service server IP set supports ID services of variable length.

[0148] When the source service server IP is in the preset service server IP set or the destination service server IP is in the preset service server IP set, the first service server determines the target packet as the target packet to be queried;

[0149] The first service server sends the target message to the query server, so that the query server receives the target message to be queried.

[0150] In this embodiment, the first service server is further configured to:

[0151] When the first service server receives the target message, it determines whether the target message is a UDP message;

[0152] When the target message is the UDP message, if the target message is in the local variable-length ID service flow table and the target message is a variable-length ID service protocol message, the first service server determines the source service server IP and the destination service server IP corresponding to the target message; or,

[0153] When the target message is the UDP message, if the target message is not in the local variable-length ID service flow table, the first service server determines the source service server IP and the destination service server IP corresponding to the target message.

[0154] In this embodiment, the fuzzy query result includes the target ID. The ID fuzzy query device provided in this embodiment also includes a sending module, which is used for:

[0155] After obtaining the fuzzy query result corresponding to the variable-length ID in the target message, the second business server corresponding to the target ID is determined, and the second business server is the business server that registered the target ID;

[0156] The target ID and the IP address of the second service server are sent to the first service server, so that the first service server sends the target message and the target ID to the second service server.

[0157] This embodiment provides an ID fuzzy query device that establishes an ID query tree based on the preset hash values ​​of each preset ID in a preset ID set corresponding to each preset byte length group. A prefix subset ID is set for each preset hash value. When a target message carrying an ID of variable length is received, the hash value of the variable-length ID in the target message can be determined based on the preset byte length corresponding to the preset byte length group to which the variable-length ID belongs. Then, using the determined hash value of the variable-length ID, the ID query tree and the prefix subset ID corresponding to each preset hash value are queried to obtain the final ID in the target message. Thus, when querying a variable-length ID in a target message, it is not necessary to match each character in the target message one by one, improving the efficiency of variable-length ID queries.

[0158] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 5 The illustrated electronic device 500 includes at least one processor 501, a memory 502, at least one network interface 504, and other user interfaces 503. The various components in the electronic device 500 are coupled together via a bus system 505. It is understood that the bus system 505 is used to implement communication between these components. In addition to a data bus, the bus system 505 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 5 The general designated all buses as Bus System 505.

[0159] The user interface 503 may include a display, keyboard, or clicking device (e.g., mouse, trackball, touchpad, or touchscreen).

[0160] It is understood that the memory 502 in the embodiments of the present invention can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 502 described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0161] In some implementations, memory 502 stores elements, executable units or data structures, or subsets thereof, or extended sets thereof: operating system 5021 and application program 5022.

[0162] The operating system 5021 includes various system programs, such as the framework layer, core library layer, and driver layer, used to implement various basic business functions and handle hardware-based tasks. The application program 5022 includes various applications, such as a media player and a browser, used to implement various application functions. The program implementing the method of this embodiment can be included in the application program 5022.

[0163] In this embodiment of the invention, the processor 501 executes the method steps provided in each method embodiment by calling the program or instructions stored in the memory 502, specifically the program or instructions stored in the application program 5022.

[0164] The methods disclosed in the above embodiments of the present invention can be applied to processor 501, or implemented by processor 501. Processor 501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 501 or by instructions in the form of software. The processor 601 mentioned above may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present invention can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software units in the decoding processor. The software units may be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 502. Processor 501 reads the information in memory 502 and, in conjunction with its hardware, completes the steps of the above method.

[0165] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or combinations thereof.

[0166] For software implementation, the techniques described herein can be implemented by units that perform the functions described herein. The software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.

[0167] The electronic device provided in this embodiment may be as follows: Figure 5 The electronic device shown can perform the following: Figures 1-3 All steps of the ID fuzzy search method, thus achieving Figures 1-3 For details on the technical effects of the ID fuzzy search method shown, please refer to [link / reference]. Figures 1-3 The relevant descriptions are presented concisely and will not be elaborated upon here.

[0168] This invention also provides a storage medium (computer-readable storage medium). This storage medium stores one or more programs. The storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, hard disk, or solid-state drive; the memory may also include combinations of the above types of memory.

[0169] When one or more programs in the storage medium can be executed by one or more processors to implement the ID fuzzy query method executed on the ID fuzzy query device side as described above.

[0170] The processor is used to execute the ID fuzzy query program stored in the memory to implement the following steps of the ID fuzzy query method executed on the ID fuzzy query device side.

[0171] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0172] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented in hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0173] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for fuzzy ID lookup, characterized in that, Applied to a query server, the method includes: An ID lookup tree is established, which is constructed by the preset hash values ​​corresponding to each preset ID in the preset ID set. The preset hash values ​​are determined by the preset byte length group to which the preset ID belongs, and the preset hash values ​​correspond to a prefix subset ID. Upon receiving the target message to be queried, determine the length of the first target byte corresponding to the variable-length ID in the target message; The first byte length group to which the first target byte length belongs is determined from a plurality of preset byte length groups, and the first preset byte length corresponding to the first byte length group is determined. The first preset byte length represents the byte length corresponding to the hash value of the variable-length ID in the target message. Extract the first N bytes from the target message, where N is the length of the first preset byte; Determine the hash values ​​of the first N bytes of the first byte to obtain the target hash value corresponding to the variable-length ID in the target message; Based on the target hash value, the ID query tree and the prefix subset IDs corresponding to each preset hash value are queried to obtain fuzzy query results corresponding to the variable-length IDs in the target message.

2. The method according to claim 1, characterized in that, The step of querying the ID query tree and the prefix subset IDs corresponding to each preset hash value according to the target hash value to obtain fuzzy query results corresponding to variable-length IDs in the target message includes: Based on the target hash value, the preset hash value corresponding to the first byte length group in the ID query tree is queried to obtain the first query result; When the first query result is that the target hash value and the preset hash value corresponding to the first byte length group are successfully matched, if the character corresponding to the variable-length ID remaining bytes in the target message is not found in the ID query tree, it is determined whether the target hash value corresponds to the prefix subset ID. When the target hash value corresponds to the prefix subset ID, the prefix subset ID corresponding to the target hash value is determined as the fuzzy query result corresponding to the variable-length ID in the target message.

3. The method according to claim 2, characterized in that, After obtaining the first query result, the method further includes: When the first query result is that the target hash value fails to match the preset hash value corresponding to the first byte length group, or when the target hash value does not correspond to the prefix subset ID, if the first byte length group is not the smallest preset byte length group among the multiple preset byte length groups, a second byte length group is determined from the multiple preset byte length groups, the second byte length group is smaller than the first byte length group and the second byte length group is adjacent to the first byte length group; Determine the second preset byte length corresponding to the second byte length group. The second preset byte length represents the byte length corresponding to the hash value determined by the variable-length ID in the target message. Using the second byte length group as the first byte length group and the second preset byte length as the first preset byte length, the step of extracting the first N first bytes from the target message is executed to obtain the fuzzy query result corresponding to the variable-length ID in the target message.

4. The method according to claim 1, characterized in that, The ID query tree is constructed in the following way: Obtain the preset ID set and multiple preset byte length groups; Determine the length of the second target byte corresponding to each preset ID in the preset ID set; For each preset ID in the preset ID set, based on the second target byte length corresponding to the preset ID, the third byte length group to which the preset ID belongs is determined from multiple preset byte length groups, and the third preset byte length corresponding to the third byte length group is determined. The third preset byte length represents the byte length corresponding to the preset ID determined by hash value. Extract the first M second bytes from the preset ID, where M is the length of the third preset byte; Determine the hash values ​​of the first M bytes of the second byte to obtain the preset hash value corresponding to the preset ID; Based on the preset hash value corresponding to each preset ID in the preset ID set and the character corresponding to the remaining bytes of each preset ID, the ID query tree is established, and when the preset hash value is set with the prefix subset ID, the preset hash value is associated with the prefix subset ID.

5. The method according to claim 1, characterized in that, The received target message to be queried includes: When the first service server receives the target message, the first service server determines the source service server IP and the destination service server IP corresponding to the target message; The first service server determines whether the source service server IP or the destination service server IP is in a preset service server IP set, and each preset service server IP in the preset service server IP set supports ID services of variable length. When the source service server IP is in the preset service server IP set or the destination service server IP is in the preset service server IP set, the first service server determines the target packet as the target packet to be queried; The first service server sends the target message to the query server, so that the query server receives the target message to be queried.

6. The method according to claim 5, characterized in that, When the first service server receives the target message, the first service server determines the source service server IP and the destination service server IP corresponding to the target message, including: When the first service server receives the target message, it determines whether the target message is a UDP message; When the target message is the UDP message, if the target message is in the local variable-length ID service flow table and the target message is a variable-length ID service protocol message, the first service server determines the source service server IP and the destination service server IP corresponding to the target message; or, When the target message is the UDP message, if the target message is not in the local variable-length ID service flow table, the first service server determines the source service server IP and the destination service server IP corresponding to the target message.

7. The method according to claim 5, characterized in that, The fuzzy query results include the target ID; After obtaining the fuzzy query result corresponding to the variable-length ID in the target message, the method further includes: Determine the second business server corresponding to the target ID, where the second business server is the business server that registered the target ID; The target ID and the IP address of the second service server are sent to the first service server, so that the first service server sends the target message and the target ID to the second service server.

8. An ID fuzzy query device, characterized in that, include: A module is established to build an ID query tree. The ID query tree is built from the preset hash values ​​corresponding to each preset ID in the preset ID set. The preset hash values ​​are determined by the preset byte length group to which the preset ID belongs, and the preset hash values ​​correspond to a prefix subset ID. The determination module is used to determine the length of the first target byte corresponding to the variable-length ID in the target message when the target message to be queried is received; The determining module is further configured to determine the first byte length group to which the first target byte length belongs from the plurality of preset byte length groups and to determine the first preset byte length corresponding to the first byte length group, wherein the first preset byte length represents the byte length corresponding to the hash value determined by the variable-length ID in the target message; The extraction module is used to extract the first N bytes from the target message, where N is the length of the first preset byte. The determining module is further configured to determine the hash values ​​of the first N bytes of the first byte to obtain the target hash value corresponding to the variable-length ID in the target message; The query module is used to query the ID query tree and the prefix subset IDs corresponding to each preset hash value based on the target hash value, so as to obtain the fuzzy query results corresponding to the variable-length IDs in the target message.

9. An electronic device, characterized in that, include: A processor and a memory, the processor being configured to execute an ID fuzzy query program stored in the memory to implement the ID fuzzy query method according to any one of claims 1 to 7.

10. A storage medium, characterized in that, The storage medium stores one or more programs, which can be executed by one or more processors to implement the ID fuzzy query method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Information query method and device based on face recognition, computer equipment and medium

    CN111860313A

  • Index establishment method and device and storage medium

    CN112667636A