Fuzzy matching query methods, devices, electronic equipment and storage media for data

By using the LikeSearch class and the CharColumn data structure, and converting Chinese characters to char type using ASCII codes to generate a data structure table, the problem of slow speed and low accuracy of fuzzy search in MySQL tables in Java is solved. This achieves fast and accurate fuzzy matching search, while reducing hardware resources and costs.

CN118427241BActive Publication Date: 2026-01-06CHERY AUTOMOBILE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410534995.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-29
Publication Date
2026-01-06
Estimated Expiration
2044-04-29

AI Technical Summary

Technical Problem

In existing technologies, the fuzzy query method for MySQL tables in Java is slow and has low accuracy when dealing with large amounts of data. At the same time, third-party middleware solutions have high hardware resource requirements and high costs.

Method used

By defining the LikeSearch class and the CharColumn data structure, Chinese characters are converted to char type using ASCII codes to generate a data structure table. A fuzzy search class is used for fast and accurate matching queries, avoiding the use of third-party middleware.

Benefits of technology

It improves the speed and accuracy of fuzzy matching queries without relying on third-party middleware, while reducing hardware resource requirements and costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118427241B_ABST
    Figure CN118427241B_ABST
Patent Text Reader

Abstract

The application relates to the computer technical field, in particular to a data fuzzy matching query method and device, electronic equipment and storage medium, wherein the method comprises the following steps: receiving a to-be-queried parameter, and performing data type conversion on the to-be-queried parameter to obtain a to-be-queried array; judging whether the to-be-queried array exists in a preset data structure table; if the to-be-queried array exists in the preset data structure table, generating a query result based on the content corresponding to the to-be-queried array, and returning the query result to a preset user end. Therefore, the problems that some fuzzy query methods in the related art are slow in index speed and low in accuracy, some methods are high in hardware resource requirement and high in cost are solved, the speed of fuzzy matching query is improved, the accuracy of matching is effectively improved, and the method has the characteristics of being simple, easy to use and low in cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and particularly to a method, device, electronic device and storage medium for fuzzy matching query of data. Background Art

[0002] In Java, when performing a fuzzy query on a certain field in a Mysql table, such as the dealer name, directly using an SQL (Structured Query Language) statement for like fuzzy query, for example, select supplier_name from Supplier_info where supplier_name like ‘%Changjie%’. This method does not use an index, and the query is relatively slow when the data volume is large. For example, the system has a supplier table with three million supplier data. At this time, using like fuzzy matching query will perform a full table scan without using an index, and the speed is relatively slow; if the leading percent sign is removed, select supplier_name from Supplier_info where supplier_name like ‘Changjie%’, then the index will be used and the speed will be faster, but it can only perform fuzzy matching starting from the leftmost side, and the result is not very accurate. For example, if a dealer's name is “Hanzhong Changjie Automobile Sales Service Co., Ltd.”, when entering the two words “Changjie” at this time, this supplier cannot be queried.

[0003] In related technologies, third-party middleware such as solr and elasticsearch is used. They will perform word segmentation on the data to be queried and then provide an index externally. At this time, both the speed and accuracy can be satisfied, but the requirements for hardware resources are high and the cost is relatively high. Summary of the Invention

[0004] This application provides a method, device, electronic device and storage medium for fuzzy matching query of data, to solve the problems in related technologies that some fuzzy query methods have slow index speed and low accuracy, and some have high requirements for hardware resources and high costs. While improving the speed of fuzzy matching query, the accuracy of matching is effectively improved, and it has the characteristics of being simple to use and having low cost.

[0005] The first aspect embodiment of this application provides a method for fuzzy matching query of data, including the following steps:

[0006] Receive the parameter to be queried, and perform data type conversion on the parameter to be queried to obtain an array to be queried;

[0007] Determine whether the array to be queried exists in a preset data structure table;

[0008] If the array to be queried exists in the preset data structure table, then a query result is generated based on the content corresponding to the array to be queried, and the query result is returned to the preset user terminal.

