Data retrieval method and system and related products

By synchronizing part of the content of the relational database to the non-relational database and using the fast search indexing technology of the non-relational database, the problem of slow query speed and low accuracy of the relational database under large amounts of data is solved, achieving fast and Accurate data retrieval effect.

CN118820293AActive Publication Date: 2024-10-22KINGDEE SOFTWARE(CHINA) CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410868630.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-10-22
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

When existing relational databases process a large number of data query requests, the query speed is slow and the accuracy is low. Especially when the data volume is large and the data structure is complex, too many full-text index fields lead to numerous query results and reduced accuracy, which affects the user experience.

Method used

By synchronizing part of the content in the relational database to the non-relational database, and executing the data query request in the non-relational database, the query scope is narrowed, and the quick search index of the non-relational database is used to quickly locate the content of the field to be queried. This enables precise querying in relational databases.

Benefits of technology

It reduces the pressure on relational databases faced with a large number of concurrent query requests, improves the feedback efficiency and accuracy of search results, reduces the storage space of full-text indexes, and achieves fast and accurate data retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118820293A_ABST
    Figure CN118820293A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data retrieval method and system and related products, according to the method, part of content in a relational database is synchronously stored in a non-relational database, external retrieval service is carried out by the non-relational database, and the query pressure of the relational database when facing a large number of concurrent data query requests can be reduced. Besides, through searching of the non-relational database, a retrieval direction can be provided for query of the relational database, the query range can be narrowed, for example, it is prompted that the second data content can be found in the data record where the first data content is located, and therefore the feedback efficiency and accuracy of the retrieval result are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of data technology, and in particular, to data retrieval methods, systems, and related products. Background Art

[0002] In existing digital information systems, it is often necessary to query information in business data records, for example, fuzzy query on text field information such as summary and notes in data records such as transaction flow, voucher, business document, etc., or numerical field information such as transaction amount and date.

[0003] The current query solution is to directly use a relational database such as MySQL to perform a fuzzy matching query on the fields specified by the user. In this case, it is necessary to create a full-text index field for each field in the relational database so as to find the relevant information of the field through the full-text index field and return it to the user. However, when the amount of data stored in the database is large or the data structure is complex, many full-text index fields are created; in this case, traversing the full-text index fields one by one for query will make the query speed very slow. At the same time, it is easy to hit more full-text index fields ambiguously, resulting in numerous query results with low accuracy, affecting the user experience. Summary of the invention

[0004] The embodiments of the present application provide a data retrieval method, system and related products for quickly retrieving data records containing the contents of a field to be searched, thereby narrowing the query scope for a relational database and improving the feedback efficiency and accuracy of the search results.

[0005] A first aspect of an embodiment of the present application provides a data retrieval method, comprising:

[0006] Get data query request;

[0007] When the data query request includes a to-be-queried field of a preset type, the data query request is executed in a non-relational database to find out a first data content corresponding to the to-be-queried field in the non-relational database; the non-relational database synchronizes data content of at least part of the data records in the relational database, the data content including content corresponding to the field of the preset type;

[0008] Obtaining a target record identifier; the target record identifier refers to an identifier of the data record containing the first data content;

[0009] The target record identifier and the data query request are combined as a new query request, and the new query request is executed in the data record of the relational database to find out the second data content corresponding to the field to be queried in the relational database as a retrieval result.

[0010] Optionally, before executing the data query request in the non-relational database to find out the first data content corresponding to the to-be-queried field in the non-relational database, the method further includes:

[0011] Monitoring changes in the content of the relational database to capture new data records generated by the changes in the relational database;

[0012] Distinguish historical common content and non-historical common content in the new data record; the historical common content refers to repeated data content that has been stored in other data records in the relational database;

[0013] The non-historical shared content is synchronously transmitted to the non-relational database, and the transmission of the historical shared content to the non-relational database is refused, so as to construct the non-relational database.

[0014] Optionally, distinguishing the historical common content in the new data record includes:

[0015] Based on the association between the data content of each data record in the relational database and the version iteration number of each data record, the original data content in the data record whose version iteration number exceeds the initial version number is determined as the historical shared content.

[0016] Optionally, obtaining the target record identifier includes:

[0017] Acquire an association relationship between each of the data contents and an identifier of each of the data records in the relational database; the association relationship is used to indicate the data record where the data content is located, and each of the data records includes a new data record that has changed;

[0018] Based on the association relationship, an identifier of the data record containing the first data content is determined as the target record identifier.

[0019] Optionally, before executing the new query request in the data record of the relational database, the method further comprises:

[0020] Distinguishing attributes of data contents belonging to the preset type in the non-relational database and the relational database;

[0021] Based on the attributes of the field to be checked, a search range is locked in the non-relational database and the relational database to respectively find out the first data content and the second data content within the search range; the search range includes data content with the same attributes as the field to be checked.

[0022] Optionally, after executing the data query request in the non-relational database to find out the first data content corresponding to the to-be-queried field in the non-relational database, the method further includes:

[0023] If the quantity of the first data content or the second data content does not meet the preset display quantity, determining the storage location of the first data content in the non-relational database;

