Data search method and device, electronic equipment, storage medium and program product

By storing storage indication information of candidate search data in the search structure tree, the problem of high resource consumption during the search process is solved, and fast data search response is achieved.

CN116150457BActive Publication Date: 2026-05-22TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2021-11-19
Publication Date
2026-05-22

AI Technical Summary

Technical Problem

In existing technologies, the search process is time-consuming, consumes a lot of memory and CPU computing resources, and affects the search response speed.

Method used

A pre-created search structure tree is used, with each node storing candidate search data and its storage indication information. Candidate search results are obtained by matching the target storage indication information, reducing memory and computing resource consumption.

Benefits of technology

It improves the response speed of data search, saves data search time, and reduces the consumption of memory and computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116150457B_ABST
    Figure CN116150457B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a data search method and device, electronic equipment, storage medium and program product; at least one search structure tree can be created in advance according to the data to be searched, each node of the search structure tree stores a candidate search data and storage indication information of a candidate search result of the candidate search data, the storage indication information is used for indicating a storage location of the candidate search result; when target search data matching the data to be searched is determined from the candidate search data, target storage indication information corresponding to the target search data is acquired from a node where the target search data is located; based on the target storage indication information, the target candidate search result is acquired from a storage location where the target candidate search result of the target search data is located; and the search result of the data to be searched is returned according to the target candidate search result; the occupation of memory and computing resources can be reduced, the response speed of data search is improved, and the data search time is saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data search technology, and more specifically to data search methods, apparatus, electronic devices, storage media, and program products. Background Technology

[0002] With the rapid development of the internet, more and more information is available to users, and users are generating more and more content using various applications. Therefore, most applications have search functions for users to search for content.

[0003] Currently, when a user enters search terms, the search function's backend performs real-time word matching against the database, generating various suggested terms and ultimately returning a series of system-recommended terms to the user. However, this approach results in a lengthy search process, consuming significant memory and CPU resources in the search backend, thus impacting search response speed. Summary of the Invention

[0004] The embodiments of the present invention provide a data search method, apparatus, electronic device, storage medium and program product, which can reduce the occupation of memory and computing resources, improve the response speed of data search and save data search time.

[0005] This invention provides a data search method, including:

[0006] Based on the data to be searched, at least one pre-created search structure tree is queried. Each node of the search structure tree stores a candidate search data and storage indication information of the candidate search results of the candidate search data. The storage indication information is used to indicate the storage location of the candidate search results.

[0007] When target search data matching the data to be searched is determined from the candidate search data, the target storage indication information corresponding to the target search data is obtained from the node where the target search data is located.

[0008] Based on the target storage indication information, the target candidate search results are obtained from the storage location where the target candidate search results of the target search data are located;

[0009] Based on the target candidate search results, return the search results for the data to be searched.

[0010] Accordingly, embodiments of the present invention also provide a data search device, comprising:

[0011] The tree query unit is used to query at least one pre-created search structure tree based on the data to be searched. Each node of the search structure tree stores a candidate search data and storage indication information of the candidate search results of the candidate search data. The storage indication information is used to indicate the storage location of the candidate search results.

[0012] The instruction information acquisition unit is used to acquire target storage instruction information corresponding to the target search data from the node where the target search data is located when a target search data matching the data to be searched is determined from the candidate search data.

[0013] The search result acquisition unit is used to acquire the target candidate search results from the storage location where the target candidate search results of the target search data are located, based on the target storage indication information;

[0014] The search result return unit is used to return the search results of the data to be searched based on the target candidate search results.

[0015] Optionally, the candidate search results for each candidate search data are stored in the storage set corresponding to the candidate search data, and the target storage indication information is used to indicate the storage location of the storage set;

[0016] The search result acquisition unit is used to determine the storage location of the target storage set corresponding to the target search data from at least one storage set corresponding to the search structure tree where the target search data is located, based on the target storage indication information.

[0017] The target candidate search results are obtained from the storage location of the target storage set.

[0018] Optionally, the storage set corresponding to the candidate search data is a search result array unit composed of the candidate search results of the candidate search data, and at least one storage set corresponding to each search structure tree constitutes the search result array corresponding to the search structure tree. The storage indication information is the array index of the search result array unit where the candidate search result is located in the search result array.

[0019] The search result acquisition unit is used to determine the storage location of the target search result array unit corresponding to the target search data from the search result array corresponding to the search structure tree where the target search data is located, based on the target array index corresponding to the target search data.

[0020] Optionally, the data search apparatus provided in this embodiment of the invention further includes a tree creation unit, used to determine storage indication information for each candidate search result based on the storage location of the candidate search results that corresponds to the candidate search data storage in advance;

[0021] Based on the candidate search data, create nodes for the search structure tree;

[0022] Each candidate search data and its corresponding storage indication information are stored in a node of the search structure tree.

[0023] Optionally, the data search device provided in this embodiment of the invention further includes a data storage unit for acquiring a search dataset;

[0024] The search dataset is processed to determine each candidate search data and each candidate search result of the candidate search data.

[0025] Each candidate search result is stored in relation to each candidate search data.

[0026] Optionally, the data storage unit is used to create a storage set corresponding to each candidate search data based on each candidate search data;

[0027] The candidate search results corresponding to each candidate search data are stored in the storage set corresponding to each candidate search data.

[0028] Optionally, the candidate search results include at least one candidate search sub-result; the data search device provided in this embodiment of the invention further includes a result matching degree calculation unit, used to obtain the historical search features of each candidate search sub-result;

[0029] Based on the historical search features, calculate the search matching degree between each candidate search sub-result and the candidate search data;

[0030] The data storage unit is used to store each of the candidate search results and their search matching degree corresponding to each of the candidate search data;

[0031] The search result return unit is used to generate search results based on the search matching degree of each target candidate search sub-result in the target candidate search results, and return the search results of the data to be searched.

[0032] Optionally, the data search device provided in this embodiment of the invention further includes a length determination unit, used to determine the data length corresponding to the data to be searched based on the data to be searched;

[0033] The tree query unit is used to query at least one pre-created short data structure tree based on the data to be searched when the data length is less than a preset length threshold.

[0034] When the data length is not less than a preset length threshold, at least one pre-created long data structure tree is queried based on the data to be searched.

[0035] Optionally, the target candidate search results include at least two target candidate search sub-results, and the search result return unit is used to obtain the historical search features of each target candidate search sub-result;

[0036] Based on the historical search features, calculate the search matching degree between each of the target candidate search sub-results and the data to be searched;

[0037] Search results are generated based on the search matching degree, and the search results for the data to be searched are returned.

[0038] Optionally, the number of search structure trees is at least 1. The data search device provided in this embodiment of the invention further includes a tree update unit for loading and updating the search structure tree.

[0039] Detect the access status of each of the search structure trees, the access status including no access status and accessed status;

[0040] If a search structure tree has an access status of no access, delete the search structure tree.

