Data search method, device, electronic device and storage medium

By creating a search index database in memory, indexing data segments with high similarity, the problem of long-term cold data search is solved, faster data search is achieved, and resource consumption is reduced.

CN114691677BActive Publication Date: 2025-02-14SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011639994.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-31
Publication Date
2025-02-14
Estimated Expiration
2040-12-31

AI Technical Summary

Technical Problem

In the prior art, data search based on feature value comparison, especially cold data search, takes a long time, mainly because a large amount of cold data is required to load a large amount of cold data into memory from an external storage medium for comparison.

Method used

By creating and maintaining a search index database in memory, indexing target data segments with high similarity from the database based on feature information, and then obtaining cold data from the external database based on these data segments, avoiding direct access to the external database Low speed for reading a lot of cold data.

Benefits of technology

It improves the speed of cold data search, reduces search time, and saves resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114691677B_ABST
    Figure CN114691677B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a data search method, device, electronic device and storage medium, the method comprising: obtaining a data search instruction, the data search instruction comprising feature information of the data to be searched and a first search time; comparing the first search time with a preset time threshold, if the first search time is greater than the time threshold, performing a first data search from a pre-built search index database based on the feature information, and obtaining a first search result; obtaining a target data segment from the first search result, obtaining first data to be searched based on the target data segment, and returning the first data to be searched as the data to be searched. Maintaining a search index database in memory and indexing the target data segment including data information therefrom based on the feature information avoids the low speed of directly reading a large amount of cold data from an external database, improves the speed of cold data search, and saves search time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data storage technology, and in particular to a data search method, device, electronic equipment and storage medium. Background Art

[0002] At present, data searches based on feature value comparison, such as those based on faces, human bodies, vehicles, non-motor vehicles, etc., are divided into hot and cold searches due to the limitation of computing and storage resources. Hot data search is to load data of a certain time (such as within 3 months) into the memory, and search data over a certain time is stored in the external storage medium, which is called cold data. As time goes by, data from earlier times and data that is not frequently used will become cold data, which will be stored in the external storage medium. When searching for this part of cold data, it is necessary to load all the cold data of the corresponding time into the memory and then perform feature value comparison search, which is called cold search, and the time of cold search will be longer. For the search of cold data, the general method is to read the cold data from the database and load it into the memory according to the time period, and then perform feature value comparison search. The speed of loading depends on the size of the loaded data and the IO performance of the medium storing the cold data. This method makes the data search process time-consuming. Summary of the invention

[0003] The embodiment of the present invention provides a data search method, which can improve the speed of data search and thus reduce the search time.

[0004] In a first aspect, an embodiment of the present invention provides a data search method, comprising:

[0005] Acquire a data search instruction, wherein the data search instruction includes feature information of the data to be searched and a first search time;

[0006] Comparing the first search time with a preset time threshold, if the first search time is greater than the time threshold, performing a first data search from a pre-built search index database based on the feature information, and obtaining a first search result;

[0007] A target data segment is obtained from the first search result, first data to be searched is obtained according to the target data segment, and the first data to be searched is returned as the data to be searched.

[0008] Optionally, the search index database includes multiple database indexes and multiple data segments; the pre-construction step of the search index database includes:

[0009] Creating a plurality of data segments, each data segment comprising a data identifier field, a similarity field, and a search time field;

[0010] Constructing multiple database indexes of the search index database according to multiple feature information;

[0011] Bind each data segment to the corresponding database index.

[0012] Optionally, performing a first data search from a pre-built search index database based on the feature information and obtaining a first search result includes:

[0013] Converting the feature information into the database index;

[0014] At least one corresponding data segment is obtained from the search index database according to the database index as the first search result.

[0015] Optionally, the step of acquiring a target data segment from the first search result, acquiring first data to be searched according to the target data segment, and returning the first data to be searched as the data to be searched includes:

[0016] sorting the data segments in the first search result according to the similarity field;

[0017] Obtain a data segment with the highest similarity field value as the target data segment; or