[0024] The search range of the field to be searched in the non-relational database is flipped from the page where the storage location is located to other pages in the non-relational database, and the data query request is executed on the other pages until the first data content that meets the preset display quantity is obtained or the page flipping is completed.

[0025] Optionally, after finding out the second data content corresponding to the to-be-queried field in the relational database as the search result, the method further includes:

[0026] If there is at least one group of first data contents corresponding to the to-be-checked field, each of the first data contents and the second data contents corresponding to the first data contents are respectively taken as a comparison group;

[0027] Selecting a preset number of comparison groups to compare the consistency of the contents within the groups, so as to screen out the comparison groups with inconsistent contents within the groups;

[0028] Based on the second data content in the comparison group with inconsistent content within the group, the first data content is synchronously updated as a new search result.

[0029] When the method described in the first aspect of the present application is implemented, the content described in the second aspect of the present application can be adopted to achieve it.

[0030] A second aspect of the embodiment of the present application provides a data retrieval system, including: an acquisition unit, a processing unit;

[0031] The acquisition unit is used to acquire a data query request;

[0032] The processing unit is used for, when the data query request includes a field to be checked of a preset type, executing the data query request in the non-relational database to find out the first data content corresponding to the field to be checked in the non-relational database; the non-relational database synchronizes data content of at least part of the data records in the relational database, the data content including the content corresponding to the field of the preset type;

[0033] The acquisition unit is further used to acquire a target record identifier; the target record identifier refers to an identifier of the data record containing the first data content;

[0034] The processing unit is also used to combine the target record identifier and the data query request as a new query request, and execute the new query request in the data record of the relational database to find out the second data content corresponding to the field to be queried in the relational database as a retrieval result.

[0035] A third aspect of an embodiment of the present application provides an electronic device, including: a processor and a memory;

[0036] The processor is configured to communicate with the memory and execute instructions in the memory to implement the method described in the first aspect of the embodiment of the present application or any specific implementation of the first aspect.

[0037] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed by a processor, they implement the method described in the first aspect of the embodiment of the present application or any specific implementation of the first aspect.

[0038] A fifth aspect of an embodiment of the present application provides a computer program product, which includes computer instructions. When the computer instructions are executed by a processor, they implement the method described in the first aspect of the embodiment of the present application or any specific implementation of the first aspect.

[0039] It can be seen from the above technical solutions that the embodiments of the present application have at least the following advantages:

[0040] The embodiment of the present application stores at least part of the content in the relational database in a non-relational database synchronously, and the non-relational database performs external search services, which can reduce the query pressure of the relational database when facing a large number of concurrent data query requests. In addition, through the search of the non-relational database, the query direction can be provided for the query of the relational database and the query scope can be narrowed, such as prompting that the second data content can be found in the data record where the first data content is located, thereby improving the feedback efficiency and accuracy of the search results. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0042] It should be noted that, although the steps in the process diagrams (if any) involved in the embodiments are drawn in sequence as indicated by the arrows, unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.

[0043] Figure 1 A schematic diagram of the system architecture of the data retrieval method according to an embodiment of the present application;

[0044] Figures 2 to 4 This is a flow chart of the data retrieval method according to an embodiment of the present application;

[0045] Figure 5 A schematic diagram of the structure of the data retrieval system of the embodiment of the present application;

[0046] Figure 6 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0048] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims and drawings of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0049] In the following description, similar expressions such as "a specific implementation" or "a specific example" are involved, which describe a subset of all possible embodiments, but it can be understood that "a specific implementation" or "a specific example" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict. In the following description, the term multiple refers to at least two. In some specific examples, the numerical value mentioned in this application reaches the threshold value (if any), which may include the case where the former is greater than the latter of the threshold value; if similar expressions such as "any" or "at least one" are mentioned, it can specifically refer to any one of the listed examples or any combination of these examples.

[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0051] The method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 101 through the network, and the data storage system 100 can store the relational database, non-relational database, data to be processed, etc. associated with the server 101. The data storage system 100 can be integrated on the server 101, or it can be placed on the cloud or other network servers. The terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc. The server 101 can be implemented as an independent server or a server cluster consisting of multiple servers.

[0052] Terminal 102 can obtain a data query request input by a user, and the data query request may contain a query statement such as "find the tax return summary and tax amount submitted by the xx department in 2024". Terminal 102 can send the data query request to server 101, and server 101 can determine whether the request contains a preset type of field to be checked, such as a non-numeric text field; it should be noted that this preset type can be specifically determined according to the content type corresponding to the field to be checked. For example, the content corresponding to the field to be checked is a numerical content such as "amount" or "time", then the field to be checked can be considered to be a numerical type field; for another example, the content corresponding to the field to be checked is mainly non-numeric type plain text such as Chinese characters and English, such as a detailed text description of a certain summary (mainly containing plain text and of course may also contain numerical content), then the field to be checked can be considered to be a non-numeric type (or text type) field.

[0053] If the request contains a preset type of field to be checked (or query condition), such as "tax return list summary", a data query request can be executed in the non-relational database to find the first data content (or first query result) corresponding to the field to be checked in the non-relational database. Afterwards, the second data content (or second query result) can be quickly queried in the relational database based on the identifier of the data record where the first data content is located (such as ID number) and the data query request. Finally, the first data content can be synchronously updated based on the second data content and returned to the terminal 102 to avoid omissions in the query results fed back by the first data content, which affects the accuracy of the query.