[0041] When a search structure tree is in the accessed state, the search structure tree is retained until the accessed state of the search structure tree is in the unaccessed state, and then the search structure tree is deleted.

[0042] Optionally, the tree update unit is used to determine the number of search tree structures to be updated;

[0043] When the number of updated search structure trees is different from the number of search structure trees, the number of search structure trees is adjusted according to the number of updated search structure trees;

[0044] Based on the number of elements in the adjusted search structure tree, the updated search structure tree is loaded.

[0045] Optionally, the tree update unit is configured to, when the number of updated search tree structures is greater than the number of search tree structures, increase the number of search tree structures to make the number of search tree structures the same as the number of updated search tree structures;

[0046] When the number of updated search structure trees is less than the number of search structure trees, the number of search structure trees is reduced to be the same as the number of updated search structure trees, based on the number of updated search structure trees.

[0047] Optionally, the tree query unit is used to perform text processing on the data to be searched to obtain the search string corresponding to the data to be searched;

[0048] Based on the search string, invoke the search structure query interface to query at least one pre-created search structure.

[0049] Accordingly, embodiments of the present invention also provide an electronic device, including a memory and a processor; the memory stores an application program, and the processor is used to run the application program in the memory to perform the steps in any of the data search methods provided in the embodiments of the present invention.

[0050] Accordingly, embodiments of the present invention also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute steps in any of the data search methods provided in embodiments of the present invention.

[0051] Furthermore, embodiments of the present invention also provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the steps in any of the data search methods provided in embodiments of the present invention.

[0052] The solution of this invention allows querying at least one pre-created search structure tree based on the data to be searched. Each node of the search structure tree stores a candidate search data and storage indication information of the candidate search results for that candidate search data. The storage indication information indicates the storage location of the candidate search results. When a target search data matching the data to be searched is determined from the candidate search data, the target storage indication information corresponding to the target search data is obtained from the node where the target search data is located. Based on the target storage indication information, the target candidate search results are obtained from the storage location where the target candidate search results for the target search data are located. Based on the target candidate search results, the search results for the data to be searched are returned. Since this invention uses a tree structure to index the candidate search data and candidate search results, the response speed of data search can be improved, and data search time can be saved. At the same time, since the nodes of the search structure tree store storage indication information rather than candidate search results, the memory and computing resources occupied by the search structure tree can be saved. Attached Figure Description

[0053] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0054] Figure 1 This is a schematic diagram of a scenario for the data search method provided in an embodiment of the present invention;

[0055] Figure 2 This is a flowchart of the data search method provided in an embodiment of the present invention;

[0056] Figure 3 This is a schematic diagram of the login page provided in an embodiment of the present invention;

[0057] Figure 4 This is a schematic diagram of the authorization login page provided in an embodiment of the present invention;

[0058] Figure 5 This is a schematic diagram illustrating the technical implementation of the authorization login page provided in an embodiment of the present invention;

[0059] Figure 6 This is another schematic diagram of the authorized login page provided in an embodiment of the present invention;

[0060] Figure 7 This is another schematic diagram of the application login process provided in an embodiment of the present invention;

[0061] Figure 8 This is a schematic diagram of the structure of the data search device provided in an embodiment of the present invention;

[0062] Figure 9 This is another structural schematic diagram of the data search device provided in an embodiment of the present invention;

[0063] Figure 10 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation

[0064] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0065] This invention provides a data search method, apparatus, electronic device, and computer-readable storage medium. Specifically, this invention provides a data search method suitable for a data search apparatus that can be integrated into an electronic device.

[0066] The electronic device can be a terminal or other device, including but not limited to mobile terminals and fixed terminals. For example, mobile terminals include but are not limited to smartphones, smartwatches, tablets, laptops, smart vehicles, etc., while fixed terminals include but are not limited to desktop computers, smart TVs, etc.

[0067] The electronic device can also be a server or other similar device. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms, but it is not limited to these.

[0068] The data search method of this invention can be implemented by a server or by a terminal and a server together.

[0069] The following example illustrates this data search method using both a terminal and a server.

[0070] like Figure 1 As shown, the data search system provided in this embodiment of the invention includes a terminal 10 and a server 20, etc. The terminal 10 and the server 20 are connected through a network, such as a wired or wireless network. The terminal 10 can serve as a terminal for users to send data search requests to the server 20.

[0071] Terminal 10 can be a terminal that generates a data search request based on user operations, and is used to send the data search request to server 20. The data search request includes the data to be searched.

[0072] Server 20 can be used to query at least one pre-created search structure tree based on the data to be searched. Each node of the search structure tree stores a candidate search data and storage indication information of the candidate search results of the candidate search data. The storage indication information is used to indicate the storage location of the candidate search results. When a target search data matching the data to be searched is determined from the candidate search data, the target storage indication information corresponding to the target search data is obtained from the node where the target search data is located. Based on the target storage indication information, the target candidate search results are obtained from the storage location where the target candidate search results of the target search data are located.

[0073] Server 20 can return the search results of the data to be searched to terminal 10 based on the target candidate search results.

[0074] Terminal 10 can receive search results sent by server 20 and display the search results.

[0075] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the preferred order of the embodiments.

[0076] The embodiments of the present invention will be described from the perspective of a data search device, which can be integrated into a server or terminal.

[0077] like Figure 2 As shown, the specific process of the data search method in this embodiment can be as follows:

[0078] 201. Query at least one pre-created search structure tree based on the data to be searched. Each node of the search structure tree stores a candidate search data and storage indication information of the candidate search results of the candidate search data. The storage indication information is used to indicate the storage location of the candidate search results.

[0079] The data to be searched can be a character or string composed of one or more of the following: Chinese characters, letters, pinyin, numbers, etc., or feature information extracted from text, images, videos, etc.

[0080] For example, the data to be searched can be a string of characters that the user enters in real time in the application interface of the terminal, or it can be information obtained by extracting characters or recognizing images uploaded by the user.

[0081] In this embodiment of the invention, the search structure tree is a data set that organizes candidate search data and constructs based on the hierarchical relationship between each candidate search data. There can be one or multiple search structure trees, and the levels, depths, node distributions, etc., between each search structure tree can be the same or different. This embodiment of the invention does not impose any limitations on this.

[0082] For example, a search structure tree can be a Trie tree, also known as a word lookup tree or key tree, a tree-like structure and a variant of a hash tree. A typical application is for counting and sorting large numbers of strings (but not limited to strings), so it is frequently used in search systems for text word frequency statistics. Its advantages are: minimizing unnecessary string comparisons and higher query efficiency than hash tables. The core idea of ​​a Trie is to trade space for time, utilizing the common prefixes of strings to reduce query time overhead and thus improve efficiency. Alternatively, a search structure tree can also be a red-black tree, etc.

[0083] The candidate search data can be data provided by the search system that can match the data to be searched. In this embodiment of the invention, the candidate search data stored in different nodes of the same search structure tree are different.