[0009] Optionally, in some embodiments, before determining whether the array to be queried exists in the preset data structure table, the method further includes:

[0010] Retrieve multiple raw data sets from a pre-defined database;

[0011] Each original data is converted into a data type using a preset first strategy to obtain multiple character-type original data. The position of each character-type original data is determined according to a preset character encoding. The preset first strategy is created using a fuzzy query class.

[0012] The preset data structure table is generated based on the multiple character-type raw data and the position of each character-type raw data.

[0013] Optionally, in some embodiments, determining whether the array to be queried exists in the preset data structure table further includes:

[0014] Match the array to be queried with each character-type raw data in the preset data structure table;

[0015] Based on the preset second strategy of the fuzzy query class, it is determined whether the array to be queried is the same as the current character type original data;

[0016] If the array to be queried is the same as the current character-type original data, then the position of the current character-type original data is obtained, and the content corresponding to the position of the current character-type original data is used as the content corresponding to the array to be queried.

[0017] Optionally, in some embodiments, after determining whether the array to be queried is the same as the current character-type original data, the method further includes:

[0018] If the array to be queried is not the same as the current character-type original data, then the step of matching the array to be queried with each character-type original data in the preset data structure table and determining whether the array to be queried is the same as the current character-type original data is executed again, until the array to be queried is empty.

[0019] Optionally, in some embodiments, generating query results based on the content corresponding to the array to be queried includes:

[0020] The query results are obtained by sorting the contents of the array to be queried using the third preset strategy of the query result processing class, and paginating the contents of the array to be queried using the fourth preset strategy of the query result processing class.

[0021] A second aspect of this application provides a fuzzy matching query device for data, comprising:

[0022] The receiving module is used to receive the parameters to be queried and to convert the data type of the parameters to obtain the array to be queried;

[0023] The judgment module is used to determine whether the array to be queried exists in a preset data structure table;

[0024] The query module is used to generate query results based on the content corresponding to the query array when the array to be queried exists in the preset data structure table, and return the query results to the preset user terminal.

[0025] Optionally, in some embodiments, before determining whether the array to be queried exists in the preset data structure table, the determining module is further configured to:

[0026] Retrieve multiple raw data sets from a pre-defined database;

[0027] Each original data is converted into a data type using a preset first strategy to obtain multiple character-type original data. The position of each character-type original data is determined according to a preset character encoding. The preset first strategy is created using a fuzzy query class.

[0028] The preset data structure table is generated based on the multiple character-type raw data and the position of each character-type raw data.

[0029] Optionally, in some embodiments, the determining module is further configured to:

[0030] Match the array to be queried with each character-type raw data in the preset data structure table;

[0031] Based on the preset second strategy of the fuzzy query class, it is determined whether the array to be queried is the same as the current character type original data;

[0032] If the array to be queried is the same as the current character-type original data, obtain the position of the current character-type original data, and use the content corresponding to the position of the current character-type original data as the content corresponding to the array to be queried.

[0033] Optionally, in some embodiments, after determining whether the array to be queried is the same as the current character-type original data, the determining module is further configured to:

[0034] If the array to be queried is different from the current character-type original data, the step of matching the array to be queried with each character-type original data in the preset data structure table and determining whether the array to be queried is the same as the current character-type original data is executed again until the array to be queried is empty.

[0035] Optionally, in some embodiments, the query module is specifically used for:

[0036] The query results are obtained by sorting the contents of the array to be queried using the third preset strategy of the query result processing class, and paginating the contents of the array to be queried using the fourth preset strategy of the query result processing class.

[0037] A third aspect of this application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the fuzzy matching query method for data as described in the above embodiments.

[0038] A fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement the fuzzy matching query method for data as described in the above embodiments.