[0018] Acquire a data segment whose similarity field value is greater than a preset similarity threshold as a target data segment;

[0019] Based on the data identifier field of the target data segment, first data to be searched is acquired from an external database as the data to be searched and returned.

[0020] Optionally, after the step of acquiring first to-be-searched data from an external database as the to-be-searched data based on the data identifier field of the target data segment and returning the first to-be-searched data, the method further comprises:

[0021] Writing the current search time into the search time field of the target data segment;

[0022] The target data segment in the first search result is updated in the search index database.

[0023] Optionally, if the first search time is less than the time threshold, the method further includes:

[0024] Perform a second data search in the memory based on the feature information, and obtain a second search result of the second data search, where the second search result includes a second search time and second data to be searched;

[0025] The second to-be-searched data is returned as the to-be-searched data.

[0026] Optionally, the method further includes:

[0027] The second search result is stored in the pre-built search index database.

[0028] In a second aspect, an embodiment of the present invention provides a data search device, comprising:

[0029] An acquisition module, used to acquire a data search instruction, wherein the data search instruction includes feature information of the data to be searched and a first search time;

[0030] A search module, configured to compare the first search time with a preset time threshold, and if the first search time is greater than the time threshold, perform a first data search from a pre-built search index database based on the feature information, and obtain a first search result;

[0031] A returning module is used to obtain a target data segment from the first search result, obtain first data to be searched according to the target data segment, and return the first data to be searched as the data to be searched.

[0032] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the data search method provided in the embodiment of the present invention when executing the computer program.

[0033] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the data search method provided in the embodiment of the invention are implemented.

[0034] In an embodiment of the present invention, a data search instruction is obtained, the data search instruction includes feature information of the data to be searched and a first search time; the first search time is compared with a preset time threshold, and if the first search time is greater than the time threshold, a first data search is performed from a pre-built search index database based on the feature information, and a first search result is obtained; a target data segment is obtained from the first search result, and first data to be searched is obtained according to the target data segment, and the first data to be searched is returned as the data to be searched. By creating and maintaining a search index database in memory and indexing target data segments with high similarity from the search index database according to feature information, and then obtaining cold data from an external database according to these target data segments, the low speed of directly reading a large amount of cold data from an external database is avoided, the speed of cold data search is improved, and search time is saved. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0036] Figure 1 is a flow chart of a data search method provided by an embodiment of the present invention;

[0037] Figure 2 is a flow chart of a method for pre-building a search index database provided by an embodiment of the present invention;

[0038] Figure 3 is a flow chart of a first data search method provided by an embodiment of the present invention;

[0039] Figure 4 is a flow chart of a method for obtaining data to be searched according to a data segment provided by an embodiment of the present invention;

[0040] Figure 5 is a flowchart of another method for obtaining data to be searched according to a data segment provided by an embodiment of the present invention;

[0041] Figure 6 is a flow chart of another data search method provided by an embodiment of the present invention;

[0042] Figure 7 is a flow chart of another data search method provided by an embodiment of the present invention;

[0043] Figure 8 is a structural schematic diagram of a data search device provided by an embodiment of the present invention;

[0044] Fig. 9 It is a structural schematic diagram of a pre-construction device for a search index database provided by an embodiment of the present invention;

[0045] Fig.10 is a structural diagram of a search module provided by an embodiment of the present invention;

[0046] Fig.11 is a structural schematic diagram of a first return module provided by an embodiment of the present invention;

[0047] Fig.12 is a structural schematic diagram of another first return module provided by an embodiment of the present invention;

[0048] Fig.13 is a structural schematic diagram of another data search device provided by an embodiment of the present invention;

[0049] Fig.14 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the accompanying drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the accompanying drawings are used to distinguish different objects, not to describe a specific order.

[0051] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

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

[0053] See also Figure 1 , Figure 1 is a flow chart of a data search method provided by an embodiment of the present invention, such as Figure 1 As shown, the following steps are included:

[0054] 101. Get data search instructions.

[0055] The data search instruction includes characteristic information of the data to be searched and a first search time.