[0084] Note that the candidate search data stored in each node can be different in different search structure trees. Alternatively, there may be nodes in one or some search structure trees where the candidate search data is the same as that in the nodes of other search structure trees.

[0085] However, generally speaking, in order to improve the search efficiency, if there are nodes in one or some search structure trees where the candidate search data is the same as that in the nodes of other search structure trees, the candidate search results corresponding to the same candidate search data can be stored in a combined manner, retaining the nodes and the candidate search data in a certain tree, and updating the storage indication information, and deleting the nodes in other trees.

[0086] Specifically, when querying the search structure tree, it can be queried tree by tree, or some or all of the search structure trees can be queried in parallel to improve the query efficiency.

[0087] Among them, the candidate search result is not the result data obtained by searching for a certain candidate search data on the Internet, but can be data such as strings and pictures related to the candidate search data.

[0088] For example, as Figure 3 shown, when the user inputs the data to be searched as "today", the candidate search data in the search structure tree can be "今", "今日", "今天", "金日", etc. And each candidate search data has a corresponding candidate search result. For example, the candidate search results of the candidate search data "today" can be "今天天气", "今天的新闻", etc. And the candidate search result is not the result obtained by actually searching for today.

[0089] In the actual application process, generally, the search structure tree is constructed in advance so that the target search data can be quickly determined in combination with the search structure tree during the search. Therefore, before step 201, the data search method provided by the embodiments of the present invention may further include:

[0090] Determine the storage indication information of each candidate search result according to the storage location of the candidate search result stored in advance corresponding to the candidate search data;

[0091] Create nodes of the search structure tree based on the candidate search data;

[0092] Store each candidate search data and the storage indication information corresponding to the candidate search data into the nodes of the search structure tree respectively.

[0093] Taking the search structure tree as a trie as an example, the root node of the trie can be created first, and the root node does not contain characters. Then, according to the data relationship between the candidate search data, each candidate search data and the corresponding storage indication information are sequentially stored in the nodes of the trie. From the root node to a certain node, the characters passed through on the path are connected together to form the string corresponding to the node. All the characters included in the children nodes of each node are different.

[0094] For example, there are candidate search data "今", "今天", "今日". "今天" and "今日" are both obtained by adding characters based on "今". Therefore, "今" and the corresponding storage indication information are stored in the nodes of the first layer under the root node of the trie, while "今天", "今日" and their corresponding storage indication information are respectively stored in the two nodes of the next layer of the node where "今" is located.

[0095] Taking the search structure tree as a red-black tree as an example, a black root node can be created first, and then according to the data relationship between the candidate search data, each candidate search data and the corresponding storage indication information are sequentially stored in the nodes of the red-black tree, and the nodes of the red-black tree are labeled with colors.

[0096] Specifically, after determining the candidate search results corresponding to each candidate search data, the candidate search results can be stored to determine the storage locations of the candidate search results. That is to say, before the step of "determining the storage indication information of each candidate search result according to the storage location of the candidate search result stored in advance corresponding to the candidate search data", the data search method provided by the embodiments of the present invention may further include:

[0097] Obtain a search data set;

[0098] Perform data processing on the search data set to determine each candidate search data and the candidate search results of each candidate search data;

[0099] Store each candidate search result corresponding to each candidate search data.

[0100] Among them, as Figure 4 shown, performing data processing on the search data set may include: reading the search data set, converting the file of the search data set into a recognizable format, classifying the data in the search data set to determine candidate search data and their corresponding candidate search results, and so on.

[0101] Specifically, when storing the candidate search results, at least one storage location corresponding to the candidate search data can be set, and the candidate search results are stored in the storage location. For example, if storage units 1, 3, and 5 are set as the storage locations of candidate search data A, the candidate search results can be discretely stored in storage units 1, 3, and 5.

[0102] Alternatively, a storage set corresponding to the candidate search data can be created, and the step "storing each candidate search result corresponding to each candidate search data" can include:

[0103] Based on each candidate search data, create a storage set corresponding to each candidate search data;

[0104] The candidate search results corresponding to each candidate search data are stored in the storage set corresponding to each candidate search data.

[0105] For example, the created storage set can be in the form of an array, with each candidate search data corresponding to an array used to store candidate search results; or, the created storage set can be in the form of array cells, with each candidate search data corresponding to an array cell used to store candidate search results, and the array cells of all candidate search data corresponding to each search structure tree constitute the array corresponding to the search structure tree; or, each search structure tree corresponds to a data table, with each column or row of data corresponding to a candidate search data, and so on.

[0106] In some optional embodiments, each candidate search data may have multiple candidate search sub-results. To facilitate further processing of the target search result when returning the search results, the search matching degree of the candidate search sub-results can be pre-calculated. That is, the candidate search results include at least one candidate search sub-result.

[0107] At this point, before the step of "storing each candidate search result corresponding to each candidate search data", the data search method provided in this embodiment of the invention may further include:

[0108] Obtain the historical search characteristics of each candidate search sub-result;

[0109] Based on historical search characteristics, the search matching degree between each candidate search sub-result and the candidate search data is calculated.

[0110] Historical search features can be pre-calculated using data such as the number of online searches and click-through rates of users on candidate search sub-results within the search system. This embodiment of the invention does not limit the specific calculation method.

[0111] Correspondingly, to facilitate obtaining search matching scores, the search matching scores can be stored in correspondence with candidate search sub-results. The step "Storing each candidate search result corresponding to each candidate search data" includes:

[0112] Each candidate search sub-result and its search matching degree are stored corresponding to each candidate search data;

[0113] Accordingly, the step "Return the search results for the data to be searched based on the target candidate search results" may specifically include:

[0114] Search results are generated based on the search matching degree of each target candidate search sub-result in the target candidate search results, and the search results for the data to be searched are returned.

[0115] For example, there may be 5 target candidate search results. The three target candidate search results with the highest search matching degree can be selected as the search results and returned to the terminal. Alternatively, the display order of the 5 target candidate search results can be determined according to the search matching degree, and the target candidate search results can be displayed on the terminal in order of search matching degree from high to low, and so on.

[0116] Understandably, to avoid the timeout caused by too many candidate search results for short data, a tree structure corresponding to short data can be introduced. For example, a red-black tree can be used to store the storage indication information of the results corresponding to pinyin strings containing only a few Chinese characters or with a length less than a certain threshold, which can speed up the search and avoid timeout.

[0117] Therefore, before the step of "querying at least one pre-created search structure tree based on the data to be searched", the data search method provided in this embodiment of the invention may further include:

[0118] Determine the data length corresponding to the data to be searched based on the data to be searched.

[0119] Correspondingly, the step "query at least one pre-created search structure tree based on the data to be searched" may specifically include:

[0120] When the data length is less than a preset length threshold, at least one pre-created short data structure tree is queried based on the data to be searched.

[0121] When the data length is not less than a preset length threshold, at least one pre-created long data structure tree is queried based on the data to be searched.