[0039] Therefore, this application receives the parameters to be queried, converts the data type of the parameters to obtain the array to be queried, determines whether the array to be queried exists in a preset data structure table, and if the array to be queried exists in the preset data structure table, generates query results based on the content corresponding to the array to be queried, and returns the query results to the preset user terminal. This solves the problems of slow indexing speed and low accuracy of some fuzzy query methods in related technologies, as well as high hardware resource requirements and high costs. It improves the speed of fuzzy matching queries while effectively improving matching accuracy, and is simple to use and low in cost.

[0040] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0041] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:

[0042] Figure 1 This is a flowchart of a fuzzy matching query method for data provided in an embodiment of this application;

[0043] Figure 2 This is a schematic diagram of a LikeSearch class outline according to a specific embodiment of this application;

[0044] Figure 3 This is a schematic diagram illustrating the detailed process of storing and querying CharColumn according to a specific embodiment of this application;

[0045] Figure 4 This is a schematic diagram of the data structure after data storage is completed according to a specific embodiment of this application;

[0046] Figure 5 This is a schematic diagram of a class diagram according to a specific embodiment of this application;

[0047] Figure 6 This is a flowchart of a fuzzy matching query method for data according to a specific embodiment of this application;

[0048] Figure 7 This is a block diagram of a fuzzy matching query device for data provided according to an embodiment of this application;

[0049] Figure 8 This is a block diagram of an electronic device provided according to an embodiment of this application. Detailed Implementation

[0050] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.

[0051] The following describes a fuzzy matching query method, apparatus, electronic device, and storage medium for data in an embodiment of the present application. In view of the problems in the above-mentioned background art that some fuzzy query methods have slow indexing speed and low accuracy, and some have high requirements for hardware resources and high costs, the present application provides a fuzzy matching query method for data. In this method, a query parameter to be queried is received, and the data type of the query parameter to be queried is converted to obtain a query array to be queried; it is determined whether the query array to be queried exists in a preset data structure table; if the query array to be queried exists in the preset data structure table, a query result is generated based on the content corresponding to the query array to be queried, and the query result is returned to a preset client. Thus, the problems in the related art that some fuzzy query methods have slow indexing speed and low accuracy, and some have high requirements for hardware resources and high costs are solved. While improving the speed of fuzzy matching query, the accuracy of matching is effectively improved, and it has the characteristics of being simple to use and having low costs.

[0052] Specifically, Figure 1 FIG. is a schematic flowchart of a fuzzy matching query method for data provided by an embodiment of the present application.

[0053] As Figure 1 shown, the fuzzy matching query method for data includes the following steps:

[0054] In step S101, a query parameter to be queried is received, and the data type of the query parameter to be queried is converted to obtain a query array to be queried.

[0055] It can be understood that the query parameter to be queried in the embodiment of the present application is a Chinese character, and the Chinese character needs to be converted into a character of char type to obtain a query array to be queried.

[0056] Specifically, in Java, when running a character of char type, it is directly regarded as an integer corresponding to the ASCII (American Standard Code for Information Interchange) table, and each Chinese character corresponds to a unique number. For example, the character "湖" corresponds to 28246.

[0057] Optionally, in some embodiments, before determining whether the query array to be queried exists in a preset data structure table, it further includes: obtaining multiple original data in a preset database; respectively converting the data type of each original data through a preset first strategy to obtain multiple character-type original data, and determining the position of each character-type original data according to a preset character encoding, where the preset first strategy is created through a fuzzy query class; generating a preset data structure table according to the multiple character-type original data and the position of each character-type original data.

[0058] Among them, the preset database in the embodiments of the present application stores a large amount of data to be queried, that is, multiple original data in the embodiments of the present application.

[0059] Specifically, in the embodiments of the present application, a Java utility class LikeSearch class is first written, that is, the fuzzy query class in the embodiments of the present application. This class mainly has a put method and a search method. Among them, the put method is the preset first strategy in the embodiments of the present application and is used to initialize the cache. After the system starts, the original data, that is, the data to be fuzzy queried, is initialized into the cache through the put method. The put method is similar to the word segmentation function of Solr and can store each Chinese character and its corresponding content into the preset data structure, that is, the preset data structure table in the embodiments of the present application.