[0056] In the embodiment of the present invention, the data search instruction can be obtained through the command line entry of the operating system, or through other visual interfaces such as GUI or WEB pages, or can be obtained and converted through voice recognition, etc. The data search instruction includes at least one feature information of the data object to be obtained, for example, feature information of objects such as faces, vehicles, animals, etc. The feature information includes key point features of the object, such as two-dimensional or three-dimensional feature information such as noses and eyes of faces, and further can be identified and extracted through a neural network model.

[0057] The data search instruction also includes a first search time, which can be used to indicate the search time range of the data to be searched. It can be a period of time, such as three months, or a time point, such as 11:00 on August 15, 2019, that is, searching for certain data within this time period or at this time point.

[0058] 102. Compare the first search time with a preset time threshold. If the first search time is greater than the time threshold, perform a first data search from a pre-built search index database based on the feature information and obtain a first search result.

[0059] In an embodiment of the present invention, a time threshold can be pre-set and compared with the first search time to divide the data into hot data and cold data, that is, the time threshold can be used to divide the data into hot and cold (that is, the distance of usage time); specifically, if the first search time is less than the preset time threshold, or the difference between the current time and the first search time is less than the preset time threshold, the data to be searched is hot data, such as the first search time can be 2 months, and the preset time threshold can be 3 months, then the data search is a hot search, and the data to be searched can be hot data stored in the memory; if the first search time is greater than the preset time threshold, or the difference between the current time and the first search time is greater than the preset time threshold, then the data to be searched is cold data, such as the first search time can be 5 months, and the preset time threshold can be 3 months, then the data search is a cold search, and the data to be searched is cold data stored in the external storage medium. If the data to be searched is cold data, a cold search is performed, that is, a first data search is performed from a pre-built search index database according to the feature information. The search index database includes a database index and a data segment. The database index can be obtained according to the feature information, and then the data segment can be obtained according to the database index, so that the corresponding data search results can be obtained from the data segment.

[0060] Optionally, the search index database includes multiple database indexes and multiple data segments; see Figure 2, Figure 2 is a flow chart of a method for pre-building a search index database provided by an embodiment of the present invention, such as Figure 2 As shown, the steps of constructing the search index database specifically include:

[0061] 201. Create multiple data segments.

[0062] Each data segment includes a data identifier field, a similarity field, and a search time field.

[0063] Among them, the data identifier field can be used to identify the storage information of the data to be searched, such as the storage location, etc.; the similarity field can be used to indicate the degree of similarity between the acquired feature information and the feature information in the search index database; the search time field can be used to store the specific time information of a data search. The above-mentioned search index database can use an existing relational database, such as an instance of a MYSQL database. The above-mentioned data segment can be created through the operation interface or command line entry provided by the MYSQL database, using the corresponding SQL statement and the above-mentioned feature information as the index, such as: insert (data identifier field value, similarity field value, search time field value) where database index idx = feature information, indicating that in the above-mentioned search index database, a record is created in the database where the database index idx is the above-mentioned feature information, and the record is a data segment containing the above-mentioned data identifier field value, similarity field value and search time field value.

[0064] 202. Construct multiple database indexes of the search index database according to multiple feature information.

[0065] The above-mentioned feature information is the key information of the data to be obtained, such as the name of a file. For example, the name of a word document, a video file, etc., can also be a two-dimensional or three-dimensional feature of a face such as the nose and eyes. Specifically, the corresponding key features can be identified and extracted from the image as the above-mentioned feature information through a neural network model. Each feature information can be processed (such as encoded) and used as a database index when the above-mentioned data segment is created, so that the data segment can be obtained according to the feature information.

[0066] The database index of the search index database may be a string or a number. Specifically, the feature information may be converted into the database index of the search index database through a hash algorithm, thereby eliminating the need to store a large amount of feature information in the search index database, thereby saving storage resources.

[0067] 203. Bind each data segment to the corresponding database index.

