Data retrieval method and device, equipment and storage medium
By constructing top heap structure data, the problem of low retrieval efficiency in the traditional index method under large data volume is solved, efficient data retrieval is achieved, and the storage space and reading efficiency are reduced.
Patent Information
- Application Number
- CN202411916212.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-04-08
AI Technical Summary
Traditional index-based data retrieval methods are less retrieval efficiency when facing large data volumes, and hash indexes are prone to hash value conflicts, and the significant increase in the intermediate node levels of tree indexes leads to a decrease in storage space and reading efficiency.
The top heap structure data retrieval method is adopted to obtain the combination data of each factor and its target quantization data, and the top heap structure data corresponding to the result data is constructed so as to perform the data retrieval task based on the top heap structure data.
When facing massive data, the top heap structure data will not occupy much storage space, maintain high access efficiency, improve data retrieval efficiency, and avoid reducing retrieval efficiency due to the increase in data volume.
Smart Images

Figure CN119782587A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of retrieval technology, and in particular to a data retrieval method, device, equipment and storage medium. Background Art
[0002] In the traditional index-based data retrieval method, the main index types used include: hash index and tree index.
[0003] For hash indexes, the hash value of the stored data can be calculated and mapped to a hash table, making the hash table an index table. In this way, when data is retrieved, the hash value that matches the hash value of the search term can be directly searched in the hash table to locate the data in the storage medium.
[0004] For a tree index, from the root node downward, it can include multiple layers of intermediate nodes and leaf nodes at the bottom. The intermediate nodes are used to locate the value range of the leaf nodes, and only the leaf nodes are used to map the data in the storage medium.
[0005] However, with the advancement of technology, the amount of data maintained in storage media continues to grow, and the complexity of data continues to increase. When faced with massive amounts of data, hash indexes will frequently experience hash value conflicts, resulting in reduced retrieval efficiency of hash indexes. In tree indexes, since only leaf nodes can map actual data, when faced with large amounts of data, the number of intermediate node levels in the tree index will increase significantly, causing the storage space occupied by the tree index to increase significantly, resulting in reduced reading efficiency of the tree index, and thus reduced retrieval efficiency of the tree index.
[0006] Therefore, whether it is a hash index or a tree index, the traditional index-based data retrieval method has a relatively low retrieval efficiency when facing large amounts of data. Summary of the invention
[0007] The present application provides a data retrieval method, apparatus, device and storage medium to solve the problem that traditional index-based data retrieval methods have low retrieval efficiency when facing large amounts of data.
[0008] In view of the above technical problems, the technical solution of this application is solved by the following embodiments:
[0009] An embodiment of the present application provides a data retrieval method, including: obtaining each factor combination data corresponding to the result data and the target quantization data corresponding to each of the factor combination data; for each of the factor combination data, determining the target quantization value corresponding to the factor combination data according to the target quantization data corresponding to the factor combination data; constructing the top heap structure data corresponding to the result data according to the index pointers corresponding to each of the factor combination data and the target quantization values corresponding to each of the factor combination data, so as to perform the data retrieval task based on the top heap structure data.
[0010] Among them, determining the target quantitative value corresponding to the factor combination data according to the target quantitative data corresponding to the factor combination data includes: determining each independent factor variable in the factor combination data; obtaining the target quantitative value corresponding to each independent factor variable in the target quantitative data corresponding to the factor combination data; and determining the target quantitative value corresponding to the factor combination data according to the target quantitative value corresponding to each independent factor variable.
[0011] Wherein, constructing the top heap structure data corresponding to the result data according to the index pointers corresponding to the respective factor combination data and the target quantization values corresponding to the respective factor combination data comprises: constructing the initial top heap structure data corresponding to the result data according to the preset structure type; traversing the target quantization values corresponding to the respective factor combination data, and adding the nodes respectively mapped by the respective factor combination data in the initial top heap structure data; wherein the nodes respectively mapped by the respective factor combination data are arranged according to the size of the target quantization value; for each node in the initial top heap structure data, determining the child nodes of the node; and setting at least the index pointer corresponding to the factor combination data mapped by the child node in the node to form the top heap structure data.
[0012] Wherein, the traversing of the target quantization values corresponding to each of the factor combination data, and adding the nodes respectively mapped to each of the factor combination data in the initial top heap structure data, comprises: identifying each of the target factor combination data in each of the factor combination data corresponding to the result data; wherein the independent factor variables between each of the target factor combination data are the same; traversing the target quantization values corresponding to each of the target factor combination data, and adding the nodes respectively mapped to each of the target factor combination data in the initial top heap structure data.
[0013] Among them, the index pointer corresponding to the factor combination data mapped by the child node is at least set in the node, and also includes: setting index pointers corresponding to other factor combination data that meet preset conditions in the node; wherein the preset conditions include: the result data corresponding to the other factor combination data is the same as the result data corresponding to the top heap structure data, and the target quantization value corresponding to the other factor combination data is equal to the target quantization value corresponding to the factor combination data mapped by the node.
[0014] Wherein, executing the data retrieval task based on the top heap structure data includes: receiving a retrieval request from a retrieval device; wherein the retrieval request includes at least target result data; querying the top heap structure data corresponding to the target result data; in the top heap structure data corresponding to the target result data, starting from the top heap node, reading the index pointers corresponding to the factor combination data respectively; obtaining the factor combination data corresponding to the index pointer and returning it to the retrieval device.
[0015] Wherein, the reading of index pointers respectively corresponding to the factor combination data includes: reading the index pointers respectively corresponding to all the number of the factor combination data in the top stack structure data; or, reading the index pointers respectively corresponding to a preset number of the factor combination data in the top stack structure data; each time a switching instruction is received from the retrieval device, reading again the index pointers respectively corresponding to a preset number of the factor combination data in the remaining factor combination data in the top stack structure data; or, reading the index pointers respectively corresponding to the factor combination data in the top stack structure data that meet the preset retrieval conditions; wherein the retrieval conditions are included in the retrieval request.
[0016] The embodiment of the present application also provides a data retrieval device, including: an acquisition module, used to acquire each factor combination data corresponding to the result data and the target quantitative data corresponding to each of the factor combination data; a determination module, used to determine, for each of the factor combination data, the target quantitative value corresponding to the factor combination data according to the target quantitative data corresponding to the factor combination data; a construction and retrieval module, used to construct the top heap structure data corresponding to the result data according to the index pointers corresponding to each of the factor combination data and the target quantitative value corresponding to each of the factor combination data, so as to perform a data retrieval task based on the top heap structure data.
[0017] An embodiment of the present application also provides a data retrieval device, comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus, wherein the processor is configured to: execute a data retrieval program stored in the memory to implement any of the data retrieval methods described above.
[0018] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed to implement any of the data retrieval methods described above.
[0019] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application can obtain the various factor combination data corresponding to the result data and the target quantization data corresponding to each factor combination data; for each factor combination data, according to the target quantization data corresponding to the factor combination data, determine the target quantization value corresponding to the factor combination data; according to the index pointers corresponding to each factor combination data and the target quantization values corresponding to each factor combination data, construct the top heap structure data corresponding to the result data, so as to perform the data retrieval task based on the top heap structure data. The embodiment of the present application adopts the top heap structure, in which each node can map the actual data, and when facing massive data, the top heap structure data will not occupy more storage space, and can always keep the top heap structure data with high access efficiency, thereby obtaining a high data retrieval efficiency, and will not reduce the retrieval efficiency due to the increase in the amount of data. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0022] One or each embodiment is exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0023] Figure 1is a flow chart of a data retrieval method according to an embodiment of the present application;
[0024] Figure 2 It is a schematic diagram of a result factor influence curve according to an embodiment of the present application;
[0025] Figure 3 A flowchart of the steps for constructing top heap structure data according to an embodiment of the present application;
[0026] Figure 4 is a schematic diagram of initial top heap structure data according to an embodiment of the present application;
[0027] Figure 5 A flowchart of the steps for constructing top heap structure data according to an embodiment of the present application;
[0028] Figure 6 is a flowchart of steps of a data retrieval task according to an embodiment of the present application;
[0029] Figure 7 is a structural diagram of a data retrieval device according to an embodiment of the present application;
[0030] Figure 8 4 is a structural diagram of a data retrieval device according to an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0032] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0033] The present application embodiment provides a data retrieval method. Figure 1 , which is a flow chart of a data retrieval method according to an embodiment of the present application.
[0034] Step S110, acquiring each factor combination data corresponding to the result data and the target quantitative data corresponding to each factor combination data.
[0035] Outcome data refers to results that occur as a result of a set of causes.
[0036] Factor combination data refers to the causes that lead to the occurrence of result data.
[0037] Target quantitative data refers to the preset quantitative indicators that are of interest during the search process. Types of target quantitative data include, but are not limited to: cost data corresponding to factor combination data. Types of cost data include, but are not limited to: labor cost data, time cost data, and capital cost data.
[0038] In the embodiment of the present application, various factor combination data corresponding to the pre-stored result data and target quantitative data corresponding to each factor combination data may be obtained in the storage medium.
[0039] Step S120 : for each of the factor combination data, according to the target quantitative data corresponding to the factor combination data, determining the target quantitative value corresponding to the factor combination data.
[0040] The factor combination data includes: at least one factor variable and the variable value corresponding to each factor variable. The factor variable refers to the cause. The variable value is the value of the factor variable when the data result occurs.
[0041] For example: the result data is: the seedlings in the greenhouse grow 10 cm; the factor combination data includes: light, temperature and humidity, soil type, climate conditions, pests and diseases and other factor variables, and the variable value of each factor variable.
[0042] The target quantitative data corresponding to the factor combination data includes: the target quantitative value corresponding to each factor variable in the factor combination data, wherein the target quantitative value refers to the quantitative index of the factor variable when causing the data result.
[0043] In the embodiment of the present application, the target quantitative value corresponding to the factor combination data may be determined according to the target quantitative value corresponding to each factor variable in the factor combination data.
[0044] Step S130 , constructing top heap structure data corresponding to the result data according to the index pointers corresponding to the various factor combination data and the target quantization values corresponding to the various factor combination data, so as to perform a data retrieval task based on the top heap structure data.
[0045] The index pointer points to the storage location of the factor combination data in the storage medium.
[0046] The top heap structure data refers to a top heap structure having a preset structure type and mapping each factor combination data according to the size relationship of the target quantization value indicated by the structure type.
[0047] The top heap structure data includes: multiple nodes that conform to the preset structure type, each node maps a factor combination data. Each node at least includes: an index pointer corresponding to the factor combination data mapped by the child node of the node. The number of child nodes can be one or more.
[0048] The structure type of the top heap structure data includes: a small top heap structure or a large top heap structure. The structure type of the top heap structure data can be set according to the scene requirements.
[0049] When the top heap structure data is a small top heap structure, the target quantization value corresponding to the factor combination data mapped by the parent node is greater than the target quantization value corresponding to the factor combination data mapped by the child node. Each parent node has a preset first number of child nodes. When the number of factor combination data is insufficient, the number of child nodes of the parent node is allowed to be less than the first number of nodes. The first number of nodes is an empirical value or a value obtained through experiments. For example, the first number of nodes is 2.
[0050] When the top heap structure data is a large top heap structure, the target quantization value corresponding to the factor combination data mapped by the parent node is less than the target quantization value corresponding to the factor combination data mapped by the child node. Each parent node has a preset second number of child nodes. When the number of factor combination data is insufficient, the number of child nodes of the parent node is allowed to be less than the second number of nodes. The second number of nodes is an empirical value or a value obtained through experiments. For example, the second number of nodes is 2.
[0051] In an embodiment of the present application, each factor combination data corresponding to the result data and the target quantization data corresponding to each of the factor combination data are obtained; for each of the factor combination data, the target quantization value corresponding to the factor combination data is determined according to the target quantization data corresponding to the factor combination data; according to the index pointers corresponding to each of the factor combination data and the target quantization values corresponding to each of the factor combination data, the top heap structure data corresponding to the result data is constructed so as to perform a data retrieval task based on the top heap structure data. The embodiment of the present application adopts a top heap structure, in which each node can map actual data, so that when facing massive data, the top heap structure data will not occupy more storage space, and the top heap structure data can always be kept with a higher access efficiency, thereby obtaining a higher data retrieval efficiency, and the retrieval efficiency will not be reduced due to the increase in the amount of data.
[0052] Furthermore, since the embodiment of the present application adopts a top heap structure, and each node in the top heap structure can map the factor combination data in the storage medium, it is simpler and more direct to execute the tasks of inserting, deleting and retrieving factor combination data. There is no need to analyze whether it is necessary to increase the level of intermediate nodes, nor is there any need to analyze whether it is necessary to increase the intermediate nodes. At the same time, it also avoids the problem of hash conflicts that are prone to occur in hash indexes.
[0053] Furthermore, the embodiment of the present application uses the target quantization value as the standard for constructing the top heap structure data, so that the top heap structure data is more in line with the user's focus. In this way, when performing a data retrieval task, the required factor combination data can be provided to the user according to the target quantization value.
[0054] The data retrieval method of the embodiment of the present application is further described below.
[0055] In the embodiment of the present application, before executing the data retrieval method, it is necessary to perform the steps of data collection and data storage.
[0056] Specifically, basic data is collected through experiments, surveys, sensors or databases to ensure the comprehensiveness and accuracy of basic data. For example, the result data of each experiment is recorded, and the parameters and parameter values of the factors that affect the result data are used to ensure the integrity and repeatability of the data.
[0057] Preprocess the basic data. Preprocessing includes but is not limited to: data cleaning, deduplication, normalization, etc. to ensure the quality of basic data.
[0058] Perform data analysis on the preprocessed basic data to obtain various result data, factor combination data corresponding to each result data, and target quantitative data corresponding to each factor combination data; and store the various result data, factor combination data corresponding to each result data, and target quantitative data corresponding to each factor combination data in a storage medium.
[0059] Furthermore, since different factor combination data may lead to the same result data, the same data result may correspond to multiple factor combination data. Multiple factor combination data may share the same factor parameters or use different factor parameters. In other words, the same multiple factor parameters may give the same result data as the parameter values change; different multiple factor parameters may also give the same result data depending on their respective parameter values.
[0060] For example: Figure 2As shown, it is a schematic diagram of the result factor influence curve according to an embodiment of the present application. The result data r1, the result data r2 and the result data r3 share the factor parameters (referred to as factors in the figure) a, b, c and d; the factor combination data a1, b1, c1 and d1 can obtain the result data r1; the factor combination data a3, b3, c3 and d3 can obtain the result data r2; the factor combination data a2, b2, c2 and d2, the factor combination data a4, b4, c4 and d4 and the factor combination data a5, b5, c5 and d5 can all obtain the result data r3.
[0061] Since different factor combination data may lead to the same result data, and different users may pay attention to different factor combination data for the same result data, the embodiment of the present application provides a data retrieval method based on a top heap structure for this situation, constructs top heap structure data corresponding to the same result data, and provides users with multiple sequential factor combination data through the top heap structure data.
[0062] In the embodiment of the present application, based on the above data collection and data storage steps, each factor combination data corresponding to the result data and the target quantitative data corresponding to each factor combination data can be obtained from the storage medium.
[0063] The number of factor combination data corresponding to the result data is at least one.
[0064] The factor combination data includes: at least one factor variable and a variable value corresponding to each factor variable.
[0065] The target quantitative data includes: the target variable value corresponding to each factor variable in the factor combination data.
[0066] The types of factor variables include: independent factor variables and fixed factor variables. The types of factor variables can be identified and set during the data collection and data storage stages.
[0067] Independent factor variables refer to factor variables that can be controlled by humans. For example, the light, temperature and humidity in the greenhouse are factor variables that can be controlled by humans.
[0068] Fixed factor variables refer to factor variables that cannot be controlled by humans, such as soil types, climatic conditions, and unpredictable pests and diseases that cannot be influenced by humans.
[0069] In an embodiment of the present application, when determining the target quantitative value corresponding to the factor combination data based on the target quantitative data corresponding to the factor combination data, each independent factor variable in the factor combination data can be determined; in the target quantitative data corresponding to the factor combination data, the target quantitative value corresponding to each independent factor variable is obtained; and based on the target quantitative value corresponding to each independent factor variable, the target quantitative value corresponding to the factor combination data is determined.
[0070] Furthermore, the type of each factor variable can be preset, and then when determining the target quantitative value corresponding to the factor combination data, each independent factor variable can be directly identified in the factor combination data. The sum of the target quantitative values corresponding to each independent factor variable can be calculated, and the sum is used as the target quantitative value corresponding to the factor combination data.
[0071] In the embodiment of the present application, after determining the target quantization values respectively corresponding to the various factor combination data corresponding to the result data, the top heap structure data corresponding to the result data can be constructed.
[0072] The top heap structure data may include nodes mapped to all factor combination data corresponding to the result data, or may include nodes mapped to only a portion of the factor combination data corresponding to the result data. The two methods are described below.
[0073] First, the top heap structure data includes nodes to which all factor combination data corresponding to the result data are mapped respectively. Figure 3 , which is a flow chart of the steps for constructing top heap structure data according to an embodiment of the present application.
[0074] Step S310, constructing initial top heap structure data corresponding to the result data according to a preset structure type.
[0075] The preset structure type is: small top heap structure type or large top heap structure type.
[0076] The initial top heap structure data refers to an empty top heap data structure. A node can be added to the initial top heap structure data.
[0077] Step S320, traversing the target quantized values corresponding to the respective factor combination data, and adding the nodes mapped to the respective factor combination data in the initial top heap structure data; wherein the nodes mapped to the respective factor combination data are arranged according to the size of the target quantized values.
[0078] By traversing the target quantization values corresponding to each factor combination data, the size relationship between the target quantization values of each factor combination data can be determined; according to the size relationship between the target quantization values of each factor combination data, in the initial top heap structure data, the nodes mapped by each factor combination data are added so that the structure type corresponding to the initial top heap structure data is satisfied between each node.
[0079] For example: Figure 4The figure shows a schematic diagram of the initial top heap structure data according to an embodiment of the present application. The structure type is preset as a large top heap structure type, and the number of child nodes of the parent node is set to 2. The result data r1 corresponds to a factor combination data 1, and in the initial top heap structure data corresponding to the result data r1, the factor combination data 1 maps to the node Node1; the result data r2 corresponds to a factor combination data 2, and in the initial top heap structure data corresponding to the result data r2, the factor combination data 2 maps to the node Node2; the result data r3 corresponds to a factor combination data 3, a factor combination data 4, a factor combination data 5, a factor combination data 7, a factor combination data 8 and a factor combination data 9; among which, the target variable value value3 corresponds to the factor combination data 3, the target variable value value4 corresponds to the factor combination data 4, the target variable value value5 corresponds to the factor combination data 5, the target variable value value7 corresponds to the factor combination data 7, the target variable value value8 corresponds to the factor combination data 8, and the target variable value value9 corresponds to the factor combination data 9. In the initial top heap structure data corresponding to the result data r3, the factor combination data 3 maps to the node Node3, the factor combination data 4 maps to the node Node4, the factor combination data 5 maps to the node Node5, the factor combination data 7 maps to the node Node7, and the factor combination data 8 maps to the node Node 8, factor combination data 9 maps node Node9 to form initial top heap structure data of large top heap structure type, because when comparing value3, value4, value5, value6, value7, value8 and value9, Value5 is the maximum value, so the node Node5 mapped by factor combination data 5 can be added to the initial top heap structure data, and the node Node5 is used as the root node (i.e., top heap node); next, child nodes are added to the node Node5: among the remaining value3, value4, value6, value7, value8 and value9, in descending order, Value3 and Value4 are the top two values, so the node Node3 mapped by factor combination data 3 and the node Node4 mapped by factor combination data 4 can be added to the initial top heap structure data, and the node Node3 and the node Node are used as child nodes of the node Node5;Randomly select a node from node Node3 and node Node4. For example, first select node Node3 and add a child node to node Node3: among the remaining value6, value7, value8 and value9, value6 and value7 are the top two values in descending order. Then, add node Node6 mapped by factor combination data 6 and node Node7 mapped by factor combination data 7 to the initial top heap structure data, and use node Node6 and node Node7 as child nodes of node Node3; then, add a child node to node Node4: currently only value8 and value9 are left, then add node Node8 mapped by factor combination data 8 and node Node9 mapped by factor combination data 9 to the initial top heap structure data, and use node Node8 and node Node9 as child nodes of node Node4. ;
[0080] Step S330, for each node in the initial top heap structure data, determine the child nodes of the node; at least set the index pointer corresponding to the factor combination data mapped by the child node in the node to form the top heap structure data.
[0081] The top heap structure data includes: an index pointer corresponding to the top heap node and data of each node in the top heap structure. The data of each node includes but is not limited to: an index pointer corresponding to the factor combination data mapped by the child node.
[0082] For example, in the data of the node Node, the target quantitative value corresponding to the factor combination data mapped by the node can also be set. The data structure of the node Node is as follows:
[0083] Node{
[0084] Node right; represents the right child node of the node Node;
[0085] Value: represents the target quantized value corresponding to the node Node;
[0086] Node left; represents the left child node of the node Node;
[0087] }
[0088] After all nodes in the initial top heap structure data are set, the top heap structure data corresponding to the result data is formed.
[0089] The embodiment of the present application constructs a top heap structure data so that each factor combination data is respectively mapped to a node in the top heap result data, and each node is arranged according to the target quantization value corresponding to the factor combination data mapped to it. In this way, the nodes in the top heap structure data are sequential. In the subsequent data retrieval process, the factor combination data can be returned in order starting from the top heap node according to the target quantization value, thereby improving the accuracy and practicality of the retrieval results.
[0090] Then, the top heap structure data only includes nodes corresponding to a part of the factor combination data corresponding to the result data. Figure 5 , which is a flow chart of the steps for constructing top heap structure data according to an embodiment of the present application.
[0091] Step S510: constructing initial top heap structure data corresponding to the result data according to a preset structure type.
[0092] Step S520, identifying each target factor combination data in each factor combination data corresponding to the result data; wherein the independent factor variables between each target factor combination data are the same.
[0093] That is to say, among the multiple factor combination data corresponding to the result data, each target factor combination data shares a set of independent factor variables, while each independent factor variable in other factor combination data is different from the set of independent factor variables shared by each target factor combination data.
[0094] Step S530 , traversing the target quantized values corresponding to the target factor combination data, and adding the nodes mapped to the target factor combination data in the initial top heap structure data.
[0095] Step S540, for each node in the initial top heap structure data, determine the child nodes of the node; set the index pointer corresponding to the factor combination data mapped by the child node in the node, and set the index pointer corresponding to other factor combination data that meets the preset conditions in the node to form the top heap structure data.
[0096] The top heap structure data includes: index pointers corresponding to the top heap nodes and data of each node in the top heap structure. The data of each node includes but is not limited to: index pointers corresponding to the factor combination data mapped by the child nodes of the node and index pointers corresponding to other factor combination data that meet preset conditions.
[0097] For example, in the data of the node Node, the target quantitative value corresponding to the factor combination data mapped by the node can also be set. The structure of the node Node is as follows:
[0098] Node{
[0099] Node right; represents the right child node of the node Node;
[0100] Value: represents the target quantized value corresponding to the node Node;
[0101] Index; indicates the index pointer corresponding to the combination data of other factors;
[0102] Node left; represents the left child node of the node Node;
[0103] }
[0104] The preset conditions include: the result data corresponding to the other factor combination data is the same as the result data corresponding to the top heap structure data, and the target quantization value corresponding to the other factor combination data is equal to the target quantization value corresponding to the factor combination data of the node mapping.
[0105] Furthermore, for each node in the initial top heap structure data corresponding to the result data, other factor combination data that meet the preset conditions include: among all the factor combination data corresponding to the result data, the factor combination data whose target quantization value is equal to the target quantization value corresponding to the factor combination data mapped to the current node. Among them, among all the factor combination data corresponding to the result data, include: target factor combination data and remaining factor combination data other than the target factor combination data. The target factor combination data refers to the factor combination data that shares a set of independent factor variables.
[0106] For example: the result data corresponds to factor combination data 1, factor combination data 2, factor combination data 3 and factor combination data 4; factor combination data 1 includes independent factor variables a, b, c and d; factor combination data 2 includes independent factor variables a, b, c and d; factor combination data 3 includes independent factor variables a, d, e and f; factor combination data 4 includes independent factor variables a, b, c and d; it can be determined that factor combination data 1, factor combination data 2 and factor combination data 4 are all target factor combination data, and it can be determined that factor combination data 3 is the remaining factor combination data other than the target factor combination data; among which, the target quantization value corresponding to factor combination data 1, the target quantization value corresponding to factor combination data 2 and the target quantization value corresponding to factor combination data 3 are the same, then the index pointer corresponding to factor combination data 2 and the index pointer corresponding to factor combination data 3 can be set in the node mapped by factor combination data 1.
[0107] In the embodiment of the present application, the number of other factor combination data that meets the preset conditions can be one or more.
[0108] The embodiment of the present application constructs a top heap structure data so that the target factor combination data maps to the nodes in the top heap structure data. In addition to setting the index pointer corresponding to the factor combination data mapped to the child node in the node, the index pointer corresponding to other factor combination data that meets the preset conditions can also be set in the node. In this way, the top heap structure can be used to map the data in the storage medium. When data is subsequently retrieved, data query can be performed based on the top heap structure data. When a node is queried, the factor combination data mapped to the child node and other factor combination data can be quickly accessed according to the index pointer in the node, thereby quickly responding to data retrieval requests and improving data retrieval efficiency.
[0109] In the embodiment of the present application, after the top heap structure data is constructed, a data retrieval task can be performed based on the top heap structure data.
[0110] The data retrieval task refers to retrieving the index pointer corresponding to the factor combination data matching the target result data from the multiple top heap structure data constructed according to the target result data from the retrieval device, and obtaining the factor combination data from the storage medium according to the index pointer corresponding to the factor combination data and returning it to the retrieval device.
[0111] like Figure 6 FIG. 1 is a flowchart of the steps of a data retrieval task according to an embodiment of the present application.
[0112] Step S610, receiving a search request from a search device; wherein the search request at least includes target result data.
[0113] Types of retrieval devices include, but are not limited to: user terminals.
[0114] The search request is used to request to perform a data search task based on the target result data. The search request includes at least the target result data. Furthermore, according to different user requirements, the search request may also include search conditions. The search conditions include but are not limited to the numerical range of the target quantization value.
[0115] Target result data refers to the search terms required for retrieval.
[0116] Step S620, querying the top heap structure data corresponding to the target result data.
[0117] Step S630 , reading index pointers corresponding to the factor combination data respectively from the top heap structure data corresponding to the target result data, starting from the top heap node.
[0118] In one embodiment, the index pointers corresponding to all the factor combination data in the top heap structure data are read. Furthermore, in the top heap structure data, starting from the top heap node, according to the size relationship of the target quantization value indicated by the structure type of the top heap structure data, the index pointers corresponding to the factor combination data mapped by each node and the index pointers corresponding to other factor combination data included in each node that meet the preset conditions are read one by one.
[0119] For example: first read the index pointer corresponding to the factor combination data mapped by the parent node and the index pointers corresponding to other factor combination data included in the parent node that meet the preset conditions, and then read the index pointer corresponding to the factor combination data mapped by the child node and the index pointers corresponding to other factor combination data included in the child node that meet the preset conditions.
[0120] In another method, the index pointers corresponding to a preset number of the factor combination data in the top stack structure data are read; each time a switching instruction is received from the retrieval device, the index pointers corresponding to a preset number of the factor combination data are read again from the remaining factor combination data in the top stack structure data.
[0121] The preset number is a set value. The set value may be an empirical value or a value obtained through experiments. For example, the preset number may be 1, so that a factor combination data can be sent to the retrieval device each time, and when the user sees satisfactory factor combination data, the sending of the trigger switching instruction is stopped, and then the factor combination data is stopped from being sent to the retrieval device again.
[0122] The switching instruction is used to instruct to send the next batch of factor combination data with a preset number. Further, in the retrieval device, after viewing the first batch of factor combination data with a preset number, if the user wants to view the next batch of factor combination data with a preset number, the user can perform a preset switching operation to trigger the sending of the switching instruction. For example, the user clicks the down arrow to trigger the sending of the switching instruction.
[0123] Furthermore, in the top heap structure data, starting from the top heap node, according to the size relationship of the target quantization value indicated by the structure type of the top heap structure data, the index pointer corresponding to the factor combination data mapped by a node is read each time. If the node read last time includes the index pointer corresponding to other factor combination data that meets the preset conditions, then the index pointer corresponding to the other factor combination data that meets the preset conditions included in the node is read this time, until all the index pointers corresponding to the other factor combination data that meets the preset conditions included in the node are read, and then the index pointer corresponding to the factor combination data mapped by the child nodes of the node is read.
[0124] In another embodiment, the index pointers respectively corresponding to the factor combination data that meet the preset search condition in the top heap structure data are read; wherein the search condition is included in the search request.
[0125] Furthermore, the search request includes target result data and search conditions. The search conditions can be determined according to the requirements. For example, the search condition is the numerical range of the target quantization value. In this way, during the search process, the target quantization value corresponding to each node can be queried, and the index pointers corresponding to the factor combination data mapped to the nodes whose target quantization values are within the numerical range can be read.
[0126] Step S640: Obtain the factor combination data corresponding to the index pointer and return it to the search device.
[0127] In an embodiment of the present application, the target result data from the retrieval device is received; the top heap structure data corresponding to the target result data is queried; in the top heap structure data corresponding to the target result data, starting from the top heap node, the index pointers corresponding to each of the factor combination data are read; the factor combination data corresponding to the read index pointer is obtained and returned to the retrieval device. The embodiment of the present application adopts a top heap structure, and each node in the top heap structure can map the data in the storage medium, reducing the storage overhead of the top heap structure data, improving resource utilization, and shortening the access time of the top heap structure data when performing data retrieval, quickly responding to data retrieval requests, and improving data retrieval efficiency. Moreover, the embodiment of the present application can realize the arrangement of the factor combination data by determining the target quantization value corresponding to each factor combination data and constructing the top heap structure data. In the data retrieval process, starting from the top heap node, according to the target quantization value, partial factor combination data can be preferentially returned, or partial factor combination data can be selectively returned according to the retrieval conditions provided by the user, thereby improving the accuracy and practicality of the retrieval results.
[0128] In an embodiment of the present application, after the top heap structure data is constructed, in addition to executing data retrieval tasks based on the top heap structure data, data insertion tasks for newly stored factor combination data and data deletion tasks for stored factor combination data can also be executed based on the top heap structure data.
[0129] In an embodiment of the present application, the data insertion task includes: obtaining the factor combination data newly stored in the storage medium and its corresponding target quantization data, determining the target quantization value corresponding to the factor combination data according to the target quantization data corresponding to the factor combination data; determining the result data pre-set for the factor combination data; adding and setting the node mapped by the factor combination data in the top heap structure data corresponding to the result data according to the target quantization value corresponding to the factor combination data. Further, the node mapped by the new factor combination data can be added at the end of the top heap structure data, that is, after the node with the smallest target quantization value, and can be used as the child node of the node with the smallest target quantization value, and the newly added node is moved by comparing the target quantization value corresponding to the newly added child node with the target quantization value corresponding to its parent node, until the position of the newly added node in the top heap structure data meets the arrangement requirements of the structure type of the top heap structure data for the target quantization value.
[0130] In an embodiment of the present application, the data deletion task includes: determining the node to which the factor combination data to be deleted is mapped in the top heap structure data; querying the target quantization value corresponding to the factor combination data mapped by the parent node of the node and the target quantization value corresponding to the factor combination data mapped by the child node of the node; deleting the node; and reconstructing the node connection relationship according to the structure type corresponding to the top heap structure data and based on the target quantization value corresponding to the factor combination data mapped by the parent node and the target quantization value corresponding to the factor combination data mapped by the child node of the node.
[0131] The present application also provides a data retrieval device. Figure 7 , which is a structural diagram of a data retrieval device according to an embodiment of the present application.
[0132] The data retrieval device comprises:
[0133] The acquisition module 710 is used to acquire each factor combination data corresponding to the result data and the target quantitative data corresponding to each factor combination data.
[0134] The determination module 720 is used to determine, for each of the factor combination data, a target quantitative value corresponding to the factor combination data according to the target quantitative data corresponding to the factor combination data.
[0135] The construction and retrieval module 730 is used to construct the top heap structure data corresponding to the result data according to the index pointers corresponding to each of the factor combination data and the target quantization values corresponding to each of the factor combination data, so as to perform a data retrieval task based on the top heap structure data.
[0136] The functions of the device described in the embodiment of the present application have been described in the above method embodiment. Therefore, for any details not provided in the description of this embodiment, please refer to the relevant descriptions in the above embodiment and will not be repeated here.
[0137] The present application also provides a data retrieval device, such as Figure 8 , which is a structural diagram of a data retrieval device according to an embodiment of the present application.
[0138] The data retrieval device includes: a processor 810, a communication interface 820, a memory 830 and a communication bus 840. The processor 810, the communication interface 820 and the memory 830 communicate with each other through the communication bus 840.
[0139] The memory 830 is used to store computer programs.
[0140] In one embodiment of the present application, the processor 810, when executing the program stored in the memory 830, implements the data retrieval method provided by any of the aforementioned method embodiments, including: obtaining each factor combination data corresponding to the result data and the target quantization data corresponding to each of the factor combination data; for each of the factor combination data, determining the target quantization value corresponding to the factor combination data according to the target quantization data corresponding to the factor combination data; constructing the top heap structure data corresponding to the result data according to the index pointers corresponding to each of the factor combination data and the target quantization values corresponding to each of the factor combination data, so as to perform the data retrieval task based on the top heap structure data.
[0141] Among them, determining the target quantitative value corresponding to the factor combination data according to the target quantitative data corresponding to the factor combination data includes: determining each independent factor variable in the factor combination data; obtaining the target quantitative value corresponding to each independent factor variable in the target quantitative data corresponding to the factor combination data; and determining the target quantitative value corresponding to the factor combination data according to the target quantitative value corresponding to each independent factor variable.
[0142] Wherein, constructing the top heap structure data corresponding to the result data according to the index pointers corresponding to the respective factor combination data and the target quantization values corresponding to the respective factor combination data comprises: constructing the initial top heap structure data corresponding to the result data according to the preset structure type; traversing the target quantization values corresponding to the respective factor combination data, and adding the nodes respectively mapped by the respective factor combination data in the initial top heap structure data; wherein the nodes respectively mapped by the respective factor combination data are arranged according to the size of the target quantization value; for each node in the initial top heap structure data, determining the child nodes of the node; and setting at least the index pointer corresponding to the factor combination data mapped by the child node in the node to form the top heap structure data.
[0143] Wherein, the traversing of the target quantization values corresponding to each of the factor combination data, and adding the nodes respectively mapped to each of the factor combination data in the initial top heap structure data, comprises: identifying each of the target factor combination data in each of the factor combination data corresponding to the result data; wherein the independent factor variables between each of the target factor combination data are the same; traversing the target quantization values corresponding to each of the target factor combination data, and adding the nodes respectively mapped to each of the target factor combination data in the initial top heap structure data.
[0144] Among them, the index pointer corresponding to the factor combination data mapped by the child node is at least set in the node, and also includes: setting index pointers corresponding to other factor combination data that meet preset conditions in the node; wherein the preset conditions include: the result data corresponding to the other factor combination data is the same as the result data corresponding to the top heap structure data, and the target quantization value corresponding to the other factor combination data is equal to the target quantization value corresponding to the factor combination data mapped by the node.
[0145] Wherein, executing the data retrieval task based on the top heap structure data includes: receiving a retrieval request from a retrieval device; wherein the retrieval request includes at least target result data; querying the top heap structure data corresponding to the target result data; in the top heap structure data corresponding to the target result data, starting from the top heap node, reading the index pointers corresponding to the factor combination data respectively; obtaining the factor combination data corresponding to the index pointer and returning it to the retrieval device.
[0146] Wherein, the reading of index pointers respectively corresponding to the factor combination data includes: reading the index pointers respectively corresponding to all the number of the factor combination data in the top stack structure data; or, reading the index pointers respectively corresponding to a preset number of the factor combination data in the top stack structure data; each time a switching instruction is received from the retrieval device, reading again the index pointers respectively corresponding to a preset number of the factor combination data in the remaining factor combination data in the top stack structure data; or, reading the index pointers respectively corresponding to the factor combination data in the top stack structure data that meet the preset retrieval conditions; wherein the retrieval conditions are included in the retrieval request.
[0147] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the data retrieval method provided in any of the above method embodiments are implemented. Since the data retrieval method has been described in detail above, for any details not fully described in the description of this embodiment, please refer to the relevant descriptions in the above embodiments, and no further description will be given here.
[0148] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to various network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0149] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0150] It should be understood that the terms used in the text are only for the purpose of describing specific example embodiments, and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used in the text may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or each other feature, step, operation, element, part, and / or combination thereof. The method steps, processes, and operations described in the text are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0151] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.
Claims
1. A data retrieval method, characterized in that: include: Obtaining each factor combination data corresponding to the result data and the target quantitative data corresponding to each factor combination data; For each of the factor combination data, determining the target quantitative value corresponding to the factor combination data according to the target quantitative data corresponding to the factor combination data; According to the index pointers respectively corresponding to the factor combination data and the target quantization values respectively corresponding to the factor combination data, the top heap structure data corresponding to the result data is constructed so as to perform a data retrieval task based on the top heap structure data.
2. The method according to claim 1, characterized in that The determining, according to the target quantitative data corresponding to the factor combination data, the target quantitative value corresponding to the factor combination data comprises: determining each independent factor variable in the factor combination data; In the target quantitative data corresponding to the factor combination data, obtaining the target quantitative values corresponding to each of the independent factor variables; The target quantitative value corresponding to the factor combination data is determined according to the target quantitative value corresponding to each of the independent factor variables.
3. The method according to claim 1, characterized in that The step of constructing the top heap structure data corresponding to the result data according to the index pointers corresponding to the respective factor combination data and the target quantization values corresponding to the respective factor combination data comprises: According to a preset structure type, construct the initial top heap structure data corresponding to the result data; Traversing the target quantized values corresponding to the respective factor combination data, and adding the nodes mapped to the respective factor combination data in the initial top heap structure data; wherein the nodes mapped to the respective factor combination data are arranged according to the size of the target quantized values; For each node in the initial top heap structure data, the child nodes of the node are determined; and at least an index pointer corresponding to the factor combination data mapped by the child node is set in the node to form the top heap structure data.
4. The method according to claim 3, characterized in that The traversing of the target quantized values corresponding to the respective factor combination data and adding the nodes respectively mapped to the respective factor combination data in the initial top heap structure data comprises: Identify each target factor combination data in each factor combination data corresponding to the result data; wherein the independent factor variables between each target factor combination data are the same; The target quantized values respectively corresponding to the target factor combination data are traversed, and the nodes respectively mapped to the target factor combination data are added to the initial top heap structure data.
5. The method according to claim 3, characterized in that: The index pointer corresponding to the factor combination data mapped by the child node is at least set in the node, and further includes: An index pointer corresponding to other factor combination data that meets preset conditions is set in the node; wherein the preset conditions include: the result data corresponding to the other factor combination data is the same as the result data corresponding to the top heap structure data, and the target quantization value corresponding to the other factor combination data is equal to the target quantization value corresponding to the factor combination data mapped by the node.
6. The method according to claim 1, characterized in that The performing of the data retrieval task based on the top heap structure data includes: Receiving a search request from a search device; wherein the search request at least includes target result data; Query the top heap structure data corresponding to the target result data; In the top heap structure data corresponding to the target result data, starting from the top heap node, read the index pointer corresponding to the factor combination data; The factor combination data corresponding to the index pointer is obtained and returned to the retrieval device.
7. The method according to claim 6, characterized in that The index pointers corresponding to the read factor combination data respectively include: Reading the index pointers corresponding to all the factor combination data in the top heap structure data; or, Reading the index pointers respectively corresponding to a preset number of the factor combination data in the top heap structure data; each time a switching instruction is received from the retrieval device, reading the index pointers respectively corresponding to a preset number of the factor combination data in the remaining factor combination data in the top heap structure data; or, The index pointers respectively corresponding to the factor combination data that meet the preset search condition in the top heap structure data are read; wherein the search condition is included in the search request.
8. A data retrieval device, characterized in that: include: An acquisition module, used to acquire each factor combination data corresponding to the result data and target quantitative data corresponding to each factor combination data; A determination module, configured to determine, for each of the factor combination data, a target quantitative value corresponding to the factor combination data according to the target quantitative data corresponding to the factor combination data; The construction and retrieval module is used to construct the top heap structure data corresponding to the result data according to the index pointers corresponding to each of the factor combination data and the target quantization values corresponding to each of the factor combination data, so as to perform a data retrieval task based on the top heap structure data.
9. A data retrieval device, characterized in that: include: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; At least one memory connected to the at least one bus, wherein the processor is configured to: execute a data retrieval program stored in the memory to implement the data retrieval method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed to implement the data retrieval method according to any one of claims 1 to 7.