[0060] That is to say, in the embodiments of the present application, a fuzzy query class LikeSearch class is defined, and a put method is defined in this class. Through the put method, a large amount of data to be queried is obtained, and the data type conversion is performed on the data to be queried to obtain multiple character-type original data. The position of each character-type original data is determined according to the ASCII code. Finally, a CharColumn data structure is generated according to the multiple character-type original data and the position of each character-type original data.

[0061] In some embodiments, Figure 2 is a schematic diagram of the outline of the LikeSearch class in a specific embodiment of the present application. As Figure 2 shown, the LikeSearch class in the embodiments of the present application includes a CharColumn data structure. This CharColumn data structure serves as a cache to store each Chinese character and its corresponding content. The update method is used to update the cache data (triggered when there is an update statement operation in Mysql). The search method is used to provide query operations externally. In this way, fast and accurate fuzzy matching queries can be provided externally through the search method.

[0062] For example, Figure 3 is a schematic diagram of the detailed process of CharColumn storage and query in a specific embodiment of the present application. As Figure 3 shown, after the put method of the LikeSearch class receives the data content, it will convert the data into a char array and then store it into the concurrentHashMap data structure in the CharColumn inner class in turn. Taking the storage of "Hunan" as an example, the put method stores the ASCII code corresponding to the Chinese character "湖" and the ASCII code corresponding to the Chinese character "南" into the CharColumn inner class. The data structure after the storage is as Figure 4 shown.

[0063] It should be noted that the fuzzy matching query method for data in this application embodiment is implemented using char, concurrenthashmap, and byte[] arrays. The entire storage process is similar to the word segmentation principle in Solr. The inner class of CharColumn maintains a ConcurrentHashMap data structure. The specific storage and query processes are as follows: Figure 3 As shown.

[0064] Therefore, this application embodiment defines a LikeSearch class, which has put and search methods for external operations, and internally maintains a CharColumn data structure. The search method enables fast and accurate fuzzy matching queries, which is simple and easy to use and does not require reliance on third-party middleware, thereby reducing costs and saving expenses.

[0065] In step S102, it is determined whether the array to be queried exists in the preset data structure table.

[0066] As can be seen from the above embodiments, this application embodiment performs fuzzy search by calling the search method of the LikeSearch class and passing in parameters. After receiving the search parameters, the search method converts the parameters into a char array. Then, this application embodiment searches for the contents of the char array in the CharColumn by iterating through the contents of the char array to determine whether the contents of the char array exist in the CharColumn data structure.

[0067] Optionally, in some embodiments, determining whether the array to be queried exists in a preset data structure table further includes: matching the array to be queried with each character-type original data in the preset data structure table; determining whether the array to be queried is the same as the current character-type original data based on a preset second strategy of the fuzzy query class; if the array to be queried is the same as the current character-type original data, obtaining the position of the current character-type original data, and using the content corresponding to the position of the current character-type original data as the content corresponding to the array to be queried.

[0068] The preset second strategy is the search method of the LikeSearch class in the above embodiment, which is used to provide query operations.

[0069] Specifically, in this embodiment, the ASCII code corresponding to each character in the data to be queried is used to query the CharColumn data structure. If the array to be queried is the same as the current character-type original data in the CharColumn data structure, the content corresponding to the position of the current character-type original data is used as the content corresponding to the array to be queried. In other words, this embodiment can perform fuzzy matching query on all data by receiving a keyword through the search method, and finally realizes that the invention can provide accurate fuzzy matching query based on memory.

[0070] Optionally, in some embodiments, after determining whether the array to be queried is the same as the current character-type original data, the method further includes: if the array to be queried is not the same as the current character-type original data, then re-execute the step of matching the array to be queried with each character-type original data in the preset data structure table and determining whether the array to be queried is the same as the current character-type original data, until the array to be queried is empty.

[0071] It is understood that, in this embodiment of the application, when determining whether the array to be queried is the same as the current character type original data, the database is queried one by one through a loop structure. Each data item needs to be processed separately. This method can handle a large amount of data.