[0122] The short data structure tree can be either a trie or a red-black tree. The construction process of the short data structure tree is similar to that of the aforementioned search structure tree, and will not be described again in this embodiment of the invention.

[0123] In some optional examples, the format of candidate search data may differ from that of the data to be searched. Therefore, the data to be searched needs to be processed before the target candidate search data corresponding to the data to be searched can be matched. That is, the step "query at least one pre-created search structure tree based on the data to be searched" may specifically include:

[0124] Perform text processing on the data to be searched to obtain the search string corresponding to the data to be searched;

[0125] Based on the search string, invoke the search structure tree query interface to query at least one pre-created search structure tree.

[0126] Specifically, text processing of the data to be searched may include converting the data to be searched into pinyin or into a string composed of the first characters of pinyin. Of course, the original form of the data to be searched may also be retained. This embodiment of the invention does not limit this.

[0127] 202. When a target search data matching the data to be searched is determined from the candidate search data, the target storage indication information corresponding to the target search data is obtained from the node where the target search data is located.

[0128] The target search data refers to candidate search data that matches the data to be searched. For example, the target search data may have a matching degree with the original data of the data to be searched that is greater than a preset matching threshold, such as 90%; or, the first character of the pinyin of the target search data may be the same as the first character of the pinyin of the data to be searched, and so on. The matching method can be set by technicians according to the actual application situation, and this embodiment of the invention does not limit it.

[0129] There can be one or more nodes containing the target search data. When there are multiple nodes, they are located in different search structure trees. For example, the node containing the target search data could be node 1 in search structure tree A, or it could be node 1 in search structure tree A and node 2 in search structure tree B.

[0130] The target storage indication information can be the array index of the array cell corresponding to the target search data in the array, or the column or row number of the target search data in the data table, etc.

[0131] 203. Based on the target storage indication information, obtain the target candidate search results from the storage location of the target candidate search results in the target search data.

[0132] In this embodiment of the invention, a storage set corresponding to candidate search data can be created. The candidate search results of each candidate search data are stored in the storage set corresponding to the candidate search data. The target storage indication information is used to indicate the storage location of the storage set.

[0133] Correspondingly, the step "based on the target storage indication information, obtain the target candidate search results from the storage location where the target candidate search results of the target search data are located" may specifically include:

[0134] Based on the target storage indication information, determine the storage location of the target storage set corresponding to the target search data from at least one storage set corresponding to the search structure tree where the target search data is located;

[0135] Retrieve target candidate search results from the storage location of the target storage set.

[0136] For example, the created storage set can be in the form of an array, with each candidate search data corresponding to an array used to store candidate search results; or, the created storage set can be in the form of array cells, with each candidate search data corresponding to an array cell used to store candidate search results, and the array cells of all candidate search data corresponding to each search structure tree constitute the array corresponding to the search structure tree; or, each search structure tree corresponds to a data table, with each column or row of data corresponding to a candidate search data, and so on.

[0137] Specifically, taking the storage set corresponding to the candidate search data as the unit of the search results array composed of the candidate search results of the candidate search data as an example, at least one storage set corresponding to each search structure tree constitutes the search results array corresponding to the search structure tree, and the storage indication information is the array index of the search results array unit where the candidate search results are located in the search results array.

[0138] For example, such as Figure 5 As shown, when constructing the prefix tree, key-value pairs involving specific results are placed into an array with their corresponding values ​​arranged compactly. The array header is a four-byte integer representing the total length of the array in bytes. Each unit in the diagram represents a value, consisting of multiple elements. The unit header is represented by a two-byte integer, indicating the number of score-candidate search result pairs (float-char*) in the unit. Based on the unit header (the header size can be set differently depending on the data search system, such as int16), we know there are N float-char* pairs, corresponding to N possible results.

[0139] At this point, the step "determine the storage location of the target storage set corresponding to the target search data from at least one storage set corresponding to the search structure tree where the target search data is located, based on the target storage indication information" can specifically include:

[0140] Based on the target array index corresponding to the target search data, determine the storage location of the target search result array cell corresponding to the target search data from the search result array corresponding to the search structure tree where the target search data is located.

[0141] In this embodiment of the invention, based on a tree structure, during offline construction, all values ​​of a single tree are placed in the same array and arranged compactly. The nodes inside the tree only store the index of the value in the array. This method retains the advantage of the tree structure in improving the request processing speed of the background, while greatly reducing the memory usage of the search tree structure system.

[0142] Based on this, the internal structure is divided into multiple prefix trees and has adaptive scalability, which can dynamically increase or decrease the number of trees without external awareness. It can also query multiple trees in parallel, solving the problem of reduced processing speed for large datasets with a single tree. Under the same dataset size, the request processing speed of the data search method provided in this embodiment of the invention is increased by N times, where N is the number of trees.

[0143] In some optional embodiments, the node may store candidate search data and storage indication information that indicates the storage location of each candidate search sub-result. That is, the target storage indication information is used to indicate the storage location of the candidate search sub-result within the storage set;

[0144] At this point, the step "Based on the target storage indication information, obtain the target candidate search results from the storage location where the target candidate search results of the target search data are located" may specifically include:

[0145] Based on the target search data, determine the target storage set corresponding to the target search data from at least one storage set corresponding to the search structure tree where the target search data is located;

[0146] Based on the target storage indication information, the target candidate search results are obtained from the storage location of the target candidate search results in the storage set of the target search data.

[0147] 204. Based on the target candidate search results, return the search results for the data to be searched.

[0148] In some optional embodiments, each candidate search data may have multiple candidate search sub-results. To facilitate user selection, the target search results may be further processed before returning the search results. That is, the target candidate search results include at least two target candidate search sub-results.

[0149] Correspondingly, the step "Return the search results for the data to be searched based on the target candidate search results" can specifically include:

[0150] Obtain the historical search characteristics of each target candidate search sub-result;

[0151] Based on historical search features, calculate the search matching degree between each target candidate search sub-result and the data to be searched;

[0152] Search results are generated based on the search relevance, and the search results for the data to be searched are returned.

[0153] Historical search features can be pre-calculated using data such as the number of online searches and click-through rates of users on candidate search sub-results within the search system. This embodiment of the invention does not limit the specific calculation method.

[0154] Specifically, when generating search results, there can be 5 target candidate search sub-results in the target candidate search results. The three target candidate search sub-results with the highest search matching degree can be selected as the search results and returned to the terminal. Alternatively, the display order of the 5 target candidate search sub-results can be determined according to the search matching degree, and the target candidate search sub-results can be displayed on the terminal in order of search matching degree from high to low, and so on.

[0155] Understandably, since multiple search structure trees can exist during data searching, it's possible that candidate search data in one or more search structure trees might be identical to candidate search data in nodes of other search structure trees. In such cases, when obtaining identical or different target candidate search results corresponding to the same candidate search data from different search structure trees, the target candidate search results can be merged.