[0054] Of course, you can also choose to directly return the second data content to the terminal 102 without synchronously updating the first data content. It should be noted that the method provided in the embodiment of the present application can be implemented by the terminal device and the server as described above, or it can be implemented entirely on the server side, or it can be implemented entirely on the terminal device side, which can be determined according to the actual application scenario and is not limited here.

[0055] The method of the present application will be described in further detail below.

[0056] See also Figure 2 In a first aspect, the present application provides a specific embodiment of a data retrieval method, which includes the following steps:

[0057] Step S21: Obtain a data query request.

[0058] The relational database of the embodiment of the present application can be a structured query language database (MySQL, MyStructured Query Language) or an Oracle database, etc., which can be called a business database or a source database. A non-relational database can be called a business database or a source database, such as a search service engine (ES, ElasticSearch) or a NoSQL database. A non-relational database can be called an external database relative to a relational database. The data content of the above data records can be mainly text content such as summaries or notes in documents such as transaction flows, vouchers, and business documents, and of course, can also be numerical content such as amount and time; that is, the above preset types can be text and / or numerical types, which can be determined by the actual situation and are not limited here.

[0059] Step S22: When the data query request includes a to-be-queried field of a preset type, the data query request is executed in the non-relational database to find out the first data content corresponding to the to-be-queried field in the non-relational database.

[0060] The above-mentioned non-relational database synchronizes data contents of at least part of the data records in the relational database, and the data contents include contents corresponding to fields of a preset type.

[0061] like Figure 1 The exemplary explanation is that the relational database taking MySQL as an example often has less than ideal retrieval effect on text content due to the limitation of structure and grammatical logic. If the text content required by the user is to be retrieved well, it is necessary to reconstruct the relational database or substantially recompile its grammatical logic (including changing the grammar of the query statement), which is costly. In addition, the inventors have found that the non-relational database represented by ES can quickly check whether the content corresponding to the field to be checked is contained in the library. In other words, the content position corresponding to the field to be checked can be quickly located. Unlike the MySQL full-text index, which needs to traverse the indexing process of each word segmentation, it can quickly narrow the search scope and speed up the search progress. Therefore, the inventors propose that at least part of the data content in MySQL can be uploaded to non-relational databases such as ES. This part of the data content can specifically be the text content in each data record that needs to be retrieved, so as to quickly feedback the query results with the help of the quick search index of ES and improve the user experience.

[0062] Exemplarily, when a data query is initiated, it is possible to first analyze whether there are fields to be queried of a preset type in the data query request, that is, first determine whether the indexing conditions or filtering conditions for enabling external index services such as ES query are met. When the non-relational database is an ES library, the search in step S22 can be referred to as the ES query process. Furthermore, external index services such as ES query can be enabled only when the data query request contains fields to be queried of a preset type, so as to avoid increasing the query pressure of ES by calling the external index service additionally each time.

[0063] Of course, without considering the data storage pressure and query pressure of non-relational databases, in some examples, the full data content of the relational database can be synchronously stored in a non-relational database represented by ES, so that each data query request uses the ES query channel to quickly feedback the query results.

[0064] For example, if the preset type is text, when the data query request contains a query statement (or query condition): "Find the summary of the tax return list and the tax amount reported by the xx department in 2024", it does contain the preset type of field to be checked "Tax return list summary", so the ES query process can be used to find the text content details corresponding to the "Tax return list summary" in the ES library: "This tax return list records the tax amount reported by the xx department in March 2024, the reporting personnel...", which is the first data content. The content corresponding to the above "tax return amount" belongs to the numerical class and can be classified as non-text. Of course, the ES query process can also be used to find the numerical content corresponding to the "tax return amount" in the ES library.

[0065] Step S23: Obtain the target record identifier.

[0066] The target record identifier refers to the identifier of the data record containing the first data content. As in the above example, this target record identifier can be the ID of the tax return list where the first data content is located. Since each text content in the library can be regarded as a record by the registration mark, the ID of the tax return list can be collectively referred to as the registration text record ID, such as T1001, T1002 and other numbers.

[0067] Step S24: Combine the target record identifier and the data query request as a new query request, and execute the new query request in the data record of the relational database to find out the second data content corresponding to the field to be queried in the relational database as a search result.

[0068] When the relational database is a MySQL database, step S24 can be referred to as the SQL query process. As explained above, the target record identifier can be regarded as a query prompt for the SQL query process, which is used to reduce the search scope for the SQL query. For example, it is emphasized that the second data content can be found in the data record identified as the target record identifier, without wasting time and computing power to search from other data records in MySQL. It can also be seen that the above-mentioned "first data content" is the result of the intermediate process when a full-text search is required, and its purpose is to be used to elicit the truly required search result "second data content"; of course, the first data content can also be selected as the required search result, see the following description for details, which will not be repeated here.