[0068] In an embodiment of the present invention, one database index may correspond to multiple data segments, and the multiple data segments and one database index may be bound through key-value pairs through a two-dimensional table structure or a tree structure, so that the characteristic information of the object may be associated and managed with the multiple data segments.

[0069] Optional, see Figure 3 , Figure 3 is a flow chart of a first data search method provided by an embodiment of the present invention. Figure 3 As shown, the following steps are included:

[0070] 301. Convert the feature information into the database index.

[0071] In the embodiment of the present invention, the feature information may be converted into the database index by using a hash algorithm corresponding to the search index database to construct a database index.

[0072] 302. Acquire at least one corresponding data segment from the search index database according to the database index as the first search result.

[0073] In an embodiment of the present invention, the search index database runs in the memory, and the database index can be used to obtain multiple data segments similar to the feature information in the search index database by table lookup or tree search as the first search result.

[0074] 103. Acquire a target data segment from the first search result, acquire first data to be searched according to the target data segment, and return the first data to be searched as the data to be searched.

[0075] In an embodiment of the present invention, a plurality of data segments in the first search result that are similar to the feature information may be screened by performing similarity comparison to obtain a target data segment including the first data to be searched, and then the first data to be searched may be returned as the data to be searched.

[0076] For details, see Figure 4 , Figure 4 is a flowchart of a method for obtaining data to be searched according to a data segment provided by an embodiment of the present invention, such as Figure 4 As shown, the following steps are included:

[0077] 401. Sort the data segments in the first search result according to the similarity field.

[0078] In the embodiment of the present invention, the similarity can be calculated by comparing the acquired feature information with the feature information of each data segment and put into the similarity field, and the similarity can be a numerical value or a character to indicate the degree of similarity. The data segments with similar feature information in the first search result can be sorted in ascending or descending order according to the similarity in the similarity field.

[0079] 402. Obtain a data segment with the highest similarity field value as a target data segment; or obtain a data segment with a similarity field value greater than a preset similarity threshold as a target data segment.

[0080] In an embodiment of the present invention, among the multiple data segments with similar feature information that have been sorted in ascending or descending order, the one with the highest similarity value of the similarity field can be obtained as the target data segment; or a similarity threshold can be set in advance, and the data segment with a similarity field value greater than the preset similarity threshold among the multiple data segments with similar feature information is taken as the target data segment, which may contain multiple data segments, and then the one with the highest similarity value is selected as the final target data segment after sorting, and the target data segment contains relevant information of the data to be searched, such as the data identifier of the data to be searched.

[0081] 403. Based on the data identifier field of the target data segment, obtain first data to be searched from an external database as the data to be searched and return the data.

[0082] In an embodiment of the present invention, the data identifier field of the target data segment is used to store the search information of the first data to be searched, and the search information includes key information such as the storage location, storage time, and size of the first data to be searched, so as to facilitate reading the data. The first data to be searched can be stored in an external database, such as a hard disk, a disk, or even a network database, and then the data can be read after the corresponding storage address is obtained according to the search information, that is, a cold search is performed on the cold data.

[0083] In an embodiment of the present invention, a search index database is created and maintained in a memory and a target data segment with a high similarity is indexed from the search index database according to feature information. The target data segment includes relevant data information of the data to be searched, such as location information, time information, etc., and then cold data is obtained from an external database according to these data information. This avoids the low speed of directly reading a large amount of cold data from an external database, improves the speed of cold data search, and thus saves search time.

[0084] Optional, see Figure 5 , Figure 5is a flowchart of another method for obtaining data to be searched according to a data segment provided by an embodiment of the present invention. Figure 5 As shown, after step 403, the method further includes:

[0085] 501. Write the current search time into the search time field of the target data segment.

[0086] 502. Update the target data segment in the first search result in the search index database.

[0087] In an embodiment of the present invention, the current time of the system can be first obtained as the current search time, and then the current search time is written into the search time field of the target data segment in an overwritten manner, and then the overwritten target data segment is used to update the target data segment obtained from the first search result in the search index database. The current search time can be a time in a string format or a time in a digital format, so that it can be used to represent the most recent search time of the target data segment, which is convenient for a quick time comparison when the target data segment is obtained next time, thereby reducing the acquisition time of the target data segment.