[0072] In some embodiments, a for loop can be used to iterate the query results, thereby enabling this application to handle fuzzy queries on various large databases, ensuring its practicality and flexibility.

[0073] Therefore, without using third-party middleware, this application only needs to load the data to be queried into memory, and achieves the purpose of accurate and fast data query by trading space for time, which is very convenient to use.

[0074] In step S103, if the array to be queried exists in a preset data structure table, a query result is generated based on the content corresponding to the array to be queried, and the query result is returned to the preset user terminal.

[0075] It is understandable that actual iterative queries may involve more complex logic and data processing. Therefore, for some large databases, this application embodiment considers using pagination or other optimization techniques to reduce memory usage and improve query efficiency.

[0076] Optionally, in some embodiments, generating query results based on the content corresponding to the query array includes: sorting the content corresponding to the query array using a preset third strategy of the query result processing class, and paginating the content corresponding to the query array using a preset fourth strategy of the query result processing class to obtain query results.

[0077] Specifically, this application embodiment defines an inner class Context for processing query results and pagination. The preset third strategy in this application embodiment is the filter method in the Context class, which is used to sort the queried content. The preset fourth strategy in this application embodiment is the limit method in the Context class, which is used to paginate the queried content. Finally, the query results are returned as a TreeSet.

[0078] For example, Figure 5 This is a schematic diagram of a class diagram for a specific embodiment of this application, such as... Figure 5 As shown, this embodiment of the application requires the declaration of a LikeSearch external operation class. This LikeSearch external operation class defines a put method for initializing the cache, a search method for providing query operations, a CharColumn data storage class, and a Context query result processing class for processing query results and pagination.

[0079] Furthermore, the implementation steps of the fuzzy matching query method for data in this application embodiment are as follows: Figure 6 As shown, Figure 6 This is a flowchart of a fuzzy matching query method for data according to a specific embodiment of this application. The fuzzy matching query method for data includes the following steps:

[0080] Step S601: When the service starts, the initialization method is executed first. That is, after the backend application starts, the data that needs to be fuzzy searched in MySQL is stored in the CharColumn data structure of the LikeSearch class through the put method of the LikeSearch class.

[0081] In step S602, after the put method of the LikeSearch class receives the data content, it will convert the received data into a char array and then store it in the ConcurrentHashMap data structure maintained by the inner class of CharColumn.

[0082] In step S603, the `put` method of the `LikeSearch` class stores the unique ASCII code corresponding to each character into a `CharColumn` data structure. Taking "Hunan" as an example, the storage principle is as follows: Figure 3 As shown, the data structure after storage is as follows: Figure 4 As shown;

[0083] Step S604: Call the search method of the LikeSearch class and pass in the parameters to perform a fuzzy search. After receiving the query parameters, the search method converts the parameters into a char array, iterates through the contents of the char array to search from the CharColumn, and after a successful query, sorts the results using the filter method of the inner class Context and performs pagination using the limit method. After pagination using the limit method, the query results are finally returned as a TreeSet.

[0084] It should be noted that before executing the fuzzy matching query method for data in this application embodiment, it is necessary to develop an information management system and build a database, including a WEB (World Wide Web) page for list queries and an API (Application Programming Interface) for backend query processing, which can normally receive parameters passed from the front end. In addition, several servers are required to install the database, Java runtime environment, and run the information management system.

[0085] Therefore, this application embodiment uses the search method of the LikeSearch class to accept a keyword to perform fuzzy matching query on the content. The fuzzy matching query method of the data in this application embodiment does not require the use of third-party middleware. While improving the speed of fuzzy matching query, it effectively improves the accuracy of matching, and has the characteristics of being simple to use and low cost.