[0069] In summary, the embodiment of the present application stores part of the content in the relational database in a non-relational database synchronously, and the non-relational database performs external search services, which can reduce the query pressure of the relational database when facing a large number of concurrent data query requests. In addition, through the search of the non-relational database, the query direction can be provided for the query of the relational database and the query scope can be narrowed, such as prompting that the second data content can be found in the data record where the first data content is located, thereby improving the feedback efficiency and accuracy of the search results.

[0070] Based on the above example descriptions, some specific possible implementation examples will be provided below. In actual applications, the implementation contents between these examples can be combined or implemented separately as needed according to the corresponding functional principles and application logic. If implemented in combination, the execution order between the combined examples can be determined according to their respective processing logics, which can be determined by the actual scenario.

[0071] based on Figure 2 For example content, see Figure 3 to Figure 4 The present application provides another specific embodiment of a data retrieval method, which includes the following steps:

[0072] As a possible implementation, before step S24, the method of the embodiment of the present application may also include the following operations (partitioning and grouping data content): distinguishing the attributes of data content of preset types in non-relational databases and relational databases; locking the search range in the non-relational database and the relational database based on the attributes of the field to be searched, so as to respectively find the first data content and the second data content within the search range; the search range includes data content with the same attributes as the field to be searched.

[0073] Specifically, the data content in the database can be distinguished by attributes, such as by the organization, time, related personnel, etc. For example, the data content belonging to the Finance Department can be labeled "Finance Department", and the data content belonging to 2024 can be labeled "2024". The attribute information (or partition and group information) can improve the query efficiency of ES and the accuracy of matching, and reduce the ES hit records that do not meet the conditions.

[0074] The partitioning and grouping of data content is based on the consideration that when the data query request input by the user contains the partitioning and grouping information of the field content to be queried, the ES can be queried using the partitioning and grouping information together with the filter conditions in the request; in addition, since the data partitioning and grouping values ​​that can be queried and processed, and the number of partitioning and grouping dimensions are generally less than the required threshold of the number of query results, the query range can be narrowed, which can greatly reduce the search range of ES and improve the search efficiency of ES. For example:

[0075] If the query statement entered by the user is simply written as [tax return list summary of xx organization], the search range will be relatively large when the query condition [tax return list summary of xx organization] is directly used to query ES. However, if the user's query input statement contains the required attribute information: [xx organization], [June], this attribute information [xx organization], [June] can be used as the identifier of data partition grouping to query ES, which can reduce the query range of ES and improve the query efficiency and speed of ES.

[0076] As can be seen from the above description, the above attributes can be used to provide query directions for query requests and new query requests, so as to reduce the search scope of the fields to be queried in non-relational databases and relational databases, and improve query efficiency.

[0077] Step S21: Obtain a data query request.

[0078] In some specific examples, before step S22, the embodiments of the present application may also include the following operations (building a non-relational database): monitoring content changes in the relational database to capture new data records generated by changes in the relational database; distinguishing historical common content and non-historical common content in the new data records; historical common content refers to repeated content in other data records that have been stored in the non-relational database; synchronously transmitting the non-historical common content to the non-relational database, and refusing to transmit historical common content to the non-relational database, so as to build a non-relational database.

[0079] The order of executing the above process of constructing the non-relational database and step S21 is not limited and they may be executed simultaneously.

[0080] In actual applications, data can be transferred through the data synchronization suite, and external full-text search service libraries such as ES or NoSQL can be used as external index libraries for business databases (i.e. relational databases). In addition, new, modified, and deleted business data can be synchronized and updated to the ES query system (i.e. ES library) through a timing mechanism or event trigger mechanism. Generally, only the content of (text-based) records that need to be retrieved can be uploaded to the ES library synchronously to avoid ES bearing the full query pressure.

[0081] Considering that there may be duplication of text records in business data, for example, summary details and notes details in multiple versions of tax returns may use the same few lines of text description content (that is, there is historical common content), and the differences may be a few lines of summary content and a few lines of notes details newly added on the basis of the previous version of the tax return (that is, there is non-historical common content). Therefore, in order to avoid duplication of information uploaded to the ES library, occupying the storage space of the ES library, and wasting resources caused by repeatedly uploading the same information, if the historical common content is uploaded to the ES library again, only the non-historical common content can be synchronously transferred to the non-relational database to avoid increasing the storage pressure of the ES library.

[0082] As a possible implementation method, the above process of "monitoring the content changes of the relational database to capture the new data records generated by the changes in the relational database" may specifically include the following operations (using an event trigger mechanism): setting an event trigger instruction for the relational database so that when the content of the relational database is monitored to change, the new data records generated by the change are captured. Specifically, when business data changes, the data records generated by the change can be captured through event triggering methods such as database triggers, operation services, and database transaction logs.

[0083] In practical applications, the historical common content in the new data record can be distinguished through the constructed association relationship (table), and further, the distinguished historical common content can be deduplicated through the association relationship (table). In addition to data transmission, the above data synchronization suite can also be responsible for executing the creation, update, inspection, storage or use of the association relationship (table).

[0084] In some specific examples, the above-mentioned process of "distinguishing historical shared content in new data records" may specifically include the following operations: based on the association between the data content of each data record in a relational database and the version iteration number of each data record, the original data content in the data record whose version iteration number exceeds the initial version number is determined as historical shared content; the version iteration number indicates the number of times the data record is generated.