[0156] In practical applications, as the content evolves, the search structure tree also needs to be updated. That is, the number of elements in the search structure tree must be at least one. The data search method provided in this embodiment of the invention may further include:

[0157] Load and update the search structure tree;

[0158] Detect the access status of each search structure tree, including no access status and accessed status;

[0159] If a search structure tree has an access status of no access, delete the search structure tree.

[0160] If a search structure tree exists in the visited state, retain the search structure tree until its access status changes to unvisited, then delete the search structure tree.

[0161] Specifically, when deleting a search structure tree, it can be done only when all search structure trees are in an inaccessible state, or it can be done by deleting only one search structure tree when it is in an inaccessible state.

[0162] For example, after loading and updating the search structure tree, there might be a situation where both the updated search structure tree and the search structure tree exist. In this case, new requests after loading and updating the search structure tree will access the updated search structure tree, while older requests before loading and updating the search structure tree will still access the search structure tree. The search structure tree can only be deleted after all older requests have finished.

[0163] Therefore, by using asynchronous destruction of the search structure tree, it can be ensured that old data is only deleted after no requests have been made to access it, thus avoiding data query failures during the updating of the search structure tree and the switching of the search structure tree.

[0164] In this embodiment of the invention, the search structure tree can have one or more trees, and the number of trees in the updated search structure tree may differ from the number of trees in the original search structure tree. In this case, it is necessary to adjust the number of search structure trees to adjust the storage space of the search structure trees. The step "Load and Update Search Structure Tree" may specifically include:

[0165] Determine the number of times the search structure tree needs to be updated;

[0166] When the number of times the search structure tree is updated differs from the total number of search structure trees, adjust the number of search structure trees based on the number of times the search structure tree is updated.

[0167] Load and update the search structure tree based on the number of elements in the adjusted search structure tree.

[0168] like Figure 6 As shown, when loading and updating the search structure tree, the number of search structure trees to be updated is determined. If the number of search structure trees to be updated is greater than the number of the original search structure trees (old Trie), the number of search structure trees is increased; if the number of search structure trees to be updated is less than the original number, the number of the original search structure trees is decreased. At this time, the number of search structure trees after adjustment can also be locked to ensure that no more requests access the deleted search structure trees.

[0169] In other words, the step "when the number of search structure trees updated is different from the number of search structure trees, adjust the number of search structure trees according to the number of search structure trees updated" can include:

[0170] When the number of updated search tree structures is greater than the number of search search tree structures, increase the number of search search tree structures to make the number of search search tree structures the same as the number of updated search search tree structures.

[0171] When the number of updated search tree structures is less than the number of search search tree structures, reduce the number of search search tree structures to make the number of search search tree structures the same as the number of updated search search tree structures.

[0172] By adjusting the number of trees in the search structure tree, when a data search request is received, the number of trees accessed is the same as the number of trees in the adjusted search structure tree, thus avoiding the data search request accessing the original search structure tree.

[0173] As can be seen from the above, embodiments of the present invention can query at least one pre-created search structure tree based on the data to be searched. Each node of the search structure tree stores a candidate search data and storage indication information of the candidate search results of the candidate search data. The storage indication information is used to indicate the storage location of the candidate search results. When a target search data matching the data to be searched is determined from the candidate search data, the target storage indication information corresponding to the target search data is obtained from the node where the target search data is located. Based on the target storage indication information, the target candidate search results are obtained from the storage location where the target candidate search results of the target search data are located. Based on the target candidate search results, the search results of the data to be searched are returned. Since the tree structure in the data structure is used to implement the indexing of candidate search data and candidate search results in the embodiments of the present invention, the response speed of data search can be improved and the data search time can be saved. At the same time, the nodes of the search structure tree store storage indication information instead of candidate search results, which can save the memory and computing resources occupied by the search structure tree.

[0174] Based on the methods described in the preceding embodiments, the following examples will provide further detailed explanations.

[0175] In this embodiment, the combination Figure 1 The system will be explained.

[0176] like Figure 7 As shown, the data search method in this embodiment can be described in the following specific process:

[0177] 701. The server obtains the search dataset, processes the search dataset, determines each candidate search data and its candidate search results, and stores the candidate search results corresponding to each candidate search data into the array cells corresponding to each candidate search data.

[0178] The server can initiate an offline build process, sequentially reading large datasets. It processes the raw data, converting it into a recognizable format and generating the intermediate data needed for the prefix tree.

[0179] The large dataset is pre-built, and its content can be divided into rows, with each row consisting of JSON format. It's understandable that dividing the data into rows is merely one offline dataset format and processing method; in principle, any offline dataset in any format can be processed sequentially to achieve step 701.

[0180] Generally, the raw data is in JSON format, containing candidate search results and their corresponding scores. The scores are pre-calculated based on features such as online search volume and click-through rate. A recognizable format refers to converting the JSON format into protobuf format, which allows for easier parsing and reading by programs.

[0181] 702. The server constructs a trie and stores candidate search data with a data length not less than a preset threshold and the array indices corresponding to the candidate search data into the nodes of the trie.

[0182] A Trie, also known as a word lookup tree or key tree, is a tree-like data structure and a variant of a hash tree. Its typical application is for counting and sorting large numbers of strings (but not limited to strings), so it is frequently used in search systems for text word frequency statistics. Its advantages include minimizing unnecessary string comparisons and higher query efficiency than hash tables. The core idea of ​​a Trie is to trade space for time, utilizing the common prefixes of strings to reduce query time overhead and thus improve efficiency.

[0183] A trie has three fundamental properties: the root node contains no characters; every node except the root node contains only one character; the characters along the path from the root node to any other node, when concatenated, form the string corresponding to that node; and all child nodes of each node contain distinct characters.

[0184] 703. The server constructs a red-black tree and stores candidate search data whose data length is less than a preset threshold and the array index corresponding to the candidate search data into the nodes of the red-black tree.

[0185] Compared to the prefix tree recall method using two arrays, the data search method of this invention reduces memory usage to one-tenth, CPU usage to one-eighth, and request time to one-quarter of the original, under the same data volume and request conditions. Ultimately, the number of machines required for recall can be reduced from 40 to 5, and the existing online related word dataset has expanded from 30 million to over 100 million, effectively supporting the expansion of larger-scale online datasets and significantly improving recall quality.

[0186] 704. The terminal sends a data search request to the server. The data search request includes the data to be searched.

[0187] For example Figure 3 As shown, users can enter "today" as the data to be searched in the terminal, and the terminal responds to the user's input by generating a data search request.

[0188] 705. The server obtains the data to be searched and determines the data length corresponding to the data to be searched based on the data to be searched.

[0189] Specifically, the server can perform text processing on the data to be searched, which may include converting the data to be searched into pinyin or into a string composed of the first characters of pinyin, etc. Of course, the original form of the data to be searched may also be retained, and this embodiment of the invention does not limit this.

[0190] Data length refers to the number of characters in the processed string, the length of the string in bytes, or the length of the data to be searched in bytes in its original form, etc.