[0086] The fuzzy matching query method for data proposed in this application receives query parameters, converts the data type of the query parameters to obtain a query array, determines whether the query array exists in a preset data structure table, and if the query array exists in the preset data structure table, generates query results based on the content corresponding to the query array and returns the query results to a preset user terminal. This solves the problems of slow indexing speed and low accuracy in some related fuzzy query methods, as well as high hardware resource requirements and high costs. It improves the speed of fuzzy matching queries while effectively improving matching accuracy, and is simple to use and low in cost.

[0087] Next, the fuzzy matching query device for data proposed according to the embodiments of this application is described with reference to the accompanying drawings.

[0088] Figure 7 This is a block diagram of a fuzzy matching query device for data according to an embodiment of this application.

[0089] like Figure 7As shown, the fuzzy matching query device 10 for this data includes: a receiving module 100, a judging module 200, and a query module 300.

[0090] Specifically, the receiving module 100 is used to receive the parameters to be queried and convert the data type of the parameters to obtain the array to be queried; the judging module 200 is used to judge whether the array to be queried exists in the preset data structure table; the query module 300 is used to generate query results based on the content corresponding to the array to be queried if the array to be queried exists in the preset data structure table, and return the query results to the preset user terminal.

[0091] Optionally, in some embodiments, before determining whether the array to be queried exists in the preset data structure table, the determination module 200 is further configured to: obtain multiple raw data from a preset database; convert the data type of each raw data according to a preset first strategy to obtain multiple character-type raw data, and determine the position of each character-type raw data according to a preset character encoding, wherein the preset first strategy is created by a fuzzy query class; and generate a preset data structure table according to the multiple character-type raw data and the position of each character-type raw data.

[0092] Optionally, in some embodiments, the judgment module 200 is further configured to: match the array to be queried with each character-type original data in a preset data structure table; determine whether the array to be queried is the same as the current character-type original data based on a preset second strategy of the fuzzy query class; if the array to be queried is the same as the current character-type original data, obtain the position of the current character-type original data, and use the content corresponding to the position of the current character-type original data as the content corresponding to the array to be queried.

[0093] Optionally, in some embodiments, after determining whether the array to be queried is the same as the current character-type original data, the determination module 200 is further configured to: if the array to be queried is not the same as the current character-type original data, re-execute the step of matching the array to be queried with each character-type original data in the preset data structure table and determining whether the array to be queried is the same as the current character-type original data, until the array to be queried is empty.

[0094] Optionally, in some embodiments, the query module 300 is specifically used to: sort the contents corresponding to the query array according to a preset third strategy of the query result processing class, and perform pagination on the contents corresponding to the query array according to a preset fourth strategy of the query result processing class to obtain query results.

[0095] It should be noted that the foregoing explanation of the fuzzy matching query method embodiment also applies to the fuzzy matching query device of this embodiment, and will not be repeated here.

[0096] The fuzzy matching query device for data proposed in this application receives query parameters, converts the data type of the query parameters to obtain a query array, determines whether the query array exists in a preset data structure table, and if the query array exists in the preset data structure table, generates a query result based on the content corresponding to the query array and returns the query result to a preset user terminal. This solves the problems of slow indexing speed and low accuracy in some related fuzzy query methods, as well as high hardware resource requirements and high costs. It improves the speed of fuzzy matching queries while effectively improving matching accuracy, and is simple to use and low in cost.

[0097] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device may include:

[0098] The memory 801, the processor 802, and the computer program stored on the memory 801 and capable of running on the processor 802.

[0099] When the processor 802 executes the program, it implements the fuzzy matching query method for data provided in the above embodiments.

[0100] Furthermore, electronic devices also include:

[0101] Communication interface 803 is used for communication between memory 801 and processor 802.

[0102] The memory 801 is used to store computer programs that can run on the processor 802.

[0103] The memory 801 may include high-speed RAM (Random Access Memory) memory, and may also include non-volatile memory, such as at least one disk storage.

[0104] If the memory 801, processor 802, and communication interface 803 are implemented independently, then the communication interface 803, memory 801, and processor 802 can be interconnected via a bus to complete communication between them. The bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 8The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0105] Optionally, in a specific implementation, if the memory 801, processor 802, and communication interface 803 are integrated on a single chip, then the memory 801, processor 802, and communication interface 803 can communicate with each other through an internal interface.