[0085] like Figure 4 As shown, each business data record (or source record) can be a document record such as a reimbursement list or a transaction flow, and these business data records contain text content. For ease of explanation and understanding, the version iteration number (or version number) of each data record in the relational database can be simply used as the identifier of each data record, that is, the version iteration number = the identifier ID of the data record, to construct an association relationship (table), for example:

[0086] There is a reimbursement list submitted yesterday. The version number of the reimbursement list can be registered as the initial version number 1001 of the business data record (attributable to the document), and the summary content in this version of the reimbursement list can be registered as the initial version number T1001 of the text record (attributable to the content details). If a new text content is added today as the summary content based on this summary content, the version number of this version of the reimbursement list generated so far can be registered as 1002, and the original summary content T1001 in this version of the reimbursement list still shares the original registered version number T1001. It can be understood that the same text content shares the same identification number T1001, but the count is accumulated to indicate how many times it has appeared so far. This count value can be simply replaced by the latest version number of the data record, such as the version number 1002 mentioned above, which can indicate the version number of the reimbursement list resulting from the change, or it can indicate that the original content in the reimbursement list, such as the summary content of T1001, is historical common content and has appeared twice so far - because version number 1002 has accumulated more than the initial version number 1001.

[0087] In this way, we can construct Figure 4 In short, the association table shown is mainly used to record the association between the text content uploaded to ES and the real source business data. Specifically, it can indicate which text content appears in which source data records and how many times it appears. The text content that appears repeatedly can be called historical shared content. If the historical shared content is synchronized to the ES library for storage, the part of the text content that is currently being transmitted or has been transmitted can be removed to avoid repeated storage in the ES library.

[0088] Step S22: When the data query request includes a to-be-queried field of a preset type, the data query request is executed in the non-relational database to find out the first data content corresponding to the to-be-queried field in the non-relational database.

[0089] Step S23: Obtain the target record identifier.

[0090] In some specific examples, step S23 may specifically include the following operations: obtaining the association relationship between each data content and the identifier of each data record in the relational database; the association relationship is used to indicate the data record where the data content is located, and each data record contains a new data record that has changed; based on the association relationship, the identifier of the data record containing the first data content is determined as the target record identifier.

[0091] As above about Figure 4The example of , can use the association table [Registered Text Record ID] to search [Source Business Record ID] for the second time: through the association table, determine the data record (version 1001, version 1002) containing the first data content (T1001), and then determine the identifier of the data record (such as source business record ID number 1001, 1002) as the target record identifier. In other words, after the ES query branch finds the specified data content, it can find which source records also have the data content through the association relationship.

[0092] As a possible implementation method, if there are no or very few duplicate records in the current actual business, the above-mentioned association relationship (table) can be ignored and not used, and the [business data record ID] and [text content that needs to be fully retrieved, such as summary, notes...] in the source business record can be directly uploaded to the ES library synchronously, so that by querying the ES library, the ID of the source business record can be directly obtained, and there is no need to use the [registered text record ID] to search for the [source business record ID] twice through the association relationship table as above.

[0093] Step S24: Combine the target record identifier and the data query request as a new query request, and execute the new query request in the data record of the relational database to find out the second data content corresponding to the field to be queried in the relational database as a search result.

[0094] In short, the embodiments of the present application can: reduce the data storage space of the full-text index, and achieve accurate matching during query; can meet complex business query scenarios, such as querying text and content other than numerical values; does not require major modifications to some complex business systems; and greatly improves the query efficiency of full-text retrieval in complex scenarios.

[0095] In some examples, the first data content can be selected as the search result. Taking into account that the content between databases may differ due to synchronization time differences, in order to avoid inaccuracies such as omissions when the first data content is used as a search result, the second data content obtained based on the SQL query process can be used to verify the accuracy and credibility of the ES query result (i.e., the first data content) when it is used as a search result, thereby completing the checking and filling of omissions in the first data content.

[0096] If it is verified that the accuracy of the ES query result is not ideal, such as the inconsistency between the first data content and the second data content (including the situation that the first data content is missing), the first data content can be synchronously updated based on the second data content; because in terms of the effect of data synchronization, in reality, the data content of the source database will be more sufficient than the data content of the external database (receiving the data synchronously transmitted by the source database), and it is more timely and reliable. Therefore, as a possible implementation method, after step S24, the method of the embodiment of the present application can also include the following operations (selecting at least part of the first data content as the retrieval result): If there is at least one group of first data content corresponding to the field to be searched, each first data content and the second data content corresponding to the first data content are respectively used as a comparison group; a preset number of comparison groups are selected to compare the consistency between the contents within the group to screen out the comparison groups with inconsistent contents within the group; based on the second data content in the comparison group with inconsistent contents within the group, the first data content is synchronously updated as a new retrieval result.

[0097] As mentioned above, the reason why there are multiple groups of first data contents corresponding to the fields to be checked is that multiple target record identifiers are found. If so, the first data content corresponding to each target record identifier and its second data content can be used as a comparison group to complete the first data content.