[0191] 706. When the data length is less than the preset length threshold, the server queries at least one pre-created red-black tree based on the data to be searched. When the data length is not less than the preset length threshold, the server queries at least one pre-created trie based on the data to be searched.

[0192] Understandably, to avoid the timeout caused by too many candidate search results for short data, a tree structure corresponding to short data can be introduced. For example, a red-black tree can be used to store the storage indication information of the results corresponding to pinyin strings containing only a few Chinese characters or with a length less than a certain threshold, which can speed up the search and avoid timeout.

[0193] The construction process of a red-black tree is similar to that of a trie, and will not be described in detail in this embodiment of the invention.

[0194] 707. When a target search data matching the data to be searched is determined from the candidate search data, the server obtains the array index corresponding to the target search data from the node where the target search data is located.

[0195] 708. The server retrieves the target candidate search results from the array corresponding to the tree of the target search data based on the array index.

[0196] In some optional embodiments, each candidate search sub-result and its search matching degree can be stored in an array cell corresponding to each candidate search data. Therefore, when obtaining the target candidate search result, each candidate search sub-result and its search matching degree can be obtained.

[0197] 709. The server returns the search results for the data to be searched to the terminal based on the target candidate search results.

[0198] For example, there may be 5 target candidate search results. The three target candidate search results with the highest search matching degree can be selected as the search results and returned to the terminal. Alternatively, the display order of the 5 target candidate search results can be determined according to the search matching degree, and the target candidate search results can be displayed on the terminal in order of search matching degree from high to low, and so on.

[0199] 710. The terminal receives the search results sent by the server and displays the search results.

[0200] As can be seen from the above, in this embodiment of the invention, a tree structure is used to index the candidate search data and the candidate search results. Therefore, the response speed of data search can be improved and the data search time can be saved. At the same time, the nodes of the search tree structure store storage indication information rather than candidate search results, which can save the memory and computing resources occupied by the search tree structure.

[0201] To better implement the above methods, the present invention also provides a data search device.

[0202] refer to Figure 8 The device includes:

[0203] The tree query unit 801 can be used to query at least one pre-created search structure tree based on the data to be searched. Each node of the search structure tree stores a candidate search data and storage indication information of the candidate search results of the candidate search data. The storage indication information can be used to indicate the storage location of the candidate search results.

[0204] The instruction information acquisition unit 802 can be used to acquire target storage instruction information corresponding to the target search data from the node where the target search data is located when a target search data matching the data to be searched is determined from the candidate search data.

[0205] The search result acquisition unit 803 can be used to acquire target candidate search results from the storage location of the target candidate search results of the target search data based on the target storage indication information.

[0206] The search result return unit 804 can be used to return the search results for the data to be searched based on the target candidate search results.

[0207] In some optional embodiments, the candidate search results for each candidate search data are stored in a storage set corresponding to the candidate search data, and the target storage indication information can be used to indicate the storage location of the storage set;

[0208] The search result acquisition unit 803 can be used to determine the storage location of the target storage set corresponding to the target search data from at least one storage set corresponding to the search structure tree where the target search data is located, based on the target storage indication information.

[0209] Retrieve target candidate search results from the storage location of the target storage set.

[0210] In some optional embodiments, the storage set corresponding to the candidate search data is the search result array unit composed of the candidate search results of the candidate search data, and at least one storage set corresponding to each search structure tree constitutes the search result array corresponding to the search structure tree. The storage indication information is the array subscript of the search result array unit where the candidate search result is located in the search result array.

[0211] The search result acquisition unit 803 can be used to determine the storage location of the target search result array cell corresponding to the target search data from the search result array corresponding to the search structure tree where the target search data is located, based on the target array index corresponding to the target search data.

[0212] In some alternative embodiments, such as Figure 9 As shown, the data search device provided in this embodiment of the invention may further include a tree creation unit 805, which can be used to determine the storage indication information of each candidate search result according to the storage location of the candidate search results that correspond to the candidate search data storage in advance.

[0213] Based on the candidate search data, create nodes for the search structure tree;

[0214] Each candidate search data and its corresponding storage instruction information are stored in a node of the search structure tree.

[0215] In some optional embodiments, the data search apparatus provided in this embodiment of the invention may further include a data storage unit 806, which can be used to acquire a search dataset;

[0216] The search dataset is processed to determine each candidate search data and the candidate search results for each candidate search data.

[0217] Each candidate search result is stored in relation to its corresponding candidate search data.

[0218] In some optional embodiments, the data storage unit 806 can be used to create a storage set corresponding to each candidate search data based on each candidate search data;

[0219] The candidate search results corresponding to each candidate search data are stored in the storage set corresponding to each candidate search data.

[0220] In some optional embodiments, the candidate search results may include at least one candidate search sub-result; the data search apparatus provided in this embodiment of the invention may also include a result matching degree calculation unit 807, which can be used to obtain the historical search features of each candidate search sub-result;

[0221] Based on historical search characteristics, calculate the search matching degree between each candidate search sub-result and the candidate search data;

[0222] The data storage unit 806 can be used to store each candidate search sub-result and its search matching degree corresponding to each candidate search data;

[0223] The search result return unit 804 can be used to generate search results based on the search matching degree of each target candidate search sub-result in the target candidate search results, and return the search results for the data to be searched.

[0224] In some optional embodiments, the data search device provided in this embodiment of the invention may further include a length determination unit 808, which can be used to determine the data length corresponding to the data to be searched based on the data to be searched.

[0225] Correspondingly, the tree query unit 801 can be used to query at least one pre-created short data structure tree based on the data to be searched when the data length is less than a preset length threshold.

[0226] When the data length is not less than a preset length threshold, at least one pre-created long data structure tree is queried based on the data to be searched.

[0227] In some optional embodiments, the target candidate search results may include at least two target candidate search sub-results, and the search result return unit 804 may be used to obtain the historical search features of each target candidate search sub-result.

[0228] Based on historical search features, calculate the search matching degree between each target candidate search sub-result and the data to be searched;

[0229] Search results are generated based on the search relevance, and the search results for the data to be searched are returned.

[0230] In some optional embodiments, the number of search structure trees is at least 1. The data search device provided in this embodiment of the invention may further include a tree update unit 809, which can be used to load and update the search structure tree.

[0231] Detect the access status of each search structure tree. The access status can include no access status and accessed status.

[0232] If a search structure tree has an access status of no access, delete the search structure tree.

[0233] If a search structure tree exists in the visited state, retain the search structure tree until its access status changes to unvisited, then delete the search structure tree.

[0234] In some optional embodiments, the tree update unit 809 can be used to determine the number of times to update the search tree structure;

[0235] When the number of times the search structure tree is updated differs from the total number of search structure trees, adjust the number of search structure trees based on the number of times the search structure tree is updated.

[0236] Load and update the search structure tree based on the number of elements in the adjusted search structure tree.