[0088] Optional, see Figure 6 , Figure 6 is a flow chart of another data search method provided by an embodiment of the present invention. Figure 6 As shown, if the first search time is less than the time threshold, the data search method further includes:

[0089] 601. Perform a second data search in the memory based on the feature information, and obtain a second search result of the second data search, where the second search result includes a second search time and second data to be searched.

[0090] 602. Return the second data to be searched as the data to be searched.

[0091] In an embodiment of the present invention, if the first search time obtained in step 101 is less than the preset time threshold, such as the first search time may be 2 months, and the preset time threshold may be 3 months, then the second data search is a hot search, and the data to be searched is the hot data stored in the memory. The second data search is performed in the memory, that is, the time threshold can be used to divide the data into hot and cold (that is, the distance of use time); the second data search performs feature value matching on the hot data in the memory according to the acquired feature information, matches the data matching the feature information as the second data to be searched, and obtains the current time of the system as the second search time, and then uses the second data to be searched and the second search time as the second search result, and finally the second data to be searched can be obtained from the second search result, and then the second data to be searched is returned to the searching user as the data to be searched.

[0092] Optional, see Figure 7 , Figure 7 is a flow chart of another data search method provided by an embodiment of the present invention. Figure 7 As shown, after step 602, the method further includes:

[0093] 603. Store the second search result in the pre-built search index database.

[0094] In an embodiment of the present invention, the second search result includes the second search time and the data to be searched, and then according to the structure of the constructed search index database, a new data structure is created for the second search result to store the second search result, and the data structure can be a table structure or a tree structure, that is, the second search time is placed in the search time field of the data segment corresponding to the feature information in the search index database, and the storage location of the acquired data to be searched is placed in the data identifier field of the data segment, and then the similarity is calculated and the similarity value is placed in the similarity field of the data segment; for the hot data searched for the first time, its similarity value can be set to 1 or 100%, and for the hot data not searched for the first time, it is necessary to compare the acquired feature information with the feature information corresponding to the data segment to obtain the similarity value. Finally, the index in the corresponding search index database is generated according to the feature information corresponding to the second search result, so that the second search result and the data segment can be quickly obtained.

[0095] It should be noted that the data search method provided in the embodiment of the present invention can be applied to devices such as mobile phones, monitors, computers, servers, etc. that can perform data search.

[0096] See also Figure 8 , Figure 8is a schematic diagram of the structure of a data search device provided by an embodiment of the present invention, such as Figure 8 As shown, the device 700 includes:

[0097] A first acquisition module 701 is used to acquire a data search instruction, wherein the data search instruction includes feature information of the data to be searched and a first search time;

[0098] A search module 702, configured to compare the first search time with a preset time threshold, and if the first search time is greater than the time threshold, perform a first data search from a pre-built search index database based on the feature information, and obtain a first search result;

[0099] The first returning module 703 is configured to obtain a target data segment from the first search result, obtain first data to be searched according to the target data segment, and return the first data to be searched as the data to be searched.

[0100] Optional, such as Fig. 9 As shown, Fig. 9 800 is a schematic diagram of a structure of a search index database pre-construction device provided in an embodiment of the present invention. The search index database pre-construction device 800 includes:

[0101] A creation module 801, used to create multiple data segments, each data segment includes a data identifier field, a similarity field and a search time field;

[0102] A construction module 802 is used to construct multiple database indexes of the search index database according to multiple feature information;

[0103] The binding module 803 is used to bind each data segment to the corresponding database index.

[0104] Optional, such as Fig.10 As shown, the search module 702 includes:

[0105] A conversion submodule 7021, used for converting the feature information into the database index;

[0106] The acquisition submodule 7022 is used to acquire at least one corresponding data segment from the search index database as the first search result according to the database index.

[0107] Optional, such as Fig.11 As shown, the first returning module 703 includes:

[0108] A sorting submodule 7031 is used to sort the data segments in the first search result according to the similarity field;

[0109] The acquisition submodule 7032 is used to acquire a data segment with the highest similarity field value as a target data segment; or

[0110] Acquire a data segment whose similarity field value is greater than a preset similarity threshold as a target data segment;

[0111] The return submodule 7033 is used to obtain the first data to be searched from the external database as the data to be searched based on the data identifier field of the target data segment and return it.

[0112] Optional, such as Fig.12 As shown, after the return submodule 7033, the first return module 703 further includes:

[0113] A writing submodule 7034 is used to write the current search time into the search time field of the target data segment;

[0114] The updating submodule 7035 is used to update the target data segment in the first search result in the search index database.

[0115] Optional, such as Fig.13 As shown, if the first search time is less than the time threshold, the data search device 800 further includes:

[0116] A second acquisition module 704 is used to perform a second data search in the memory based on the feature information, and obtain a second search result of the second data search, where the second search result includes a second search time and a second data to be searched;

[0117] The second returning module 705 is configured to return the second to-be-searched data as the to-be-searched data.

[0118] The storage module 706 is configured to store the second search result in the pre-built search index database.

[0119] It should be noted that the data search device provided in the embodiment of the present invention can be applied to devices such as mobile phones, monitors, computers, servers, etc. that can perform data search.

[0120] The data search device provided in the embodiment of the present invention can implement each process implemented by the data search method in the method embodiment, and can achieve the same beneficial effect. To avoid repetition, it will not be described here.

[0121] See also Fig.14 , Fig.14 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Fig.14As shown, it includes: a memory 1402, a processor 1401, and a computer program stored in the memory 1402 and executable on the processor 1401, wherein:

[0122] The processor 1401 is used to call the computer program stored in the memory 1402 and execute the following steps:

[0123] Acquire a data search instruction, wherein the data search instruction includes feature information of the data to be searched and a first search time;

[0124] Comparing the first search time with a preset time threshold, if the first search time is greater than the time threshold, performing a first data search from a pre-built search index database based on the feature information, and obtaining a first search result;

[0125] A target data segment is obtained from the first search result, first data to be searched is obtained according to the target data segment, and the first data to be searched is returned as the data to be searched.

[0126] Optionally, the search index database includes multiple database indexes and multiple data segments; the pre-construction step of the search index database performed by the processor 1401 includes:

[0127] Creating a plurality of data segments, each data segment comprising a data identifier field, a similarity field, and a search time field;

[0128] Constructing multiple database indexes of the search index database according to multiple feature information;

[0129] Bind each data segment to the corresponding database index.

[0130] Optionally, the processor 1401 performs the first data search from a pre-built search index database based on the feature information and obtains a first search result, including:

[0131] Converting the feature information into the database index;

[0132] At least one corresponding data segment is obtained from the search index database according to the database index as the first search result.

[0133] Optionally, the step of obtaining a target data segment from the first search result, obtaining first data to be searched according to the target data segment, and returning the first data to be searched as the data to be searched, performed by the processor 1401, includes:

[0134] sorting the data segments in the first search result according to the similarity field;

[0135] Obtain a data segment with the highest similarity field value as the target data segment; or

[0136] Acquire a data segment whose similarity field value is greater than a preset similarity threshold as a target data segment;

[0137] Based on the data identifier field of the target data segment, first data to be searched is acquired from an external database as the data to be searched and returned.

[0138] Optionally, after the step of acquiring first to-be-searched data from an external database as the to-be-searched data based on the data identifier field of the target data segment and returning the first to-be-searched data, the processor 1401 further executes the following steps:

[0139] Writing the current search time into the search time field of the target data segment;

[0140] The target data segment in the first search result is updated in the search index database.

[0141] Optionally, if the first search time is less than the time threshold, the processor 1401 further executes:

[0142] Perform a second data search in the memory based on the feature information, and obtain a second search result of the second data search, where the second search result includes a second search time and second data to be searched;