[0098] ES query results may be inaccurate or fail to meet the final SQL filtering conditions, so it is necessary to combine SQL to verify the final results. In addition, the amount of data that meets the conditions may be large each time the query comes out, so it is only necessary to obtain and verify the required number of records, and there is no need to verify all the first data contents hit in ES, that is, only verify part of the first data content required for the query output. Therefore, illustratively, the second data content directly found by the text record ID of the first data content can be used as a comparison party of the first data content, that is, the first data content and the second data content form a comparison group. Furthermore, in order to avoid too many SQL verifications at one time, the paginated results of the ES query can be verified in batches or pagination, that is, the consistency comparison between the contents within each group is carried out in batches. Of course, the consistency between the contents within each group can also be compared at the same time, and there is no specific limitation.

[0099] As a possible implementation, after step S22, the method of the embodiment of the present application may also include the following operations (outputting more query results): if the quantity of the first data content or the second data content does not meet the preset display quantity, determine the storage location of the first data content in the non-relational database; flip the search range of the field to be queried in the non-relational database from the page where the storage location is located to other pages in the non-relational database, and execute data query requests on other pages until the first data content that meets the preset display quantity is obtained or the page flipping is completed.

[0100] like Figure 3 As shown, S1: When business data is added or changed, the changed data records can be captured through event triggers such as database triggers, operation services, and database transaction logs. S2: With the help of the data synchronization suite, the text information generated by the change and the relationship between the text and the source record are checked and processed; with the help of the data synchronization suite, the text information is synchronized and stored in the ES service cluster.

[0101] When a data query request is initiated, first (Step-1) the query condition, i.e. the specific query statement (including the field to be queried), is parsed to determine whether there is a field of the preset type; the query condition may or may not contain attribute information of the field to be queried, which can be entered by the user.

[0102] If there is no text search condition that meets the search requirements in the query conditions, that is, there is no text field to be searched, because only numerical fields such as amount or date are to be searched, there is no need to go through ES query (Step-2), because SQL query can do it well, that is, you can directly execute the original SQL query logic (Step-4) and output the results (Step-6).

[0103] If there is a text search condition in the query condition, ES query is performed first (Step-2). After obtaining the ES query result (i.e., the first data content), (Step-3) the ES query result is combined with the original query condition to perform SQL query (Step-4) to obtain the SQL query result (i.e., the second data content).

[0104] It can be determined whether the first data content or the second data content meets the final display quantity requirement (Step-5). If so, the result is output (Step-6). If the final display quantity requirement is not met, the next page of ES is switched (i.e., page turning) and then repeated execution (Step2, Step3, Step4, Step5), that is, the above steps 23 to 25 are repeated: first, an ES query is performed to obtain the hit text record ID, and then the text record ID is used, combined with the original query conditions, to perform an SQL query in the business database until the data content record that meets all conditions (including meeting the display quantity requirement) is finally output (Step-6), or the ES page turning ends.

[0105] In summary, if Figure 4As shown, the embodiment of the present application can: (1) extract [text information], [grouping and partitioning] dimension attribute information, etc. from the source data record of the relational database, and synchronously upload them to non-relational databases such as ES for storage; wherein, when adding text, the efficiency of deduplication of duplicate text content can be improved based on the table index field corresponding to the text content; the data fields contained in each record in the ES library can include: 1. registered text record ID, 2. text record (for example: summary details, note details), 3. partition grouping value (not necessarily required). (2) The data synchronization suite can record the association relationship between the deduplicated text content and the source data record to form an association relationship table. (3) In ES, use the attribute information of the [grouping and partitioning] dimension (there is no information if the user does not enter it) and the query conditions originally entered by the user to quickly query [text information] and return it. (4). Use the association relationship table to find the source business data record ID corresponding to the text ID. (5). Use the source business data record ID plus the original query conditions to re-query the business data table, that is, perform SQL query, and obtain more accurate and complete data content as the query result.

[0106] From the above description, it can be seen that the advantages of the embodiments of the present application are:

[0107] 1. Storing the association information between text and data records in a relational database and using the index field of the association table can ensure the query efficiency of checking for duplicate text when adding new association records.

[0108] 2. It is not required to synchronize all business data. It is only necessary to synchronize the searchable text information to the query service system represented by ES to avoid wasting resources.

[0109] 2. Not bound to a specific full-text search service. For example, you can use a full-text search service similar to ES.

[0110] 3. Perfectly compatible with existing business systems that use SQL queries. That is, external index services are started only when full-text search is needed, that is, ES queries are used. When full-text search is not used, the original query logic and services are still used, so the impact on the existing system is minimal. It can automatically select the original SQL direct query or the use of external index query acceleration based on whether the full-text search conditions are required in the input query conditions, with high selectivity.

[0111] 4. Satisfy both efficient full-text query and accurate text fuzzy matching. Because when using ES query directly, ES may perform word segmentation on the text conditions, resulting in incorrect query result matching. In the embodiment of the present application, the original SQL will be used to verify and filter the first data content before the final data is output, so the query result will be more 100% accurate.

[0112] 5. Use SQL in combination with external full-text search services to improve the query efficiency of fuzzy matching of text in business data while ensuring accurate matching.