[0237] In some optional embodiments, the tree update unit 809 can be used to increase the number of search tree structures so that the number of search tree structures is the same as the number of search tree structures when the number of updated search tree structures is greater than the number of search tree structures.

[0238] When the number of updated search tree structures is less than the number of search search tree structures, reduce the number of search search tree structures to make the number of search search tree structures the same as the number of updated search search tree structures.

[0239] In some optional embodiments, the tree query unit 801 can be used to perform text processing on the data to be searched to obtain the search string corresponding to the data to be searched;

[0240] Based on the search string, invoke the search structure tree query interface to query at least one pre-created search structure tree.

[0241] As can be seen from the above, the data search device provided in this embodiment of the invention uses a tree structure to index candidate search data and candidate search results. Therefore, it can improve the response speed of data search and save data search time. At the same time, the nodes of the search structure tree store storage indication information rather than candidate search results, which can save the memory and computing resources occupied by the search structure tree.

[0242] Furthermore, embodiments of the present invention also provide an electronic device, which may be a terminal or a server, etc. Figure 10 As shown, it illustrates a structural schematic diagram of the electronic device involved in an embodiment of the present invention, specifically:

[0243] The electronic device may include a radio frequency (RF) circuit 1001, a memory 1002 including one or more computer-readable storage media, an input unit 1003, a display unit 1004, a sensor 1005, an audio circuit 1006, a wireless fidelity (WiFi) module 1007, a processor 1008 including one or more processing cores, and a power supply 1009, etc. Those skilled in the art will understand that... Figure 9 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:

[0244] RF circuit 1001 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and hands it over to one or more processors 1008 for processing; additionally, it transmits uplink data to the base station. Typically, RF circuit 1001 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, RF circuit 1001 can also communicate wirelessly with networks and other devices. Wireless communication can use any communication standard or protocol, including but not limited to GSM, GPRS, CDMA, WCDMA, LTE, email, and SMS.

[0245] The memory 1002 can be used to store software programs and modules. The processor 1008 executes various functional applications and data processing by running the software programs and modules stored in the memory 1002. The memory 1002 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device (such as audio data, telephone directory, etc.). In addition, the memory 1002 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 1002 may also include a memory controller to provide access to the memory 1002 for the processor 1008 and the input unit 1003.

[0246] The input unit 1003 can be used to receive input digital or character information, and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control. Specifically, in one embodiment, the input unit 1003 may include a touch-sensitive surface and other input devices. The touch-sensitive surface, also known as a touch display or touchpad, can collect user touch operations on or near it (e.g., user operations using fingers, styluses, or any suitable object or accessory on or near the touch-sensitive surface), and drive corresponding connection devices according to a pre-set program. Optionally, the touch-sensitive surface may include a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, transmitting the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 1008, and can receive and execute commands from the processor 1008. Furthermore, various types of touch-sensitive surfaces, such as resistive, capacitive, infrared, and surface acoustic wave, can be used. In addition to the touch-sensitive surface, the input unit 1003 may also include other input devices. Specifically, other input devices may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.

[0247] The display unit 1004 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of electronic devices. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. The display unit 1004 may include a display panel, optionally configured as a liquid crystal display (LCD), organic light-emitting diode (OLED), or similar form. Furthermore, a touch-sensitive surface may cover the display panel. When the touch-sensitive surface detects a touch operation on or near it, it transmits the information to the processor 1008 to determine the type of touch event. Subsequently, the processor 1008 provides corresponding visual output on the display panel according to the type of touch event. Although in Figure 6 In this context, the touch-sensitive surface and the display panel are two separate components for implementing input and output functions. However, in some embodiments, the touch-sensitive surface and the display panel can be integrated to achieve both input and output functions.

[0248] The electronic device may also include at least one sensor 1005, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel according to the ambient light level, and the proximity sensor can turn off the display panel and / or backlight when the electronic device is moved to the ear. As a type of motion sensor, a gravity acceleration sensor can detect the magnitude of acceleration in various directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc. Other sensors that may be configured in the electronic device, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.

[0249] Audio circuitry 1006, a speaker, and a microphone provide an audio interface between the user and the electronic device. Audio circuitry 1006 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 1006, converted back into audio data, and processed by processor 1008. The processed data is then transmitted via RF circuitry 1001 to, for example, another electronic device, or output to memory 1002 for further processing. Audio circuitry 1006 may also include an earphone jack to facilitate communication between external headphones and the electronic device.

[0250] WiFi is a short-range wireless transmission technology. Electronic devices using the WiFi module 1007 can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 6 WiFi module 1007 is shown, but it is understood that it is not a necessary component of an electronic device and can be omitted as needed without changing the nature of the invention.

[0251] The processor 1008 is the control center of the electronic device, connecting various parts of the phone via various interfaces and lines. It executes software programs and / or modules stored in the memory 1002, and calls data stored in the memory 1002, performing various functions and processing data to conduct overall testing of the phone. Optionally, the processor 1008 may include one or more processing cores; preferably, the processor 1008 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 1008.

[0252] The electronic device also includes a power supply 1009 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 1008 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 1009 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0253] Although not shown, the electronic device may also include a camera, Bluetooth module, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 1008 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 1002 according to the following instructions, and the processor 1008 runs the applications stored in the memory 1002 to realize various functions, as follows:

[0254] Based on the data to be searched, at least one pre-created search structure tree is queried. Each node of the search structure tree stores a candidate search data and storage indication information of the candidate search results of the candidate search data. The storage indication information is used to indicate the storage location of the candidate search results.

[0255] When target search data that matches the data to be searched is determined from the candidate search data, the target storage indication information corresponding to the target search data is obtained from the node where the target search data is located.

[0256] Based on the target storage indication information, retrieve the target candidate search results from the storage location where the target candidate search results of the target search data are located;

[0257] Based on the target candidate search results, return the search results for the data to be searched.

[0258] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0259] To this end, embodiments of the present invention provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the data search methods provided in the embodiments of the present invention. For example, the instructions can execute the following steps:

[0260] Based on the data to be searched, at least one pre-created search structure tree is queried. Each node of the search structure tree stores a candidate search data and storage indication information of the candidate search results of the candidate search data. The storage indication information is used to indicate the storage location of the candidate search results.

[0261] When target search data that matches the data to be searched is determined from the candidate search data, the target storage indication information corresponding to the target search data is obtained from the node where the target search data is located.

[0262] Based on the target storage indication information, retrieve the target candidate search results from the storage location where the target candidate search results of the target search data are located;

[0263] Based on the target candidate search results, return the search results for the data to be searched.

[0264] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0265] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0266] Since the instructions stored in the computer-readable storage medium can execute the steps in any of the data search methods provided in the embodiments of the present invention, the beneficial effects that any of the data search methods provided in the embodiments of the present invention can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.

[0267] According to one aspect of this application, a computer program product or computer program is also provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the methods provided in the various optional implementations of the above embodiments.