[0143] The second to-be-searched data is returned as the to-be-searched data.

[0144] Optionally, the processor 1401 further executes:

[0145] The second search result is stored in the pre-built search index database.

[0146] It should be noted that the electronic device may be a mobile phone, monitor, computer, server or other device that can be used for data search.

[0147] The electronic device provided in the embodiment of the present invention can implement each process implemented by the data search method in the method embodiment and can achieve the same beneficial effects. To avoid repetition, it will not be described here.

[0148] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the data search method provided by the embodiment of the present invention are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0149] Those skilled in the art can understand that all or part of the processes in the embodiment method can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).

[0150] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. A data search method, characterized in that: The following steps are involved: Acquire a data search instruction, wherein the data search instruction includes feature information of the data to be searched and a first search time; Comparing the first search time with a preset time threshold, if the first search time is greater than the time threshold, converting the feature information into the database index; acquiring at least one corresponding data segment from the search index database as the first search result according to the database index; the search index database runs in a memory, and acquiring multiple data segments similar to the feature information in the search index database by table lookup or tree search through the database index as the first search result; The search index database includes a plurality of database indexes and a plurality of data segments; The pre-construction steps of the search index database include: Create multiple data segments, each data segment includes a data identifier field, a similarity field and a search time field; the data identifier field is used to identify the storage information of the data to be searched; the similarity field is used to indicate the degree of similarity between the acquired feature information and the feature information in the search index database; the search time field is used to store the specific time information of the last data search; Constructing multiple database indexes of the search index database according to multiple feature information; Bind each data segment to the corresponding database index; sorting the data segments in the first search result according to the similarity field; Obtain a data segment with the highest similarity field value as the target data segment; or Acquire a data segment whose similarity field value is greater than a preset similarity threshold as a target data segment; Based on the data identifier field of the target data segment, obtaining first data to be searched from an external database as the data to be searched and returning the data; Writing the current search time into the search time field of the target data segment; The target data segment in the first search result is updated in the search index database.

2. The method according to claim 1, characterized in that If the first search time is less than the time threshold, the method further includes: Perform a second data search in the memory based on the feature information, and obtain a second search result of the second data search, where the second search result includes a second search time and second data to be searched; The second to-be-searched data is returned as the to-be-searched data.

3. The method according to claim 2, characterized in that The method further comprises: The second search result is stored in the pre-built search index database.

4. A data search device, characterized in that: include: An acquisition module, used to acquire a data search instruction, wherein the data search instruction includes feature information of the data to be searched and a first search time; A search module is configured to compare the first search time with a preset time threshold, and if the first search time is greater than the time threshold, convert the feature information into the database index; obtain at least one corresponding data segment from the search index database as the first search result according to the database index; the search index database runs in a memory, and obtains multiple data segments similar to the feature information in the search index database by table lookup or tree search through the database index as the first search result; The search index database includes a plurality of database indexes and a plurality of data segments; The pre-construction step of the search index database includes: creating multiple data segments, each data segment includes a data identifier field, a similarity field and a search time field; the data identifier field is used to identify the storage information of the data to be searched; the similarity field is used to indicate the similarity between the acquired feature information and the feature information in the search index database; the search time field is used to store the specific time information of the last data search; constructing multiple database indexes of the search index database according to multiple feature information; binding each data segment with the corresponding database index; A return module is used to sort the data segments in the first search result according to the similarity field; obtain a data segment with the highest similarity field value as a target data segment; or obtain a data segment with a similarity field value greater than a preset similarity threshold as a target data segment; based on the data identifier field of the target data segment, obtain the first data to be searched from an external database as the data to be searched and return it; write the current search time into the search time field of the target data segment; and update the target data segment in the first search result in the search index database.

5. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the data search method according to any one of claims 1 to 3 when executing the computer program.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the data search method according to any one of claims 1 to 3 are implemented.

Citation Information

Patent Citations

  • Data inquiry method, device, server, and storage medium

    CN109033360A

  • Image search method and device, equipment and computer readable storage medium

    CN111104540A