[0113] 6. Perform paginated queries on external full-text search services based on the number of query results to avoid redundant and invalid queries.

[0114] 7. Use data partitioning and grouping information to ensure the query efficiency of text data in ES, which can reduce the ES hit records that do not meet the conditions.

[0115] Compared to Figure 2 The examples shown illustrate that the above-mentioned additional or detailed example contents or possible implementation methods do not necessarily have to be executed during the specific implementation. If more than two examples or possible implementation methods are added or refined, these examples or possible implementation methods can be implemented in combination or separately. If implemented in combination, the execution order of the combined examples can be determined according to their respective processing logic, which can be determined according to the actual scenario.

[0116] See also Figure 5 , the second aspect of the present application provides a specific embodiment of a data retrieval system, the system comprising: an acquisition unit 501, a processing unit 502;

[0117] The acquisition unit 501 is used to acquire a data query request;

[0118] The processing unit 502 is used to, when the data query request includes a to-be-queried field of a preset type, execute the data query request in the non-relational database to find out the first data content corresponding to the to-be-queried field in the non-relational database; the non-relational database synchronizes data content of at least part of the data records in the relational database, the data content including the content corresponding to the field of the preset type;

[0119] The acquisition unit 501 is further used to acquire a target record identifier; the target record identifier refers to an identifier of a data record containing the first data content;

[0120] The processing unit 502 is further configured to combine the target record identifier and the data query request as a new query request, and execute the new query request in the data record of the relational database to find out the second data content corresponding to the to-be-queried field in the relational database as a search result.

[0121] In some examples, the processing unit 502 is further used to: monitor the content changes of the relational database to capture new data records generated by the changes in the relational database;

[0122] Distinguish between historical common content and non-historical common content in new data records; historical common content refers to repeated data content in other data records that have been stored in the relational database;

[0123] The non-historical shared content is synchronously transmitted to the non-relational database, and the historical shared content is refused to be transmitted to the non-relational database, so as to construct a non-relational database.

[0124] In some examples, the acquisition unit 501 is specifically used to: based on the association between the data content of each data record in the relational database and the version iteration number of each data record, determine the original data content in the data record whose version iteration number exceeds the initial version number as historical common content; the version iteration number indicates the number of times the data record is generated.

[0125] In some examples, the acquisition unit 501 is specifically used to:

[0126] Obtaining the association relationship between each data content and the identifier of each data record in the relational database; the association relationship is used to indicate the data record where the data content is located, and each data record contains a new data record that has changed;

[0127] Based on the association relationship, the identifier of the data record containing the first data content is determined as the target record identifier.

[0128] In some examples, the processing unit 502 is further used to: distinguish attributes of data content belonging to a preset type in a non-relational database and a relational database;

[0129] Based on the attributes of the field to be checked, the search range is locked in the non-relational database and the relational database to find out the first data content and the second data content respectively within the search range; the search range includes the data content with the same attributes as the field to be checked.

[0130] In some examples, the processing unit 502 is further configured to:

[0131] If the quantity of the first data content or the second data content does not meet the preset display quantity, determining the storage location of the first data content in the non-relational database;

[0132] The search range of the field to be searched in the non-relational database is paged from the page where the storage location is located to other pages in the non-relational database, and data query requests are executed on other pages until the first data content that meets the preset display quantity is obtained or the page turning is completed.

[0133] In some examples, the processing unit 502 is further configured to:

[0134] If there is at least one group of first data contents corresponding to the to-be-checked field, each first data content and the second data content corresponding to the first data content are respectively taken as a comparison group;

[0135] Select a preset number of comparison groups to compare the consistency of the contents within the groups, so as to screen out the comparison groups with inconsistent contents within the groups;

[0136] Based on the second data content in the comparison group with inconsistent content within the group, the first data content is synchronously updated as a new search result.

[0137] In the embodiment of the present application, the operations performed by each unit of the data retrieval system are similar to the operations described in the first aspect or any specific method embodiment of the first aspect, and will not be described in detail here. Of course, the specific implementation process of each operation in the first aspect of the present application can also refer to the relevant description of the second aspect.

[0138] See also Figure 6 The electronic device 600 of the embodiment of the present application may include one or more processors (such as central processing units (CPU)) 601 and a memory 605, in which one or more applications or data are stored.

[0139] The memory 605 may be a volatile storage or a persistent storage. The program stored in the memory 605 may include one or more modules, each of which may include a series of instruction operations in the electronic device. Furthermore, the processor 601 may be configured to communicate with the memory 605 and execute a series of instruction operations in the memory 605 on the electronic device 600.

[0140] The electronic device 600 may also include one or more power supplies 602, one or more wired or wireless network interfaces 603, one or more input and output interfaces 604, and / or one or more operating systems, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0141] The processor 601 can execute the operations performed by the aforementioned first aspect or any specific method embodiment of the first aspect, and the details will not be repeated here.

[0142] The present application provides a computer-readable storage medium, comprising instructions, which, when executed on a computer, enable the computer to execute the method described in the first aspect or any specific implementation of the first aspect.