[0106] The processor 802 may be a CPU (Central Processing Unit), an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of this application.

[0107] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the above-described fuzzy matching query method for data.

[0108] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0109] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0110] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or N executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.

[0111] It should be understood that the various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, the N steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or more of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (FPGAs), field-programmable gate arrays (FPGAs), etc.

[0112] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0113] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.

Claims

1. A method of fuzzy match query of data, characterized by, The method comprises the following steps: receiving a query parameter and converting the query parameter into an ASCII code to obtain a query array; determining whether the query array exists in a preset data structure table; if the query array exists in the preset data structure table, generating a query result based on the content corresponding to the query array and returning the query result to a preset user terminal; wherein, before determining whether the query array exists in the preset data structure table, the method further comprises: obtaining a plurality of original data in a preset database; performing data type conversion on each original data respectively through a preset first strategy to obtain a plurality of character type original data, and determining the position of each character type original data according to a preset character encoding, wherein the preset first strategy is created through a fuzzy query class; and generating the preset data structure table according to the plurality of character type original data and the position of each character type original data; the determination of whether the query array exists in the preset data structure table further comprises: matching the query array with each character type original data in the preset data structure table; determining whether the query array is identical to a current character type original data based on a preset second strategy of the fuzzy query class; if the query array is identical to the current character type original data, obtaining the position of the current character type original data and taking the content corresponding to the position of the current character type original data as the content corresponding to the query array; after determining whether the query array is identical to the current character type original data, the method further comprises: if the query array is not identical to the current character type original data, re-executing the steps of matching the query array with each character type original data in the preset data structure table and determining whether the query array is identical to a current character type original data until the query array is empty.

2. The method of claim 1, wherein, the generation of the query result based on the content corresponding to the query array comprises: performing sorting operation on the content corresponding to the query array through a preset third strategy of the query result processing class, and performing paging operation on the content corresponding to the query array through a preset fourth strategy of the query result processing class to obtain the query result.

3. An apparatus for fuzzy match query of data, characterized by, The method comprises: a receiving module configured to receive a query parameter and convert the query parameter into an ASCII code to obtain a query array; a determining module configured to determine whether the query array exists in a preset data structure table; a query module configured to, if the query array exists in the preset data structure table, generate a query result based on the content corresponding to the query array and return the query result to a preset user terminal; The judgment module is further configured to: obtain a plurality of original data in a preset database; perform data type conversion on each original data respectively by using a preset first strategy to obtain a plurality of character type original data, and determine a position of each character type original data according to a preset character code, wherein the preset first strategy is obtained by using a fuzzy query class; and generate the preset data structure table according to the plurality of character type original data and the position of each character type original data. The judgment module is further configured to: match the to-be-queried array with each character type original data in the preset data structure table; judge whether the to-be-queried array is identical to a current character type original data based on a preset second strategy of the fuzzy query class; in a case where the to-be-queried array is identical to the current character type original data, obtain a position of the current character type original data, and take content corresponding to the position of the current character type original data as content corresponding to the to-be-queried array. After judging whether the to-be-queried array is identical to the current character type original data, the judgment module is further configured to: if the to-be-queried array is not identical to the current character type original data, re-perform the matching of the to-be-queried array with each character type original data in the preset data structure table, and the judging of whether the to-be-queried array is identical to the current character type original data until the to-be-queried array is a null value.

4. An electronic device, comprising: The computer program is stored in the memory and executable on the processor, and the processor executes the program to implement the fuzzy matching query method of data according to any one of claims 1-2. The program is executed by the processor to implement the fuzzy matching query method of data according to any one of claims 1-2.

5. A computer-readable storage medium having stored thereon a computer program, characterized in that, ​

Citation Information

Patent Citations

  • Fuzzy query method and device and query system

    CN107436911A

  • Fuzzy query method and device

    CN110019393A