Data query method and apparatus, electronic device, and storage medium

By dividing the data into consecutive characters including the last character of the data and performing prefix search based on the dictionary tree, the problems of large storage and processing resources and low query efficiency in infix queries when using massive data are solved, and efficient data search is achieved.

WO2025196522A1PCT designated stage Publication Date: 2025-09-25CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD

Patent Information

Application Number
PCT/IB2025/051312
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-03-22
Filing Date
2025-02-07
Publication Date
2025-09-25

AI Technical Summary

Technical Problem

In the existing technology, when facing massive data, infix query results in large storage resource occupation, large processing resource occupation and low query efficiency, which makes it difficult to meet query needs.

Method used

Using prefix search, the data is divided into consecutive characters including the last character of the data for word segmentation, and the target data set is constructed based on the word segmentation. Prefix search is performed through the dictionary tree to obtain query results that match the search input content.

Benefits of technology

It achieves high search efficiency when searching massive data, reduces storage and processing resources, and improves query speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure IB2025051312_25092025_PF_FP_ABST
    Figure IB2025051312_25092025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present disclosure are a data query method and apparatus, an electronic device, and a storage medium, which belong to the technical field of computers. The method comprises: in response to a received data query request, acquiring input search content; performing prefix searching in a target data set on the basis of the input search content, and acquiring a target segmented word corresponding to a target node path conforming to the input search content, the target data set consisting of node paths corresponding to different segmented words of data, and the segmented word being a character string from any bit to the last bit of source data; and outputting the source data corresponding to the target segmented word as a query result. The embodiments of the present disclosure enables the search efficiency to be high even during searching in massive data.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] TECHNICAL FIELD The present disclosure belongs to the field of computer technology, and particularly relates to a data query method, device, electronic device, and storage medium. Background: With the development of the data age, various types of data are continuously growing, both in terms of type and volume, gradually constituting big data. Data development and analysis engineers tend to use fuzzy queries or wildcard queries in data retrieval queries. These two query methods are also known as infix queries. In related art, infix queries use user-entered search characters to traverse a data table to retrieve the data the user requires. While this method can ensure search accuracy, the data processing and storage required for infix searches increase exponentially with the amount of data. Therefore, faced with the current massive data volume, infix searches consume a significant amount of storage and processing resources. Furthermore, query efficiency decreases as the amount of data increases, making it difficult to meet the query requirements of massive data. SUMMARY The present disclosure provides a data query method, device, electronic device, and storage medium. Some embodiments of the present disclosure provide a data query method, comprising: obtaining search input content in response to a received data query request; performing a prefix search in a target dataset based on the search input content to obtain a target segmentation corresponding to a target node path matching the search input content, wherein the target dataset comprises node paths corresponding to different segmentations of the data contained therein, and the segmentation is a string from any digit to the end of the source data; and outputting source data corresponding to the target segmentation as a query result. Some embodiments of the present disclosure provide a data query device, comprising: an input module configured to obtain search input content in response to a received data query request; a query module configured to perform a prefix search in the target dataset based on the search input content to obtain a target segmentation corresponding to a target node path matching the search input content, wherein the target dataset comprises node paths corresponding to different segmentations of the data contained therein, and the segmentation is a string from any digit to the end of the source data; and an output module configured to output the source data corresponding to the target segmentation as a query result. Some embodiments of the present disclosure provide a computing and processing device, comprising: a memory storing computer-readable code; and one or more processors, wherein when the computer-readable code is executed by the one or more processors, the computing and processing device executes the data query method described above.Some embodiments of the present disclosure provide a computer program comprising computer-readable code. When executed on a computing processing device, the computer-readable code causes the computing processing device to execute the data query method described above. Some embodiments of the present disclosure provide a non-transitory computer-readable medium storing the data query method described above. The data query method, apparatus, electronic device, and storage medium provided in some embodiments of the present disclosure perform word segmentation by dividing data into consecutive characters including the last character of the data, and construct a target dataset based on the word segmentation. This ensures that the target dataset contains word segments that may be found in a prefix search of the data. Therefore, when a user queries data, a prefix search can be performed in the target dataset based on the user's search input to obtain query results corresponding to word segments that match the search input, thereby achieving the purpose of searching data in the target dataset. Because the prefix search of the target dataset begins at the node that matches the first character of the search input, the search time is only related to the length of the required search data, and the number of data stored in the target dataset does not affect the search time. This ensures high search efficiency even when searching massive amounts of data. The above description is merely an overview of the technical solutions of the present disclosure. To provide a clearer understanding of the technical solutions of the present disclosure, which can be implemented in accordance with the contents of this description, and to make the above-mentioned and other objectives, features, and advantages of the present disclosure more readily apparent, specific embodiments of the present disclosure are described below. BRIEF DESCRIPTION OF THE DRAWINGS To more clearly illustrate the technical solutions of the embodiments of the present disclosure or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below illustrate some embodiments of the present disclosure. Those skilled in the art can derive other drawings based on these drawings without inventive effort.Figure 1 schematically illustrates a scenario diagram of a data query method provided by some embodiments of the present disclosure; Figure 2 schematically illustrates a flow diagram of a data query method provided by some embodiments of the present disclosure; Figure 3 schematically illustrates one principle schematic diagram of a data query method provided by some embodiments of the present disclosure; Figure 4 schematically illustrates a second principle schematic diagram of a data query method provided by some embodiments of the present disclosure; Figure 5 schematically illustrates a third principle schematic diagram of a data query method provided by some embodiments of the present disclosure; Figure 6 schematically illustrates a fourth principle schematic diagram of a data query method provided by some embodiments of the present disclosure; Figure 7 schematically illustrates a fifth principle schematic diagram of a data query method provided by some embodiments of the present disclosure; Figure 8 schematically illustrates a structural diagram of an inverted index structure provided by some embodiments of the present disclosure; Figure 9 schematically illustrates a logical diagram of a data query method provided by some embodiments of the present disclosure; Figure 10 schematically illustrates a logical diagram of another data query method provided by some embodiments of the present disclosure; Figure 11 schematically illustrates a structural diagram of a data query device provided by some embodiments of the present disclosure; and Figure 12 schematically illustrates a structural diagram of an exemplary device provided by some embodiments of the present disclosure. To further clarify the objectives, technical solutions, and advantages of the embodiments of the present disclosure, the technical solutions of the embodiments of the present disclosure will be described below in detail and in full, in conjunction with the accompanying drawings. It should be noted that the described embodiments represent only a portion of the embodiments of the present disclosure, and are not exhaustive. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present disclosure without inventive effort are within the scope of protection of the present disclosure. It should be noted that all actions for acquiring signals, information, or data in the present disclosure are performed in compliance with the relevant data protection laws and policies of the country in which they are located, and with authorization from the respective device owners. The embodiments of the present disclosure can be applied to application scenarios requiring massive data queries, such as metadata queries, service data queries, and log data queries. The data being queried can be segmented according to the segmentation methods provided in the embodiments of the present disclosure, and the segmented words can then be stored in a data structure with prefix storage characteristics, such as a trie. This prefix storage characteristic refers to the storage of different segmented words and node paths for the stored data. In the data structure, if the previous and current characters are the same, nodes for different segmented words can share the same node. For ease of understanding, the dictionary tree is used as an example for explanation. The dictionary tree is also called a word search tree, prefix tree, or key tree. It is a tree structure and a variant of a hash tree.A tree structure is a data structure in which data elements have a one-to-many tree-like relationship. It is an important type of nonlinear data structure and can represent hierarchical relationships. A trie can be used to store not only letters but also other data such as numbers. A trie consists of a root, subtrees, and leaves. The root is equivalent to the common prefix node in the tree structure, subtrees are equivalent to multiple child nodes in the tree structure, and leaves are equivalent to leaf nodes in the tree structure. Each subtree can also have its own subtrees. In a tree structure, the common prefix node has no predecessor node, while each other node has one and only one predecessor node. Leaf nodes have no successor nodes, while each other node can have one or more successor nodes. A trie includes a common prefix node, which represents the common prefix character of multiple strings. A common prefix can be a single character, multiple consecutive characters, or even empty. Using the common prefix of strings in a trie for search can reduce query time and eliminate comparisons between strings, thereby improving query efficiency. In the subsequent description of the embodiments of the present disclosure, the use of a target dataset will be explained using a trie as an example. However, the target dataset is not limited to a trie and can also be any data structure with the prefix storage and query features described above. Furthermore, to accommodate prefix queries based on the target dataset, namely, searching from the first to the last character of a stored segmented word, the embodiments of the present disclosure provide a segmenter corresponding to a dedicated segmentation method. Specifically, segmented words of varying lengths, including the last character of the data, are extracted from the stored data. This allows prefix searches to locate corresponding segmented words in the target dataset when any portion of the data is used as search input. It will be appreciated that if the segmented words in the target dataset are not continuous strings including the last character of the data, prefix searches may fail to locate corresponding segmented words in the target dataset when the search input consists of continuous characters including the last character, thereby reducing the success rate of prefix searches. After the target dataset is constructed, as shown in FIG1 , the terminal can provide the user with a function page with a search function. The user can enter search input related to the desired query data in the input field of the page. The search input refers to a portion of the query data and can be in the form of characters, text, symbols, etc., without limitation. After entering the search input in the input field, the user clicks the "Search" function control, instructing the terminal to send a data query request containing the search input to the server.The server parses the received data query request and extracts the search input. Based on the search input, it performs a prefix search within the constructed target dataset, also known as a prefix search, to obtain query results that match the user's search input. The server sends the query results to the terminal, which displays concise information about the query results on a query page. This information includes information such as the data volume, the frequency and number of occurrences of the search input in the query results, a brief description of the query results, and the data storage address. The figure shows "Search by Search Input," "Query Result 1 Details," "Query Result 2 Details," "Query Result 3 Details," and "1 2 3 Next Page," though these options are not limited here. Users can instruct the terminal to download the query results from the corresponding storage address by clicking on an option in the query result. The present embodiment performs word segmentation by dividing data into consecutive characters including the last character of the data, and constructs a target dataset based on the word segmentation. This ensures that the target dataset contains the word segmentations that may be found by performing a prefix search on the data. Therefore, when a user queries data, a prefix search can be performed on the target dataset based on the user's search input to obtain query results corresponding to the word segmentations that match the search input, thereby achieving the purpose of searching data in the target dataset. Because the prefix search of the target dataset begins at the node that matches the first character of the search input, the search time is only related to the length of the required search data, and the number of data stored in the target dataset does not affect the search time. This allows for high search efficiency even when searching massive amounts of data. Figure 2 schematically illustrates a flow chart of a data query method provided by the present disclosure. The method includes: Step 101: Receiving search input content in response to a received data query request. It should be noted that the data query request is input by the user when querying, and carries the search input content predetermined by the user. The search input content is data related to the desired search content, usually partial data or keywords in the desired search content. For example, if the full name of the data to be searched is "Metadata", a query can be performed by entering partial data such as "Meta", "data", "tada", etc. as the search input content. Of course, this is only an exemplary description, and the specific setting can be based on actual needs and is not limited here.In the embodiment of the present disclosure, a user can search the database corresponding to the search engine through a search engine in the form of a web page, a mini-program, or a client. The user needs to know the relevant content in the data to be searched in advance, and then input the data query request to the query interface provided by the search engine by inputting the search input content. Step 102: Based on the search input content, a prefix search is performed in the target data set to obtain the target segmentation corresponding to the target node path that matches the search input content, wherein the target data set is composed of node paths corresponding to different segmentations of the data, and the segmentation is a string from any digit to the last digit of the source data. Step 103: The source data corresponding to the target segmentation is output as the query result. In related segmentation methods, such as the ngram segmentation method, a large number of segmentations are usually generated when the stored data is segmented. The number of segmentations can be calculated by the following formula (1): Number of segmentations = n*(n + 1) / 2 (1) Where n represents the length of the string. For example, for the word "DataWorks", 1 gram->ngram will generate the following segmentation:

[0002] 1-gram (single character):

[0003] D , a , t , a , W , o , r , k , s ;

[0004] 2-gram (two consecutive characters):

[0005] 'Da' , 'at' ? 'ta' ? 'aW' ? 'Wo' , 'or' , 'rk' ? 'ks' ;

[0006] 3-gram (three consecutive characters):

[0007] ' Dat ' , ' ata ' , 'taW' , ' aWo ' , ' Wor ' , 'ork' , ' rks ' ;

[0008] 4-gram (four consecutive characters):

[0009] ' Data ' , ' ataW' , ' taWo' , ' aWor ' , 'Work' , ' orks ' ;

[0010] 5-gram (five consecutive characters):

[0011] 'DataW' , ' ataWo' , ' taWor ' , 'aWork' , ' Works ' ;

[0012] 6-gram (six consecutive characters):

[0013] 'DataWo' , ' ataWor ' , 'taWork' , ' aWorks ' ;

[0014] 7-gram (seven consecutive characters):

[0015] ' DataWor ' , 'ataWork' , ' taWorks ' ;

[0016] 8-gram (eight consecutive characters):

[0017] 'DataWork' , ' ataWorks ' ;

[0018] 9-gram (nine consecutive characters): ' DataWorks ' oIt can be seen that a word like "DataWorks" that only contains 9 characters will generate 45 segmented words through the 1 gram -> ngram segmentation method. In actual applications, as the amount of data in the document increases, the number of segmented words generated will also increase exponentially quadratically, which will occupy a large amount of storage resources. Moreover, due to the large number of segmented words, when querying data, if a full table scan is used, it will also occupy a large amount of processing resources and the query efficiency is low. The segmentation method of the dictionary table used in some embodiments of the present disclosure is to extract the string from any character to the last character in the data to obtain the segmented words. The number of segmented words generated is as shown in the following formula (2): Number of segmented words = n - 1 (2) Where n represents the length of the string. u Taking dataworks_datamap^ as an example, this word with a length of 18 characters can be divided into the following 17 participles: dataworks_datamap ; ataworks_datamap ; taworks_datamap ; aworks_datamap ; works_datamap ; orks_datamap ; rks_datamap ; ks_datamap ; s_datamap ; _datamap ; datamap ; atamap : tamap : amap : map : ap : p oIf the 1 gram->ngram tokenization method is adopted, 171 tokens will be generated. Obviously, the tokenizer provided by the present disclosure can greatly reduce the number of tokens generated for the same word. The tokenization complexity of this tokenization method is 0(n), the space complexity is 0(n2), and the time complexity is 0(n), thereby reducing the time required to build the trie and saving the storage space required for the trie. In the tokenization stage of the data in the embodiments of the present disclosure, a dedicated tokenization method is set, and the query method of this tokenization method O in the embodiments of the present disclosure will be explained below. For ease of understanding, the components of the word are described here. Among them, the word usually includes a prefix, an infix, and a suffix. The prefix is a word-forming component in Chinese that is in front of the root. The part in front of the root in a word is the prefix. For example, the "a" in "older brother" and "aunt", and also, in DataWorks, Data and DataWor are prefixes of DataWorks. The infix is an affix placed inside a stem. For example, in DataWorks, ataWork is an infix string of DataWorks. The suffix is a substring from a certain position of the string to the end of the string. That is, for a given string, its suffix is the part of the substring from any position i of the string to the end position of the string. Here, the position i can be from 0 (the first character of the string) to the length of the string minus one. For example, for the string banana, its suffixes can be banana, anana, nana, ana oRelated technologies typically use a wildcard-based infix search to traverse a vocabulary table for data queries. This method compares each word in the vocabulary table with a different number of wildcards before and after each word. This search method increases the number of comparisons required as the amount of data increases. Furthermore, infix search requires obtaining word segments corresponding to various character lengths within the word, which increases the search volume exponentially. When dealing with massive amounts of data, search efficiency is extremely low and significant processing power is consumed. The disclosed embodiment uses a prefix search method based on a trie to perform searches. Specifically, during the prefix search process, the search begins at the first character of the search input. The trie is searched for a target node that matches the first character. If a target node is found, the nodes connected downward to the target node are searched for a target node that matches the second character of the search input. If a target node is found, the nodes connected downward to the target node are searched for a target node that matches the third character of the search input. This process continues until the last character of the search input is found. The target nodes corresponding to the characters in the search input are then found. These target nodes are connected sequentially according to the order of the characters in the search input. Of course, the above is for illustration only. In actual applications, the search input may not necessarily contain three or more characters, but may only contain one or two characters. However, some of the steps in the prefix search method described above can still be used. As long as the trie is searched for each character in the search input during the prefix search process, the search input can be set according to actual needs and is not limited here. For example, referring to FIG3 , a trie is constructed using the four words Ada, Alan, Bob, and Boom. Since Ada and Alan both begin with the letter "A," they share the same node. Similarly, since Bob and Boom share the same first two letters, they share two nodes. The characters in each word are sequentially connected as nodes in the trie. The following describes prefix search methods in some embodiments of the present disclosure. Referring to FIG4 , if the search input is "Ada," the target node corresponding to the first character "A" is first searched sequentially. Then, the target node corresponding to the second character "d" is searched for in the nodes connected to node A. Then, the target node corresponding to the third character "a" is searched for in the nodes connected to node d. In this case, the data corresponding to the target nodes in all strings is Ada. Referring to FIG5 , if the search input is "Boo," the target node corresponding to the first character "B" is first searched sequentially. Then, the target node corresponding to the second character "d" is searched for in the nodes connected to node B. Finally, the target node corresponding to the third character "a" is searched for in the nodes connected to node d.The node searches for the third character "o" in the nodes connected downward. There is only one branch node "m," so the data corresponding to all target nodes found is "Boomo." Furthermore, if the search input is "Bo," it can be understood that the final target node found is "Bob" and "Boom." There are two branch nodes downward, "Bob" and "Boom." In this case, the searched data can be "Bob" and "Boom." Referring to Figure 6, if the search input is "Adc," the target node A corresponding to the first character is searched sequentially. Then, the nodes connected downward by node A are searched for the target node corresponding to the second character "d." Finally, the nodes connected downward by target node d are searched for the target node corresponding to the third character "c." Since target node d only has "a" in its nodes connected downward, and no nodes match the third character "c," the query fails. As can be seen, the time complexity of the prefix search method in some embodiments of the present disclosure is independent of document quantification and is related to the query string length. The time complexity for querying a string of length m is 0(m), where m is the length of the query string. This is because in each query step, we only need to consider the child node corresponding to the current character, without considering other branches. The query process starts from the common prefix node and traverses each character of the query string sequentially. In the worst case, we need to traverse all characters of the string to complete the query, so the time complexity is 0 (m). oThe prefix search method described above has a search count that is directly proportional to the character length of the search input. This is less complex than the infix search method, where the search count is quadratically exponentially proportional to the character length of the search input. As character length increases, the prefix search method employed in some embodiments of the present disclosure exhibits more significant advantages in search performance and processing power. It's important to note that this complexity is independent of the number of other strings stored in the trie. This means that even if a large number of strings are stored in the trie, the time required to search for a single string depends solely on the length of that string, and not on the total size of the trie. This is why the trie is so efficient, particularly for operations like string search and auto-completion. Furthermore, if multiple paths matching the sequence to be processed are found in the trie, the path with the highest matching degree among the multiple paths is determined as the search result for the sequence to be processed. The matching degree can be the degree of consistency between a path and the sequence to be processed, and can be calculated using a variety of specific calculation methods. For example, the length ratio of the sequence to be processed in each path can be calculated, and the matching degree can be expressed as the length ratio. Alternatively, the number of characters that differ between the sequence to be processed and each path can be used to express the matching degree. In one exemplary embodiment, the length of each path after filtering out special characters can also be used as the matching degree. The path with the highest matching degree among multiple paths can be the longest path after filtering out special characters. This path has the most text characters that match the sequence to be processed and generally has the highest matching degree. By filtering the final search results based on the matching degree described above, the precise search results can be identified from the approximate results and can be considered the desired search results, thereby further improving the accuracy of the statement search. It is worth noting that the word segmentation method used in the embodiments of the present disclosure ensures that the word segmentation method used in the dictionary tree contains all possible word segmentations that can be found in a prefix search of the data. Of course, the word segmentations in the dictionary tree can also include word segmentations obtained by other word segmentation methods, which is not limited here. If the word segmentation method in the embodiments of the present disclosure is not used to segment the data, it is possible that certain search inputs may not be found in the dictionary tree through prefix search. Taking the word "Bad" as an example, the word segmentation method provided by the embodiments of the present disclosure can generate the following word segments: Bad, ad, d. The user can enter search inputs such as B, a, d, Ba, ad, Bad. It can be seen that the prefix search method described above can find word segments whose first character matches the first character of the search input in the generated word segments.However, if 2-gram segmentation is used, the generated segmented words are Ba and ad. If the user enters the search input d, no segmented word with the first character matching d can be found in these two segmented words, and the data cannot be found. Of course, the 1-gram to n-gram segmentation method can ensure that the dictionary tree contains all possible segmented words for the data, but the number of segmented words generated by this method will increase exponentially with the amount of data, which is obviously not suitable for querying massive data. The disclosed embodiment performs word segmentation by dividing data into consecutive characters, including the last character of the data, and constructs a dictionary tree based on the word segmentation. This dictionary tree contains possible word segmentations that can be found through a prefix search of the data. Therefore, when a user queries data, a prefix search can be performed in the dictionary tree based on the user's search input to obtain query results corresponding to word segmentations that match the search input, thereby achieving the purpose of data search through the dictionary tree. Because the prefix search in the dictionary tree begins at the node that matches the first character of the search input, the search time is only related to the length of the search data required, and the number of data stored in the dictionary tree does not affect the search time. This ensures high search efficiency even when searching massive amounts of data. Optionally, step 102 includes: step 1021, using the first character of the search input as the target character, and searching for a target node matching the target character among the nodes connected downward from the common prefix node of the target dataset. In step 1022, if a character exists after the target character, the next character after the target character is used as the target character, and nodes connected to the target node are searched for nodes matching the target character as the target node. In step 1023, if no character exists after the target character, a target segmentation corresponding to the target node path that includes the searched target node is obtained. In the disclosed embodiment, since the data in the trie is sequentially connected according to the order of data content, the search process also requires searching the trie sequentially according to the order of search input content. Specifically, if each node in the trie represents a character, the search input content is also searched sequentially on a character-by-character basis. First, the first character is used as the target character according to the order of arrangement, and nodes connected downward from a common prefix node in the trie are searched for target nodes matching the target character. It should be noted that this common prefix node is empty, so that for the first character of each search input content, the search can be performed downward from this common prefix node.If a matching node is found using the target character among the nodes connected downward from the current target node, the searched node is used as the new target node, and the character following the target character in the search input is used as the new target character. The search continues until no character following the target character exists. In this way, the target node found in the historical search matches both the content and order of the characters in the search input, ensuring the accuracy of the data query. Optionally, step 1021 includes: step 10211, obtaining a weight value corresponding to the common prefix node. step 10212, if the weight value matches a weight threshold, determining that a character exists after the target character. step 10213, if the weight value does not match the weight threshold, determining that a character does not exist after the target character. In the disclosed embodiments, nodes in the trie that have no child nodes below them are generally referred to as leaf nodes. Each child node in the trie includes a corresponding character and a weight. The character is the data contained in the node, and the weight reflects the status of the child nodes contained in the node. If there are characters following the character of a child node, it indicates that the node still has child nodes and is not the final target node. In this case, a weight value can be used to identify this child node. For example, the weight of the node can be null, or the weight value can be represented by a preset threshold indicating a null value. While traversing the child nodes corresponding to the direct prefix node, the server obtains the weight of the current character node being traversed. If the weight of the character node indicates that there are still characters following the character node, it indicates that the character node also has corresponding child nodes. The server then continues traversing the next node after the character node until a leaf node with no child nodes is reached as the last character, completing the search path. If the target character does not have a corresponding target node in the trie, there are no search results in the trie, and the server does not return search results to the terminal. If a corresponding character node is found in the trie for the target character, but there are no child nodes other than leaf nodes under the character node, there are no search results for the target character in the trie, and the server does not return search results to the terminal. In one embodiment, the character strings and weights corresponding to the traversed multiple child nodes can be obtained. The child nodes corresponding to the direct prefix node in the target search subtree are traversed according to the search path. The weight of the current character node is obtained. When the weight of the character node is empty, the next node of the character node is traversed. When the leaf node including the last character is traversed, the weight of the leaf node is obtained. The character string corresponding to the leaf node and the weight of the string are determined according to the search path.Each node in the dictionary trie stores a corresponding character and a weight. The leaf nodes of the dictionary trie store the last character and the weight of the string in the path corresponding to the leaf node. After receiving the target character input from the terminal, the server searches the dictionary trie for the corresponding character based on the character sequence of the target character, matches the corresponding character node, determines the corresponding character node as the common prefix node, and determines the direct prefix node as the search common prefix node. The search common prefix node can be a subtree common prefix node. The server then uses the multiple child nodes corresponding to the direct prefix node as the target search subtree. The server then traverses the target search subtree based on the search path. Specifically, the server determines a search path in the target search subtree based on the common prefix nodes and the direct prefix nodes. The server can use the entire common prefix node as the search common prefix node of the target search subtree, or it can use the direct prefix node as the search common prefix node of the target search subtree. The server then searches for the corresponding multiple child nodes based on the search path, starting from the search common prefix node of the target search subtree. The server then obtains the weights stored in the leaf nodes. Based on the search path, the server can effectively determine the string corresponding to the leaf node in the search path and the weight of the string. The server generates a string set using the strings of the child nodes traversed by each search path. This string set includes multiple strings corresponding to the target character, along with the weight of each string. This allows the server to quickly and efficiently search the trie for the string corresponding to the target character. Specifically, after receiving search input from a terminal, the server searches the trie for the corresponding character node based on the search input. If the character node includes multiple child nodes, the character node corresponding to the search input may be a common prefix node. The last character node of the character node corresponding to the search input may be determined as a direct prefix node. A direct prefix node may be a predecessor node in the tree structure. A common prefix node may include multiple character nodes or just one character node. A direct prefix node may be just one node. The server then traverses the child node sequence corresponding to the direct prefix node based on the character node, extracts the string corresponding to the child node sequence from the trie, and obtains the string's weight and weight from the node corresponding to the string. This allows the server to quickly retrieve the string and weight corresponding to the search input from the trie. For example, if the search input is "metadata", the character sequence of the search input can be: "meta" -> "data" -> "data".The server then searches for the character node corresponding to the character sequence in the trie, and uses the character nodes corresponding to "meta", "data" as the common prefix nodes, and determines "meta" as the current direct prefix node. If the search input content is "meta", then "meta" is both the common prefix node and the direct prefix node. The child nodes corresponding to this node can include multiple child nodes such as "quantity", "value", etc. The server traverses the multiple child node sequences corresponding to this direct prefix node in the trie and obtains the strings and weights corresponding to the multiple child node sequences. Among them, the string is formed by concatenating the characters corresponding to each child node of the byte sequence in the order of the character sequence. The string can include multiple characters or only one character. For example, under the common prefix node of "metadata", there can be multiple strings such as "modify", "extract", "query", etc., and each string stores a corresponding weight. In the embodiments of the present disclosure, each single character of the search input content is used as the basis for each search, so as to sequentially query the corresponding target nodes in the trie. Since the accuracy of a single character is relatively high, it ensures the accuracy of data query. In the embodiments of the present disclosure, if the target nodes corresponding to each character in the target character are all queried, that is, when there are no remaining characters after the next character of the currently queried target character, it is determined that the query ends, and the data associated with all the queried target nodes can be output as the query structure. It should be noted that if there are no other nodes connected under the last target node among all the queried target nodes, then there is only one piece of data queried, because there are no branch nodes after the target node, so the queried target node can be mapped to one piece of data. However, if there are still multiple nodes connected under the last queried target node, that is, the target node that matches the last character of the search input data, then there will also be multiple pieces of data corresponding to the queried target nodes. The specific number of data queried depends on how many complete branches there are in total extending downward from the last queried target node, that is, how many paths extend downward to nodes without further nodes. Referring to FIG. 4, if the search input content is "Bo", then the target node o is the last queried target node, and this target node can extend downward to two complete paths of "ob" and "oom", so there are two pieces of data queried. If the search input content is "boo", then the last queried target node can only extend downward to "m", so there is only one piece of data queried. In the embodiments of the present disclosure, after querying each character in the search input content, all the target data corresponding to the queried target nodes are output as the query result, as much as possible ensuring that the searched query result can match the search input content, and improving the accuracy of data query.Optionally, after step 1023, the method further includes: step 1024, outputting a data-not-found notification when no target node matching the target character is found in the target dataset. In this embodiment of the present disclosure, if, during the query process, no target node is found in the dictionary tree for a target character, it can be determined that no data corresponding to the search input exists in the existing data, and a notification indicating that no data was found can be output to the user. The user can review and adjust the search input and retry the search. By outputting a notification to the user when no target node matching the character in the search input is found, the present embodiment allows the user to view search results in a timely manner. Optionally, after step 1023, the method further includes: outputting a data-not-found notification when no target node matching the target character is found in the target dataset. In embodiments of the present disclosure, to ensure query success, if a target character cannot find a target node in the dictionary tree, data corresponding to all target nodes found can be output as search results. Although this output query result may not necessarily match the search input, it can ensure that the user can find data during each search. Optionally, the data is stored in the target dataset in the following manner: Step 201: Obtain a string from any character to the last character in the data to be stored as a word segment for the data to be stored. Step 202: Query the target dataset's common prefix nodes, based on the character order of the word segment, for nodes connected to the nodes that match the character in the word segment. Step 203: If no node matching the character in the word segment is found, create sequentially connected nodes for the unfinished characters in the word segment below the last found node. In embodiments of the present disclosure, the data is first segmented on a character-by-character basis using the word segmenter provided in some embodiments of the present disclosure. The number of word segments is n-1, where n represents the length of the data string. The initial trie can be any existing trie, or an empty trie (one with no characters populated). The word order in the data can be sorted from front to back, and the path to the first word is searched in the initial trie. If the path to the first word is found, the trie remains unchanged and the search continues for the second word. If the path to the first word is not found, the path to the first word is inserted into the trie, resulting in an updated trie, and the search continues for the second word based on this updated trie.In this way, new paths are added to the trie one by one until the last word is processed, resulting in the final trie containing the paths for all word segments. For example, if there are N word segments, the final trie is obtained after traversing all N word segments. To find the path for a word segment, each character in the data can be searched layer by layer in the trie. Specifically, the first character of the word segment can be searched at any level of the trie. If found, the second character of the word segment is searched for in the node connected to the node corresponding to the character in the next level, and so on. The nodes corresponding to each found character are connected to form a path in the trie. This path can also extend to nodes corresponding to several characters on both sides of the trie, so that the word segment string is a substring of the complete path. In one exemplary embodiment, an exact match between a segmented word and a path can be specified. Specifically, the first character of a segmented word must be located at the first node of the path, which is the first level of the trie, and the last character of a segmented word must be located at the last node of the path, which is a leaf node in the trie. During the layer-by-layer search process, if any character in a segmented word cannot be found, the search is considered a failure, and the segmented word is inserted into the trie as a new path. Specifically, the characters in the segmented word are sequentially concatenated to form a string, which is then inserted into the trie so that the first character of the segmented word is located at the first level, the second character at the second level, and so on, until the last character of the segmented word. In one exemplary embodiment, an empty trie is used as the initial trie. Massive data from a specific scenario, such as metadata or log data, is used as storage data and converted into segmented words. A specific scenario-specific trie can be constructed from scratch, where the first path in the trie is the path of the first segmented word. For example, referring to FIG7 , a word "works" is segmented and stored in a trie, where "works" can be divided into "works," "orks," "rks," "ks," and "s," each of which generates five complete node paths in the trie. By utilizing a trie data structure for data storage, the disclosed embodiment not only reduces the storage space required for data storage and the number of generated word segments, but also minimizes the number of searches required during subsequent data queries, thereby improving data query efficiency. Optionally, step 103 includes the following: Step 301: When the target word segment exists in the dictionary, query an inverted file for a target document ID containing the target word segment. The inverted file includes document IDs corresponding to different word segments, and the dictionary includes the word segments in the stored data.Step 302: Output the source data corresponding to the target document ID as the query result. In the disclosed embodiment, an inverted index is an index data structure used to store the presence of each word in a document collection, facilitating fast full-text searches. Its key concept is to reverse-map document content to the document's location. For each word, the index stores a list of all documents containing that word. An inverted index typically consists of two main components: a dictionary and an inverted file. The dictionary contains all words that appear in the document, which can be word segmentations in the disclosed embodiment. The dictionary is typically stored in a tree structure or hash table for fast search. An inverted file (Postings List) is each word in the dictionary. The inverted file contains an inverted list (also called an inverted linked list), which records the IDs of all documents containing the word, and sometimes also includes information such as the position and frequency of the word in the document. This information can be used as descriptive information and displayed when displaying query results to users, so that users can intuitively understand the various index parameters of the query results. For example, referring to Figure 8, a mapping method for the inverted index of the word "dataworks_datamap" is shown. First, the dictionary of the inverted index stores all the word segments. According to the segmentation method used in the embodiment of the present disclosure, the character length of the word is 18, so the word can be divided into 17 segments. Then, each segment is stored with a corresponding document ID in the inverted file. For example, the document ID corresponding to the segmentation word dataworks_datamap is "docdl", the document ID corresponding to ataworks_datamap is "docdl", and the document ID "docdl The corresponding data is dataworks_datamap. oIt's worth noting that this is merely an example description. Each word segment in the word corresponds to only one document. If the search input can retrieve multiple complete paths consisting of a target node, then multiple document IDs can be found for each segment. The document ID mapping relationship in the inverted index can be configured based on actual needs and is not limited here. Specifically, with the inverted index, the search engine doesn't need to search the data directly. Instead, it stores the document IDs corresponding to the corresponding data in the nodes of the dictionary tree. After finding all target nodes based on the search input, the search engine searches the dictionary for the corresponding target document ID based on one or more target words corresponding to the target node. The target document's storage path, storage format, data size, and other information are then retrieved based on the target document ID. This information can be displayed as a query result to the user, who can then click on the corresponding storage path to retrieve the target document. Specifically, during the inverted index search, the segment corresponding to the target node can be used as search input to generate a search request. Based on the search data set, a search expression is generated, and a search is performed based on this search expression. A search expression generally consists of search data and various logical operators. The search data can be the segmentation corresponding to the target node. Specifically, a search expression is a computer-recognizable and executable search command formula formed by connecting logical relationships, positional relationships, and other relationships between the search data using various operators specified by the search system. Optionally, the inverted index used in the embodiments of the present disclosure can be a two-level inverted index consisting of a primary inverted index and a secondary inverted index for searching resource files. The primary inverted index is a correspondence between the identifiers of a segmentation set and the identifiers of data documents. Segments in the same data document can be stored in the same segmentation set. The secondary inverted index includes the correspondence between segmentations and segmentation set identifiers. After generating a search data set based on a search request, the secondary inverted index can be used to quickly determine the identifier of the target segmentation set containing the segmentation corresponding to the target node. The identifier of the target segmentation set is then used to determine the document ID of the data document corresponding to the identifier of the target segmentation set from the primary inverted index, thereby obtaining the search results. This resource file search method can eliminate data documents with relatively low relevance to the target segmentation, thereby screening out a smaller number of data documents with a higher degree of match to the target segmentation. The resulting search results are more in line with user needs, significantly improving search accuracy and efficiency. The disclosed embodiment utilizes an inverted index to obtain query results corresponding to the target node for user viewing, eliminating the need to directly search the data. This reduces the amount of data processing required for querying data and improves data query efficiency.Optionally, step 101 includes: when the search input format corresponding to the data query request is in an infix search format, obtaining the search input content in a prefix search format. In embodiments of the present disclosure, considering that redeveloping a search engine that utilizes the prefix search method provided by embodiments of the present disclosure would incur significant development costs, the search input interface can be replaced on the basis of the existing search engine to achieve modification of the existing search engine, thereby reducing the resource investment in search engine development. Specifically, referring to FIG9 , the Prefix word segmenter provided by embodiments of the present disclosure is used. After a user enters search input content through the infix query interface, the search input content is in an infix search format. In this case, the search input content can be converted to a prefix search input format and then input into the prefix query interface to achieve the conversion from an infix search to a prefix search. This allows the existing search engine to be conveniently modified to utilize a data search method provided by some embodiments of the present disclosure. For example, if a user enters a search for the "name" field through "wildcard query" and the search input content is "ata_works", the existing search input content is in the form of:

[0019] {"query" : {

[0020] "wi I dcard" : { it it r name : [

[0021] "va I ue" : ,, *ata_work"}}}} ; After conversion to the format suitable for the "prefix query' ' interface:

[0022] {"query" : {

[0023] "prefix" : { it it r name : t

[0024] "value": "ata_work"}}}}; wherein, "query" indicates that the action indicated by this input is a query action, "wildcard" indicates that the query method is an infix search method, "name" indicates the field to be queried, "value": "*ata_work" indicates that the search input content is ata_works, and "prefix" indicates that the query method is a prefix search method. It can be seen that after the format conversion, except for the content representing the query method being converted from "wildcard" to "prefix", other contents in the query request remain unchanged. Of course, the above format conversion method is only an exemplary description, and the specific format conversion method can be set according to the grammatical rules actually used, which is not limited here. The embodiment of the present disclosure implements the interface corresponding to the data query method provided by the present disclosure by converting the infix search format of the search input content into the infix search format on the basis of the original search engine. This does not require redevelopment of the search engine, and also enables the original search engine to use the data query method provided by the present disclosure, thereby reducing the use cost of the embodiment of the present disclosure. Furthermore, after the data, or text, is segmented using a prefix segmenter (i.e., a longest prefix match segmenter), a field tree can be constructed, and an inverted index can be constructed using the segmented words. The inverted index includes, but is not limited to, the segmented words generated by the prefix segmenter. The specific method for constructing the inverted index can be found in the above description and will not be elaborated upon here. After the prefix query is completed, the document ID and data address corresponding to the queried segmented word can be retrieved from the inverted index. The data corresponding to the document ID can then be retrieved from the data address and provided to the user. Optionally, after step 101, the method further includes: when the character length of the search input is less than a character length threshold, performing a query in the database using an infix search based on the search input. In the disclosed embodiments, prefix search significantly improves efficiency over infix search as the search input length increases. However, when the string is short, there may be a large number of matching documents, resulting in a relatively flat trie and low efficiency. Therefore, when the search input is short, prefix search may be less efficient than infix search. To maximize search efficiency, infix search may be used when the search input length is below a character length threshold to ensure overall data query efficiency. This character length threshold may be set by the system default or by the user, depending on actual needs and is not limited here.Specifically, referring to FIG10 , assuming a character length threshold of 3, Prefix Search represents the prefix search method provided in some embodiments of the present disclosure, while Hash Search represents the infix search method. Before the search begins, it can be determined whether the character length n of the search input is less than 3. If the character length is less than 3, the Hash Search (infix search) method is used for the search. If the character length n is greater than or equal to 3, the Prefix Search (prefix search) method is used for the search. By selecting the infix search method when the character length of the search input is less than the character length threshold, and the prefix search method when the character length is greater than or equal to the character length threshold, the search process can take into account the advantages of both infix and prefix searches for different character lengths, thereby improving data query efficiency. It should be noted that, for simplicity of description, the method embodiments are described as a series of actions. However, those skilled in the art should understand that the embodiments of the present disclosure are not limited by the order of the actions described, as certain steps can be performed in a different order or simultaneously according to the embodiments of the present disclosure. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present disclosure. Figure 11 schematically illustrates the structure of a data query device 40 provided by the present disclosure. The device includes: an input module 401, configured to obtain search input content in response to a received data query request; a query module 402, configured to perform a prefix search in a target dataset based on the search input content, and obtain a target segmentation corresponding to a target node path that matches the search input content, wherein the target dataset is composed of node paths corresponding to different segmentations of the data, and each segmentation is a string from any digit to the last digit of the source data; and an output module 403, configured to output the source data corresponding to the target segmentation as a query result. Optionally, the query module 402 is further configured to: take the first character of the search input content as the target character, and search for a target node that matches the target character among the nodes connected downward to the common prefix node of the target data set; when there is a character after the target character, take the next character of the target character as the target character, and continue to search for a node that matches the target character among the nodes connected to the target node as the target node; and when there is no character after the target character, obtain a target word corresponding to the target node path that includes the searched target node.Optionally, the query module 402 is further configured to: when no target node matching the target character is found in the target data set, output a notification indicating that no data was found. Optionally, the query module 402 is further configured to: when no target node matching the target character is found in the target data set, and a target node has been found, obtain a target word segmentation corresponding to a target node path containing the found target node. Optionally, the query module 402 is further configured to: obtain a weight value corresponding to the common prefix node; when the weight value matches a weight threshold, determine that a character exists after the target character; and when the weight value does not match the weight threshold, determine that no character exists after the target character. Optionally, the query module 402 is further configured to: perform word segmentation processing on the data to be stored to obtain the word segments of the data to be stored; search for nodes that match the characters in the word segments in sequence among the connected nodes in the common prefix node of the target dataset according to the character arrangement order of the word segments; if no node matching the characters in the word segments is found, create sequentially connected nodes for the unfinished characters in the word segments below the last found node. Optionally, the output module 403 is further configured to: if the target word segments exist in the dictionary, search for the target document ID containing the target word segments in an inverted file, the inverted file including document IDs corresponding to different word segments, the dictionary including word segments in the stored data; and output the source data corresponding to the target document ID as the query result. Optionally, the query module 402 is further configured to: if the search input format corresponding to the data query request is an infix search format, obtain the search input content in a prefix search format. Optionally, the query module 402 is further configured to: when the character length of the search input content is less than a character length threshold, perform a query in the database based on the search input content using an infix search method.The disclosed embodiments perform word segmentation by dividing data into consecutive characters, including the last character of the data, and construct a target dataset based on the word segmentation. This ensures that the target dataset contains the word segmentations that may be found in a prefix search of the data. Therefore, when a user queries data, a prefix search can be performed in the target dataset based on the user's search input to obtain query results corresponding to the word segmentations that match the search input, thereby achieving the purpose of searching data in the target dataset. Because the prefix search in the target dataset begins at the node that matches the first character of the search input, the search time is only related to the length of the search data required, and the number of data stored in the target dataset does not affect the search time. This ensures high search efficiency even when searching massive amounts of data. The disclosed embodiments also provide a non-volatile readable storage medium storing one or more modules (programs). When applied to a device, these one or more modules can cause the device to execute the instructions (instructions) of each method step of the disclosed embodiments. Embodiments of the present disclosure provide one or more machine-readable media storing instructions that, when executed by one or more processors, cause an electronic device to perform one or more of the methods described in the aforementioned embodiments. In the embodiments of the present disclosure, the electronic devices include servers, terminal devices, and other devices. The embodiments of the present disclosure can be implemented as devices configured as desired using any appropriate hardware, firmware, software, or any combination thereof. Such devices may include servers (clusters), terminals, and other electronic devices. Figure 12 schematically illustrates an exemplary apparatus 1000 that can be used to implement embodiments described in the present disclosure. For one embodiment, Figure 12 shows an exemplary apparatus 1000 having one or more processors 1002, a control module (chip set) 1004 coupled to at least one of the processor(s) 1002, a memory 1006 coupled to the control module 1004, a non-volatile memory (NVM) / storage device 1008 coupled to the control module 1004, one or more input / output devices 1010 coupled to the control module 1004, and a network interface 1012 coupled to the control module 1004. oProcessor 1002 may include one or more single-core or multi-core processors. Processor 1002 may include any combination of general-purpose processors or specialized processors (e.g., graphics processors, application processors, baseband processors, etc.). In some embodiments, apparatus 1000 can function as a server, terminal, or other device described in the embodiments of this disclosure. In some embodiments, apparatus 1000 may include one or more computer-readable media (e.g., memory 1006 or NVM / storage device 1008) having instructions 1014, and one or more processors 1002 configured to execute instructions 1014 in conjunction with the one or more computer-readable media to implement a module and thereby perform the actions described in this disclosure. o For one embodiment, the control module 1004 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 1002 and / or any suitable device or component in communication with the control module 1004. The control module 1004 may include a memory controller module to provide an interface to the memory 1006. The memory controller module may be a hardware module, a software module, and / or a firmware module. The memory 1006 may be used, for example, to load and store data and / or instructions 1014 for the apparatus 1000. o For one embodiment, memory 1006 may include any suitable volatile memory, such as a suitable DRAM. In some embodiments, memory 1006 may include double data rate type four synchronous dynamic random access memory (DDR4 SDRAM). For one embodiment, control module 1004 may include one or more input / output controllers to provide an interface to NVM / storage device 1008 and (one or more) input / output devices 1010. For example, NVM / storage device 1008 may be used to store data and / or instructions 1014. o NVM / storage 1008 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives (HDDs), one or more compact disk (CD) drives, and / or one or more digital versatile disk (DVD) drives).

[0025] NVM / storage device 1008 may include storage resources that are part of the device on which apparatus 1000 is installed, or it may be accessible to the device without being part of the device. For example, NVM / storage device 1008 may be accessible over a network via input / output device(s) 1010.

[0026] Input / output device(s) 1010 may provide an interface for apparatus 1000 to communicate with any other appropriate device. Input / output device(s) 1010 may include a communication component, an audio component, a sensor component, etc. Network interface 1012 may provide an interface for apparatus 1000 to communicate via one or more networks. Apparatus 1000 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols. For example, apparatus 1000 may access a wireless network based on a communication standard such as WiFi, 2G, 3G, 4G, 5G, etc., or a combination thereof for wireless communication. In one embodiment, at least one of processor(s) 1002 may be packaged together with the logic of one or more controllers (e.g., a memory controller module) of control module 1004. In one embodiment, at least one of processor(s) 1002 may be packaged together with the logic of one or more controllers of control module 1004 to form a system-in-package (SIP). In one embodiment, at least one of the processor(s) 1002 may be integrated with the logic of one or more controllers of the control module 1004 on the same die. In one embodiment, at least one of the processor(s) 1002 may be integrated with the logic of one or more controllers of the control module 1004 on the same die to form a system-on-chip (SoC). In one embodiment, the apparatus 1000 may be, but is not limited to, a terminal device such as a server, a desktop computing device, or a mobile computing device (e.g., a laptop, a handheld computing device, a tablet computer, a netbook, etc.). In one embodiment, the apparatus 1000 may have more or fewer components and / or a different architecture. For example, in some embodiments, the apparatus 1000 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touchscreen display), a non-volatile memory port, multiple antennas, a graphics chip, an application-specific integrated circuit (ASIC), and a speaker. The detection device may employ a main control chip as a processor or control module. Sensor data, location information, and the like may be stored in a memory or NVM / storage device. The sensor group may serve as an input / output device, and the communication interface may include a network interface. The present disclosure also provides an electronic device comprising: a processor; and a memory storing executable code. When the executable code is executed, the processor executes one or more of the methods described in the present disclosure.The present disclosure also provides one or more machine-readable media storing executable code. When executed, the executable code causes a processor to perform one or more methods described in the present disclosure. Since the apparatus embodiments are generally similar to the method embodiments, their description is simplified. For relevant details, refer to the description of the method embodiments. The embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referenced. The present disclosure is described with reference to flowcharts and / or block diagrams of methods, terminal devices (systems), and computer program products according to the present disclosure. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, when executed by the processor of the computer or other programmable data processing terminal device, produce means for implementing the functions specified in one or more flows in the flowchart and / or one or more blocks in the block diagram. These computer program instructions can also be stored in a computer-readable memory capable of directing the computer or other programmable data processing terminal device to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means, which implement the functions specified in one or more flows in the flowchart and / or one or more blocks in the block diagram. These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, causing the computer or other programmable data processing terminal device to execute a series of operational steps to produce a computer-implemented process, such that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more flows in the flowchart and / or one or more blocks in the block diagram. The embodiments of the present disclosure provide a computer program product stored in a storage medium. This program product is executed by at least one processor to implement the various processes of the aforementioned data query method embodiment, achieving the same technical effects. To avoid repetition, further description is omitted here. Although preferred embodiments of the present disclosure have been described, those skilled in the art may make additional changes and modifications to these embodiments once they understand the basic inventive concepts. Therefore, the appended claims are intended to be interpreted as covering the preferred embodiments as well as all changes and modifications that fall within the scope of the embodiments of the present disclosure.Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used solely to distinguish one entity or operation from another, and do not necessarily require or imply any actual relationship or order between these entities or operations. Furthermore, the terms "comprise," "include," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or terminal 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 terminal device. In the absence of further limitations, an element defined by the phrase "comprising a..." does not preclude the presence of additional identical elements in the process, method, article, or terminal device comprising the element. The data processing method, data processing device, electronic device, and storage medium provided by the present disclosure have been described in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present disclosure. The descriptions of the above embodiments are intended only to facilitate understanding of the method and core concepts of the present disclosure. Furthermore, those skilled in the art will appreciate that variations in the specific implementation methods and scope of application are possible based on the concepts of the present disclosure. In summary, the contents of this specification should not be construed as limiting the present disclosure. Industrial Applicability: Word segmentation is performed by dividing data into consecutive characters including the last character of the data, and a target dataset is constructed based on the word segmentation, so that the target dataset contains the word segmentations that may be found in a prefix search of the data. Therefore, when a user queries data, a prefix search can be performed in the target dataset based on the search input content entered by the user to obtain query results corresponding to the word segmentations that match the search input content, thereby achieving the purpose of searching data through the target dataset. Since the prefix search of the target dataset starts from the node that matches the first character of the search input content, the search time is only related to the length of the required search data, and the number of data stored in the target dataset will not affect the search time. Therefore, high search efficiency can be maintained when searching massive amounts of data.

Claims

Claims 1. A data query method, comprising: Responding to the received data query request, obtaining search input content; A prefix search is performed in a target data set based on the search input content to obtain a target word segmentation corresponding to a target node path that matches the search input content, wherein the target data set is composed of node paths corresponding to different word segments of the included data, and the word segmentation is a character string from any digit to the last digit of the source data; and the source data corresponding to the target word segmentation is output as a query result.

2. The method according to claim 1, wherein: The method of performing a prefix search in a target data set based on the search input content to obtain a target word segmentation corresponding to a target node path that matches the search input content includes: taking the first character of the search input content as a target character, and searching for a target node that matches the target character among nodes connected downward to a common prefix node of the target data set; when a character exists after the target character, taking the next character of the target character as a target character, and continuing to search for a node that matches the target character among nodes connected to the target node as a target node; and when no character exists after the target character, obtaining a target word segmentation corresponding to a target node path that includes the queried target node.

3. The method according to claim 2, wherein: The method further includes: when no target node matching the target character is found in the target data set, outputting a notification indicating that no data was found.

4. The method according to claim 2, wherein: The method further includes: if no target node matching the target character is found in the target data set and a target node has been found, obtaining a target word corresponding to a target node path including the found target node.

5. The method according to claim 1, wherein: The data is stored in the target data set in the following manner: performing word segmentation processing on the data to be stored to obtain the word segments of the data to be stored; searching for nodes connected to the common prefix nodes of the target data set in the order of character arrangement of the word segments for nodes that match the characters in the word segments in sequence; when no node that matches the characters in the word segments is found, creating nodes connected in sequence for the unfinished characters in the word segments under the last found node.

6. The method according to claim 2, wherein: The step of searching for a target node that matches the target character among nodes connected downwardly to a common prefix node of the target data set includes: obtaining a weight value corresponding to the common prefix node; When the weight value matches the weight threshold, it is determined that there is a character after the target character; when the weight value does not match the weight threshold, it is determined that there is no character after the target character.

7. The method according to claim 1, wherein: Outputting the source data corresponding to the target segmentation as a query result includes: when the target segmentation exists in a dictionary, searching for a target document ID containing the target segmentation in an inverted file, the inverted file including document IDs corresponding to different segmentations, the dictionary including segmentations in stored data; and outputting the source data corresponding to the target document ID as a query result.

8. The method according to claim 1, wherein: The acquiring the search input content in response to the received data query request includes: acquiring the search input content according to a prefix search format when the search input format corresponding to the data query request is an infix search format.

9. The method according to claim 1, wherein: After obtaining the search input content in response to the received data query request, the method further includes: when the character length of the search input content is less than a character length threshold, querying the database using an infix search method based on the search input content.

10. A data query device, comprising: An input module is configured to obtain search input content in response to a received data query request; The query module is configured to perform a prefix search in the target data set based on the search input content to obtain a target word segmentation corresponding to a target node path that matches the search input content, wherein the target data set is composed of node paths corresponding to different word segments of the data, and the word segmentation is a character string from any digit to the last digit of the source data; the output module is configured to output the source data corresponding to the target word segmentation as a query result.

11. A computing and processing device, comprising: a memory having computer-readable code stored therein; One or more processors, when the computer-readable code is executed by the one or more processors, the computing processing device performs the following method: in response to a received data query request, obtaining search input content; performing a prefix search in a target data set based on the search input content, and obtaining a target word segmentation corresponding to a target node path that matches the search input content, wherein the target data set is composed of node paths corresponding to different word segments of the included data, and the word segmentation is a character string from any digit to the last digit of source data; and outputting the source data corresponding to the target word segmentation as a query result.

12. The computing and processing device according to claim 11, wherein: The computing and processing device The following method is also executed: taking the first character of the search input content as the target character, searching for a target node that matches the target character among the nodes connected downward to the common prefix node of the target data set; when there is a character after the target character, taking the next character of the target character as the target character, and continuing to search for a node that matches the target character among the nodes connected to the target node as the target node; when there is no character after the target character, obtaining a target word corresponding to the target node path that includes the searched target node.

13. The computing and processing device according to claim 12, wherein: The computing and processing device further executes the following method: when no target node matching the target character is found in the target data set, outputting a notification indicating that no data was found.

14. The computing and processing device according to claim 12, wherein: The computing and processing device further executes the following method: if no target node matching the target character is found in the target data set and a target node has been found, obtaining a target word corresponding to a target node path including the found target node.

15. The computing and processing device according to claim 11, wherein: The data is stored in the target data set in the following manner: performing word segmentation processing on the data to be stored to obtain the word segments of the data to be stored; searching for nodes connected to the common prefix nodes of the target data set in the order of character arrangement of the word segments for nodes that match the characters in the word segments in sequence; and when no node that matches the characters in the word segments is found, creating nodes connected in sequence for the unfinished characters in the word segments under the last found node.

16. The computing and processing device according to claim 12, wherein: The computing and processing device further executes the following method: obtaining a weight value corresponding to the common prefix node; determining that a character exists after the target character when the weight value matches a weight threshold; and determining that no character exists after the target character when the weight value does not match the weight threshold.

17. The computing and processing device according to claim 11, wherein: The computing and processing device further executes the following method: when the target word segment exists in the dictionary, searching for a target document ID containing the target word segment in an inverted file, the inverted file including document IDs corresponding to different word segments, the dictionary including: word segments in stored data; and outputting source data corresponding to the target document ID as a query result.

18. The computing and processing device according to claim 11, wherein: The computing and processing device further executes the following method: when the search input format corresponding to the data query request is an infix search format, obtaining the search input content according to a prefix search format.

19. The computing and processing device according to claim 11, wherein: The computing and processing device further executes the following method: when the character length of the search input content is less than a character length threshold, querying a database using an infix search method based on the search input content.

20. A non-transitory computer-readable medium storing a computer program of the data query method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Method for extracting feature word of text

    CN101464898B

  • Intelligent prompt method, module and system for search

    CN103631929A

  • Text fuzzy matching method and device

    CN113449522A

Cited By

  • Database retrieval processing method, device and equipment based on analyzer index

    CN121833865A