[0143] The present application provides a computer program product comprising instructions or a computer program. When the computer program product is run on a computer, the computer is enabled to execute the method described in the first aspect or any specific implementation of the first aspect.

[0144] It is understood that in various embodiments of the present application, the sequence number of each step does not mean the order of execution, and the execution order of each step should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The operation content added or refined in each example scheme of the above method, system or device (if any) does not necessarily have to be executed in the specific implementation. If more than two operations are added, these operations can be implemented in combination or separately, depending on the actual scenario.

[0145] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system (if any) and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0146] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system or device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0147] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0148] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0149] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product (or computer program product) is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a business server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.

Claims

1. A data retrieval method, characterized in that: include: Get data query request; When the data query request includes a to-be-queried field of a preset type, the data query request is executed in a non-relational database to find out a first data content corresponding to the to-be-queried field in the non-relational database; the non-relational database synchronizes data content of at least part of the data records in the relational database, the data content including content corresponding to the field of the preset type; Obtaining a target record identifier; the target record identifier refers to an identifier of the data record containing the first data content; The target record identifier and the data query request are combined as a new query request, and the new query request is executed in the data record of the relational database to find out the second data content corresponding to the field to be queried in the relational database as a retrieval result.

2. The data retrieval method according to claim 1, characterized in that: Before executing the data query request in the non-relational database to find out the first data content corresponding to the to-be-queried field in the non-relational database, the method further includes: Monitoring changes in the content of the relational database to capture new data records generated by the changes in the relational database; Distinguish historical common content and non-historical common content in the new data record; the historical common content refers to repeated data content that has been stored in other data records in the relational database; The non-historical shared content is synchronously transmitted to the non-relational database, and the transmission of the historical shared content to the non-relational database is refused, so as to construct the non-relational database.

3. The data retrieval method according to claim 2, characterized in that: The distinguishing the historical common content in the new data record includes: Based on the association between the data content of each data record in the relational database and the version iteration number of each data record, the original data content in the data record whose version iteration number exceeds the initial version number is determined as historical common content; the version iteration number indicates the number of times the data record is generated.

4. The data retrieval method according to claim 1, characterized in that: The step of obtaining the target record identifier includes: Acquire an association relationship between each of the data contents and an identifier of each of the data records in the relational database; the association relationship is used to indicate the data record where the data content is located, and each of the data records includes a new data record that has changed; Based on the association relationship, an identifier of the data record containing the first data content is determined as the target record identifier.

5. The data retrieval method according to claim 1, characterized in that: Before executing the new query request in the data record of the relational database, the method further includes: Distinguishing attributes of data contents belonging to the preset type in the non-relational database and the relational database; Based on the attributes of the field to be checked, a search range is locked in the non-relational database and the relational database to respectively find out the first data content and the second data content within the search range; the search range includes data content with the same attributes as the field to be checked.

6. The data retrieval method according to claim 1, characterized in that: After executing the data query request in the non-relational database to find out the first data content corresponding to the to-be-queried field in the non-relational database, the method further includes: If the quantity of the first data content or the second data content does not meet the preset display quantity, determining the storage location of the first data content in the non-relational database; The search range of the field to be searched in the non-relational database is flipped from the page where the storage location is located to other pages in the non-relational database, and the data query request is executed on the other pages until the first data content that meets the preset display quantity is obtained or the page flipping is completed.

7. The data retrieval method according to claim 1, characterized in that: After finding out the second data content corresponding to the to-be-queried field in the relational database as a search result, the method further includes: If there is at least one group of first data contents corresponding to the to-be-checked field, each of the first data contents and the second data contents corresponding to the first data contents are respectively taken as a comparison group; Selecting a preset number of comparison groups to compare the consistency of the contents within the groups, so as to screen out the comparison groups with inconsistent contents within the groups; Based on the second data content in the comparison group with inconsistent content within the group, the first data content is synchronously updated as a new search result.

8. A data retrieval system, characterized in that: include: Acquisition unit, processing unit; The acquisition unit is used to acquire a data query request; The processing unit is used for, when the data query request includes a field to be checked of a preset type, executing the data query request in the non-relational database to find out the first data content corresponding to the field to be checked in the non-relational database; the non-relational database synchronizes data content of at least part of the data records in the relational database, the data content including the content corresponding to the field of the preset type; The acquisition unit is further used to acquire a target record identifier; the target record identifier refers to an identifier of the data record containing the first data content; The processing unit is also used to combine the target record identifier and the data query request as a new query request, and execute the new query request in the data record of the relational database to find out the second data content corresponding to the field to be queried in the relational database as a retrieval result.

9. An electronic device, characterized in that: include: Processor and memory; The processor is configured to communicate with the memory and execute instructions in the memory to implement the method according to any one of claims 1 to 7.

10. A readable storage medium, characterized in that: The readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.

11. A computer program product, characterized in that The computer program product comprises computer instructions, which implement the method according to any one of claims 1 to 7 when executed by a processor.

Citation Information

Patent Citations

  • Data access method and device and data storage method and device

    CN111414403A

  • MySQL large table association query system and method

    CN115905313A

  • Data query method and device, computer equipment and storage medium

    CN116610703A

  • Data query method, device and calculating apparatus

    WO2018149271A1