[0268] The foregoing has provided a detailed description of a data search method, apparatus, electronic device, storage medium, and program product provided by embodiments of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A data search method, characterized in that, include: The method involves querying at least one pre-created search structure tree based on the data to be searched, including: determining the data length corresponding to the data to be searched based on the data to be searched; when the data length is less than a preset length threshold, querying at least one pre-created short data structure tree based on the data to be searched; when the data length is not less than the preset length threshold, querying at least one pre-created long data structure tree based on the data to be searched; each node of the search structure tree stores a candidate search data and storage indication information of the candidate search results of the candidate search data, wherein the storage indication information is the array index of the search result array unit where the candidate search result is located in the search result array; When target search data matching the data to be searched is determined from the candidate search data, the target storage indication information corresponding to the target search data is obtained from the node where the target search data is located. Based on the target storage indication information, obtaining the target candidate search results from the storage location of the target candidate search results of the target search data includes: determining the storage location of the target search result array unit corresponding to the target search data from the search result array corresponding to the search structure tree where the target search data is located, according to the target array index corresponding to the target search data; Returning search results for the data to be searched based on the target candidate search results includes: if the target candidate search results include at least two target candidate search sub-results; obtaining the historical search features of each target candidate search sub-result; calculating the search matching degree between each target candidate search sub-result and the data to be searched based on the historical search features; generating search results based on the search matching degree; and returning the search results for the data to be searched.

2. The data search method according to claim 1, characterized in that, The candidate search results for each candidate search data are stored in the storage set corresponding to the candidate search data, and the target storage indication information is used to indicate the storage location of the storage set; The step of obtaining the target candidate search results from the storage location of the target candidate search results in the target search data based on the target storage indication information includes: Based on the target storage indication information, determine the storage location of the target storage set corresponding to the target search data from at least one storage set corresponding to the search structure tree where the target search data is located; The target candidate search results are obtained from the storage location of the target storage set.

3. The data search method according to claim 2, characterized in that, The storage set corresponding to the candidate search data is a search result array unit composed of the candidate search results of the candidate search data, and at least one storage set corresponding to each search structure tree constitutes the search result array corresponding to the search structure tree.

4. The data search method according to claim 1, characterized in that, Before querying at least one pre-created search structure tree based on the data to be searched, the method further includes: Based on the storage location of the candidate search results that corresponds to the candidate search data storage in advance, determine the storage indication information of each candidate search result; Based on the candidate search data, create nodes for the search structure tree; Each candidate search data and its corresponding storage indication information are stored in a node of the search structure tree.

5. The data search method according to claim 4, characterized in that, Before determining the storage indication information of each candidate search result based on the storage location of the candidate search results pre-corresponding to the candidate search data storage, the method further includes: Obtain the search dataset; The search dataset is processed to determine each candidate search data and each candidate search result of the candidate search data. Each candidate search result is stored in relation to each candidate search data.

6. The data search method according to claim 5, characterized in that, The step of storing each of the candidate search results corresponding to each of the candidate search data includes: Based on each of the candidate search data, a storage set corresponding to each of the candidate search data is created; The candidate search results corresponding to each candidate search data are stored in the storage set corresponding to each candidate search data.

7. The data search method according to claim 5, characterized in that, The candidate search results include at least one candidate search sub-result; Before storing each of the candidate search results corresponding to each of the candidate search data, the method further includes: Obtain the historical search features of each of the candidate search sub-results; Based on the historical search features, calculate the search matching degree between each candidate search sub-result and the candidate search data; The step of storing each of the candidate search results corresponding to each of the candidate search data includes: Each candidate search sub-result and its search matching degree are stored corresponding to each candidate search data; The step of returning the search results for the data to be searched based on the target candidate search results includes: Search results are generated based on the search matching degree of each target candidate search sub-result in the target candidate search results, and the search results of the data to be searched are returned.

8. The data search method according to claim 1, characterized in that, The number of search structure trees is at least 1, and the method further includes: Load and update the search structure tree; Detect the access status of each of the search structure trees, the access status including no access status and accessed status; If a search structure tree has an access status of no access, delete the search structure tree. When a search structure tree is in the accessed state, the search structure tree is retained until the accessed state of the search structure tree is in the unaccessed state, and then the search structure tree is deleted.

9. The data search method according to claim 8, characterized in that, The loading and updating of the search structure tree includes: Determine the number of times the search structure tree needs to be updated; When the number of updated search structure trees is different from the number of search structure trees, the number of search structure trees is adjusted according to the number of updated search structure trees; Based on the number of elements in the adjusted search structure tree, the updated search structure tree is loaded.

10. The data search method according to claim 9, characterized in that, When the number of updated search structure trees differs from the number of search structure trees, adjusting the number of search structure trees based on the number of updated search structure trees includes: When the number of updated search structure trees is greater than the number of search structure trees, the number of search structure trees is increased according to the number of updated search structure trees so that the number of search structure trees is the same as the number of updated search structure trees; When the number of updated search structure trees is less than the number of search structure trees, the number of search structure trees is reduced according to the number of updated search structure trees so that the number of search structure trees is the same as the number of updated search structure trees.

11. The data search method according to any one of claims 1-10, characterized in that, The step of querying at least one pre-created search structure tree based on the data to be searched includes: The search data to be searched is processed to obtain the search string corresponding to the search data; Based on the search string, invoke the search structure query interface to query at least one pre-created search structure.

12. A data search device, characterized in that, include: A tree query unit is used to query at least one pre-created search structure tree based on the data to be searched, including: determining the data length corresponding to the data to be searched based on the data to be searched; when the data length is less than a preset length threshold, querying at least one pre-created short data structure tree based on the data to be searched; when the data length is not less than the preset length threshold, querying at least one pre-created long data structure tree based on the data to be searched; each node of the search structure tree stores a candidate search data and storage indication information of the candidate search results of the candidate search data, wherein the storage indication information is the array index of the search result array unit where the candidate search result is located in the search result array; The instruction information acquisition unit is used to acquire target storage instruction information corresponding to the target search data from the node where the target search data is located when a target search data matching the data to be searched is determined from the candidate search data. The search result acquisition unit is used to acquire the target candidate search results from the storage location of the target candidate search results of the target search data based on the target storage indication information, including: determining the storage location of the target search result array unit corresponding to the target search data from the search result array corresponding to the search structure tree where the target search data is located, according to the target array index corresponding to the target search data; The search result return unit is used to return the search results of the data to be searched based on the target candidate search results, including: if the target candidate search results include at least two target candidate search sub-results; obtaining the historical search features of each target candidate search sub-result; calculating the search matching degree between each target candidate search sub-result and the data to be searched based on the historical search features; generating search results based on the search matching degree; and returning the search results of the data to be searched.

13. An electronic device, characterized in that, It includes a memory and a processor; the memory stores an application program, and the processor is used to run the application program within the memory to perform the steps of the data search method according to any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the data search method according to any one of claims 1 to 11.

15. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the data search method as described in any one of claims 1 to 11.