Data query method and device, computer equipment, readable storage medium and program product
Provide two query methods: database search and search engine search on the data query page, and determine the target query method based on the update frequency of the query and the update frequency of the data. The problem has achieved fast and efficient data query.
Patent Information
- Application Number
- CN202411462054.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-10-18
AI Technical Summary
The prior art is difficult to take into account the query speed of real-time data and historical data, which has affected business processing.
Provide a data query method. By providing database search and search engine search methods on the data query page, the target query method is determined according to the query conditions and the update frequency of data shards to achieve fast inquiries.
Effectively take into account the speed of real -time data and historical data, and improve the response speed of data query and the efficiency of business processing.
Smart Images

Figure CN119377262A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data search technology, and in particular to a data query method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] With the development of computer technology, in order to improve the speed of finding specified data in massive data, in related technologies, data can be synchronously stored in search engines, and searched using the search engine's fast query mechanism, which can significantly improve the response speed when querying data.
[0003] However, the inventors found in practice that although the above method can effectively improve the data query speed, the above method is often unable to timely query the recently updated business data, affecting business processing. It can be seen that the relevant technology has the problem of difficulty in balancing the query speed of real-time data and historical data. Summary of the invention
[0004] Based on this, it is necessary to provide a data query method, device, computer equipment, computer-readable storage medium and computer program product that take into account the query speed of real-time data and historical data in order to address the above technical problems.
[0005] In a first aspect, the present application provides a data query method, comprising:
[0006] Displaying a data query page; the data query page provides a first query method and a second query method at the same time, the first query method includes searching in a database storing business data, and the second query method includes searching in a data slice corresponding to the business data through a search engine;
[0007] According to a data query operation triggered on the data query page to request querying target data, determining a target query method from the first query method and the second query method;
[0008] The interface corresponding to the target query method is called to query the target data through the target query method.
[0009] In one embodiment, the determining the target query method from the first query method and the second query method according to the data query operation triggered on the data query page to request querying the target data includes:
[0010] Acquire query conditions for the target data according to a data query operation triggered on the data query page to request querying the target data;
[0011] A recommended query method matching the query condition is determined from the first query method and the second query method, and a target query method is determined based on the recommended query method.
[0012] In one embodiment, determining a recommended query method matching the query condition from the first query method and the second query method includes:
[0013] If the query condition is a time search range corresponding to the target data, obtaining the update frequency of the data slices related to the target data in the search engine;
[0014] In a case where it is determined according to the update frequency that the data slices related to the target data within the time search range are not updated, using the first query mode as a recommended query mode;
[0015] When it is determined according to the update frequency that the data slices related to the target data within the time search range have been updated, the second query mode is used as a recommended query mode.
[0016] In one embodiment, the calling of the interface corresponding to the target query method includes:
[0017] If the target query method is the first query method, displaying a query condition adding prompt, wherein the query condition adding prompt is used to prompt the user to add other query conditions except the time search range;
[0018] The newly added other query conditions are received, an interface call request including the time search range and the other query conditions is generated, and sent to an interface corresponding to the first query method.
[0019] In one embodiment, determining a recommended query method matching the query condition from the first query method and the second query method includes:
[0020] If the query condition includes multiple query conditions, predicting the query speed comparison results of the first query method and the second query method under the multiple query conditions;
[0021] According to the query speed comparison result, a recommended query method is determined from the first query method and the second query method.
[0022] In one embodiment, the predicting of the query speed comparison result of the first query mode and the second query mode under the multiple query conditions includes:
[0023] Calling a pre-trained query speed prediction model, inputting the multiple query conditions into the query speed prediction model, and obtaining a query speed comparison result between the first query mode and the second query mode;
[0024] The query speed prediction model is trained based on a sample query condition set and a query speed label, and the query speed label represents a query speed comparison result between the first query method and the second query method when performing data query based on multiple sample query conditions in the sample query condition set.
[0025] In a second aspect, the present application also provides a data query device, comprising:
[0026] A page display module, used to display a data query page; the data query page provides a first query mode and a second query mode at the same time, the first query mode includes searching in a database storing business data, and the second query mode includes searching in a data slice corresponding to the business data through a search engine;
[0027] A target query mode determination module, configured to determine a target query mode from the first query mode and the second query mode according to a data query operation triggered on the data query page to request querying target data;
[0028] The data query module is used to call the interface corresponding to the target query method to query the target data through the target query method.
[0029] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0030] Displaying a data query page; the data query page provides a first query method and a second query method at the same time, the first query method includes searching in a database storing business data, and the second query method includes searching in a data slice corresponding to the business data through a search engine;
[0031] According to a data query operation triggered on the data query page to request querying target data, determining a target query method from the first query method and the second query method;
[0032] The interface corresponding to the target query method is called to query the target data through the target query method.
[0033] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0034] Displaying a data query page; the data query page provides a first query method and a second query method at the same time, the first query method includes searching in a database storing business data, and the second query method includes searching in a data slice corresponding to the business data through a search engine;
[0035] According to a data query operation triggered on the data query page to request querying target data, determining a target query method from the first query method and the second query method;
[0036] The interface corresponding to the target query method is called to query the target data through the target query method.
[0037] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0038] Displaying a data query page; the data query page provides a first query method and a second query method at the same time, the first query method includes searching in a database storing business data, and the second query method includes searching in a data slice corresponding to the business data through a search engine;
[0039] According to a data query operation triggered on the data query page to request querying target data, determining a target query method from the first query method and the second query method;
[0040] The interface corresponding to the target query method is called to query the target data through the target query method.
[0041] The above-mentioned data query method, device, computer equipment, computer-readable storage medium and computer program product can display a data query page, which simultaneously provides a first query method and a second query method, wherein the first query method includes searching in a database storing business data, and the second query method includes searching in a data segment corresponding to the business data through a search engine; and then in response to a data query operation that triggers a request to query the target data on the data query page, the target query method can be determined from the first query method and the second query method, and then the interface corresponding to the target query method is called to query the target data through the target query method. In this embodiment, by providing the first query method and the second query method at the same time, and determining the target query method from them when receiving the data query operation, it is possible to use the search engine to quickly search or directly search in the database according to the actual situation. On the one hand, the business data that has been synchronized to the search engine in time can be quickly obtained through the first query method, and on the other hand, the business data that has not been synchronized to the search engine in time can be obtained in time in the database through the second query method, so that the query speed of real-time data and historical data can be effectively taken into account. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 A schematic diagram of a flow chart of a data query method in an embodiment;
[0044] Figure 2 A flowchart of a step of determining a target query method in an embodiment;
[0045] Figure 3 A schematic diagram of a flow chart of another data query method in one embodiment;
[0046] Figure 4 is a structural block diagram of a data query device in an embodiment;
[0047] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0049] In one embodiment, Figure 1 As shown, a data query method is provided. This embodiment uses the method applied to a terminal as an example. It can be understood that the method can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. Among them, the terminal can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0050] In this embodiment, the method includes the following steps:
[0051] S101, displaying a data query page; the data query page provides a first query method and a second query method at the same time, the first query method includes searching in a database storing business data, and the second query method includes searching in data slices corresponding to the business data through a search engine.
[0052] In a specific implementation, a data query page may be set up for users to query data. In this embodiment, at least two query methods for querying data are provided at the same time, which can be selected by users to query data. For the sake of distinction, the method of searching in a database storing business data to obtain data to be queried is called the first query method, and the method of searching the data slices corresponding to the business data through a search engine is called the second query method. After detecting a triggering event in which a user requests to query data, a data query page may be displayed on the terminal for users to query data through a variety of data query methods provided in the data query page.
[0053] In some embodiments, in response to one or more operations of the user on adding, reducing, deleting or modifying business data, the business data originally stored in the database can be updated in a timely manner. In addition, the business data in the database can be synchronized to the search engine according to preset business logic.
[0054] Exemplarily, the first query method may be to query through a database query statement, for example, the corresponding data record may be queried in the database according to a structured query language (SQL) statement or a natural language statement provided by the user. The second query method may be to search the data shards corresponding to the synchronized business data by the search engine based on a distributed search method. For example, the search engine database corresponding to the search engine may include the data shards corresponding to the synchronized business data. The data shards may be understood as being obtained after slicing the synchronized business data. After the search engine obtains the query request containing the query condition, it may perform data query according to the data shards and the inverted index. In one example, the second query method may be implemented by the Elasticsearch search engine.
[0055] S102, according to a data query operation that triggers a request to query target data on a data query page, determining a target query method from a first query method and a second query method.
[0056] The target data may be the business data that the user intends to search for and obtain.
[0057] In a specific implementation, although the database storing business data can synchronize the business data to the search engine, the search engine can quickly perform data query through the second query method. However, in some cases, for business data update operations that frequently occur in the database, such as the addition or modification of batch data, data blockage often occurs, and the newly added real-time data cannot be quickly and accurately queried through the search engine. The user needs to wait for a period of time before continuing to query the data normally after the search engine completes data synchronization, which has a greater impact on business processing. In other words, for the second data query method, in some cases, the query speed of the second data query method will be faster than the query speed of the first data query method, which can effectively improve the efficiency of business data query, but there is a problem that the real-time performance of the data is not stable enough, especially when there is a large amount of data to be inserted and updated, the data queried by the page will be delayed, resulting in the inability to query the newly added data.
[0058] In this regard, in this embodiment, in response to a user triggering a data query operation requesting query of target data on a data query page, a query method may be selected from a first query method and a second query method as a target query method.
[0059] In one embodiment, a query mode switch button can be set in the data query page, and the switch button can be used to control the target query mode currently used. For example, the user can control whether to use the first query mode or the second query mode through the switch button. When the data query operation includes a control operation on the switch button, the query mode selected by the user can be determined as the target query mode from the first query mode and the second query mode according to the control operation. In some examples, if the data query page displays business data within a preset historical time period by default, such as data within the time range of the past week, the switch button can select the second query mode by default. When the user needs to query the most recently updated real-time data, the button can be switched to the first query mode.
[0060] In another embodiment, after detecting a data query operation, one or more data storage characteristics of the target data to be queried can be determined, such as the storage time of the target data in the database, the time or frequency of synchronization to the search engine, etc., and then the device matches a suitable query method from the first query method and the second query method as the target query method based on the acquired data storage characteristics.
[0061] S103, calling an interface corresponding to the target query method to query the target data through the target query method.
[0062] After the target query method is obtained, the target data can be queried through the target query method. Specifically, in this embodiment, the query interface of the back-end server can provide a data interface supporting the first query method and a data interface supporting the second query method at the same time. After the target query method is determined, the terminal can call the interface corresponding to the target query method and query the target data through the interface.
[0063] In the above data query method, a data query page can be displayed, and the data query page provides a first query method and a second query method at the same time. The first query method includes searching in a database storing business data, and the second query method includes searching in a data segment corresponding to the business data through a search engine; then in response to triggering a data query operation requesting query of target data on the data query page, the target query method can be determined from the first query method and the second query method, and then the interface corresponding to the target query method is called to query the target data through the target query method. In this embodiment, by providing the first query method and the second query method at the same time, and determining the target query method from them when receiving the data query operation, it is possible to use the search engine to quickly search or directly search in the database according to the actual situation. On the one hand, the business data that has been synchronized to the search engine in time can be quickly obtained through the first query method. On the other hand, for the business data that has not been synchronized to the search engine in time, it can be obtained in time in the database through the second query method, so that the query speed of real-time data and historical data can be effectively taken into account.
[0064] In one embodiment, Figure 2 As shown, in step S102, according to the data query operation of triggering a request to query the target data on the data query page, determining the target query mode from the first query mode and the second query mode may include the following steps:
[0065] S201, acquiring query conditions of target data according to a data query operation triggered on a data query page to request query of target data.
[0066] In actual applications, when a user triggers a data query operation, the user can set query conditions for querying the target data on the data query page, where the query conditions can be understood as the query conditions of the device provided by the user when querying the target data. The device can use the target query method and combine the query conditions to query and obtain the target data.
[0067] In this step, the query conditions corresponding to the target data can be obtained according to the query statement entered by the user in the data query page. Exemplarily, the query conditions may include a time search range, or may include objects related to the target data, such as an enterprise or company name, or may include the data status of the target data. For example, when the target data is a document, the query conditions may include the document status. It is understandable that the query conditions for the target data may include one or more.
[0068] S202: Determine a recommended query method that matches the query condition from the first query method and the second query method, and determine a target query method based on the recommended query method.
[0069] Since the clues and data query ranges provided to the device may vary greatly under different query conditions, the query speed of the first query method or the second query method may also differ. After obtaining the query conditions corresponding to the target data, a recommended query method matching the query conditions can be determined from the first query method and the second query method. The recommended query method can be understood as a query method with a higher query speed under the current query conditions.
[0070] In some embodiments, the recommended query method may be sent to the user, and after receiving the user's confirmation information, the recommended query method may be used as the target query method; or the selected recommended query method may be directly used as the target query method.
[0071] In this embodiment, after obtaining the query conditions, it is possible to quickly and efficiently determine the recommended query method that matches the query conditions from the first query method and the second query method, and determine the target query method. On the one hand, the selected target query method can match the query conditions currently provided by the user. On the other hand, the appropriate target query method can be selected without combining usage experience, thereby lowering the user usage threshold.
[0072] In one embodiment, in step S202, determining a recommended query method matching the query condition from the first query method and the second query method may include the following steps:
[0073] If the query condition is the time search range corresponding to the target data, the update frequency of the data slices related to the target data in the search engine is obtained; when it is determined according to the update frequency that the data slices related to the target data within the time search range have not been updated, the first query method is used as the recommended query method; when it is determined according to the update frequency that the data slices related to the target data within the time search range have been updated, the second query method is used as the recommended query method.
[0074] Among them, the time search range can be understood as the time range used when searching for target data. Exemplarily, the time range can be the storage time range of the target data, or it can be other time ranges. For example, when the target data is a document, the time search range can be the range of the occurrence time of the business corresponding to the document.
[0075] In actual applications, if the query condition is the time search range corresponding to the target data, the update frequency of the data slices related to the target data in the search engine can be obtained. Different types of data slices in the search engine can be configured with different update frequencies, and the search engine can update the corresponding type of data slices according to the update frequency. After detecting the data query operation, the type of target data can be determined and the update frequency of the data slice of that type can be obtained.
[0076] After obtaining the update frequency, the time search range can be compared with the update frequency, and whether the data shards related to the target data in the search engine have been updated can be identified based on the comparison results. For example, for the data shards of document type A, the update frequency is once a week. The device can infer the predicted update time after the historical update time based on the most recent historical update time stored in advance. If the predicted update time matches the time search range, for example, the time search range is earlier than the predicted update time, it can be determined that the data shards related to the target data have been updated. If the predicted update time does not match the time search range, for example, the time search range is later than the predicted update time, it can be determined that the data shards related to the target data have not been updated.
[0077] When it is determined that the data shards related to the target data have not been updated, the first query method can be used as a recommended query method, so as to accurately obtain the real-time updated target data by querying the database. When it is determined that the data shards related to the target data have been updated, the second query method can be used as a recommended query method, so as to improve the data query speed. In some cases, the data synchronization logic of the search engine may be more complicated. Compared with directly comparing the time search range and the last update time, this embodiment predicts whether the data shards have been updated by updating the frequency, and can also add a certain amount of redundant space. For example, although the time search range is later than the last update time, when the last update time is close (such as the time difference is less than the preset threshold), it can still be considered that the target data has been updated, and you can wait for a period of time until the new update time arrives to obtain the latest target data.
[0078] In this embodiment, through the update frequency of the data shards and the time search range of the target data, it is possible to effectively identify whether the data shards related to the target data have been updated, thereby accurately selecting the first query method or the second query method as the recommended query method, thereby improving the reliability and rationality of the recommended query method. At the same time, by identifying the situation of the data shards related to the target data, it is possible to avoid too many requests for simultaneous database queries, thereby increasing database pressure.
[0079] In addition, on the one hand, in order to solve the problem of poor timeliness of data query caused by large amount of data insertion and update, and the search engine cannot obtain real-time data or is unlikely to obtain real-time data, the first query method can be used as a recommended query method through the method of this embodiment, prompting the user to switch from the second query method to the first query method in time, so that the user can quickly switch to the database for query, obtain real-time data for business processing, avoid waiting time, improve the query efficiency of real-time data, and avoid affecting business development. On the other hand, for business data that has been synchronized to the search engine, by giving priority to recommending the second query method for data query, the pressure on the database can be reduced while effectively improving the data query speed.
[0080] In one embodiment, calling the interface corresponding to the target query mode may include the following steps:
[0081] If the target query method is the first query method, a query condition adding prompt is displayed, and the query condition adding prompt is used to prompt the user to add other query conditions besides the time search range; receive the newly added other query conditions, generate an interface call request including the time search range and other query conditions, and send it to the interface corresponding to the first query method.
[0082] When the query condition provided by the user is a time search range, it may take a long time to search in the database using the first query method. In this regard, after determining that the target query method is the first query method, a query condition addition prompt can be displayed to the user to prompt the user to add other query conditions in addition to the time search range. Furthermore, after obtaining the other query conditions added by the user, an interface call request containing the time search range and other query conditions can be generated and sent to the interface corresponding to the first query method to call the interface corresponding to the first query method.
[0083] In this embodiment, when the target query mode is determined to be the first query mode, more other query conditions can be added in time by displaying a prompt for adding query conditions, and then the interface corresponding to the first query mode is called, which can narrow the query scope and improve the query accuracy when using the database to query the target data, thereby improving the real-time data query efficiency when the data query mode is switched to the first query mode.
[0084] In one embodiment, in step S202, determining a recommended query method matching the query condition from the first query method and the second query method may include the following steps:
[0085] If the query condition includes multiple query conditions, then based on the multiple query conditions, the query speed comparison result of the first query method and the second query method is predicted; based on the query speed comparison result, a recommended query method is determined from the first query method and the second query method.
[0086] In some embodiments, a user can configure multiple query conditions simultaneously in a data query page. For example, the multiple query conditions can be query conditions involving different aspects of information. Due to the multiple query conditions involved, it may be difficult for the user to select a suitable query condition from two optional query methods in a timely manner. In this embodiment, when the query condition includes multiple query conditions, the query speed comparison results of the first query method and the second query method under the multiple query conditions can be predicted first, thereby determining the query speed comparison results when the first query method and the second query method respectively use multiple query conditions to perform data query.
[0087] Furthermore, based on the query speed comparison result, a recommended query method can be determined from the first query method and the second query method. For example, a query method with a faster query speed can be determined from the first query method and the second query method as the recommended query method. If the two are the same, the second query method can be used as the recommended query method to reduce database pressure.
[0088] In this embodiment, when there are multiple query conditions, by predicting the query speed comparison result, a better query method can be recommended to the user, thereby improving the query speed in different query situations.
[0089] In one embodiment, predicting the query speed comparison result of the first query mode and the second query mode under multiple query conditions may include the following steps:
[0090] A pre-trained query speed prediction model is called, and multiple query conditions are input into the query speed prediction model to obtain a query speed comparison result between the first query method and the second query method.
[0091] The query speed prediction model is trained based on a sample query condition set and a query speed label, and the query speed label represents a query speed comparison result between a first query method and a second query method when performing data query based on multiple sample query conditions in the sample query condition set.
[0092] In a specific implementation, the query speed prediction model can be pre-trained. In some optional embodiments, the query speed prediction model can be obtained by training a neural network model. During training, multiple sample query condition sets and query speed labels corresponding to each sample query condition can be set. A sample query condition set includes multiple sample query conditions. The query speed labels corresponding to the sample query condition sets can indicate the query speed comparison results when the first query method and the second query method perform data queries based on the sample query conditions in the same sample query condition set. Then, the sample query condition set can be input into the query speed prediction model to be trained to obtain the prediction result output by the model, and the model loss value is determined according to the difference between the prediction result and the query speed label. The model parameters are adjusted according to the model loss value, and the trained query speed prediction model is obtained when the training end condition is met.
[0093] Furthermore, when multiple query conditions input by the user into the data query page are obtained, a pre-trained query speed prediction model can be called, and the multiple query conditions can be input into the query speed prediction model to obtain a query speed comparison result of the first query method and the second query method.
[0094] In this embodiment, by pre-training the query speed prediction model and learning the query speed comparison results of the first query method and the second query method under different situations through the model, the device can accurately identify the accuracy of the query speed comparison results under different query conditions, which helps to select a more accurate query method.
[0095] In order to enable those skilled in the art to better understand the above steps, the embodiment of the present application is illustrated below by using an example, but it should be understood that the embodiment of the present application is not limited to this.
[0096] like Figure 3 As shown, after entering the data query page, you can first use the search engine to query the target data under the default query conditions, for example, by default, use the search engine to find the latest target data within a specified time period. If the target data is found, it will be displayed on the page. If it is not found, the page will switch to database query. Since the query is performed on the database, you can be prompted to add more query conditions to narrow the query range and reduce database pressure. For example, it is set to query only the data of the day, and then the target data obtained by the query can be displayed on the page. After that, the user can perform business operations on the target data displayed on the page.
[0097] In this example, by supporting both database and search engine queries, the problem of slow data synchronization can be effectively solved. When the latest real-time data cannot be obtained through the search engine during query, the database is switched to query the latest real-time data for business processing, thus avoiding the problem of poor timeliness and improving user experience and business processing efficiency.
[0098] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can 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 to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0099] Based on the same inventive concept, the embodiment of the present application also provides a data query device for implementing the data query method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more data query device embodiments provided below can refer to the limitations on the data query method above, and will not be repeated here.
[0100] In an exemplary embodiment, Figure 4 As shown, a data query device is provided, comprising:
[0101] A page display module 401 is used to display a data query page; the data query page provides a first query mode and a second query mode at the same time, the first query mode includes searching in a database storing business data, and the second query mode includes searching in a data slice corresponding to the business data through a search engine;
[0102] A target query mode determination module 402 is configured to determine a target query mode from the first query mode and the second query mode according to a data query operation triggered on the data query page to request querying target data;
[0103] The data query module 403 is used to call the interface corresponding to the target query method to query the target data through the target query method.
[0104] In one embodiment, the target query mode determination module 402 is used to:
[0105] Acquire query conditions for the target data according to a data query operation triggered on the data query page to request querying the target data;
[0106] A recommended query method matching the query condition is determined from the first query method and the second query method, and a target query method is determined based on the recommended query method.
[0107] In one embodiment, the target query mode determination module 402 is used to:
[0108] If the query condition is a time search range corresponding to the target data, obtaining the update frequency of the data slices related to the target data in the search engine;
[0109] In a case where it is determined according to the update frequency that the data slices related to the target data within the time search range are not updated, using the first query mode as a recommended query mode;
[0110] When it is determined according to the update frequency that the data slices related to the target data within the time search range have been updated, the second query mode is used as a recommended query mode.
[0111] In one embodiment, the calling of the interface corresponding to the target query method includes:
[0112] If the target query method is the first query method, displaying a query condition adding prompt, wherein the query condition adding prompt is used to prompt the user to add other query conditions except the time search range;
[0113] The newly added other query conditions are received, an interface call request including the time search range and the other query conditions is generated, and sent to an interface corresponding to the first query method.
[0114] In one embodiment, the target query mode determination module 402 is used to:
[0115] If the query condition includes multiple query conditions, predicting the query speed comparison results of the first query method and the second query method under the multiple query conditions;
[0116] According to the query speed comparison result, a recommended query method is determined from the first query method and the second query method.
[0117] In one embodiment, the target query mode determination module 402 is used to:
[0118] Calling a pre-trained query speed prediction model, inputting the multiple query conditions into the query speed prediction model, and obtaining a query speed comparison result between the first query mode and the second query mode;
[0119] The query speed prediction model is trained based on a sample query condition set and a query speed label, and the query speed label represents a query speed comparison result between the first query method and the second query method when performing data query based on multiple sample query conditions in the sample query condition set.
[0120] Each module in the above data query device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0121] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 5 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a data query method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0122] Those skilled in the art will understand that Figure 5The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0123] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0124] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0125] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0126] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0127] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0128] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0129] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A data query method, characterized in that: The method comprises: Displaying a data query page; the data query page provides a first query method and a second query method at the same time, the first query method includes searching in a database storing business data, and the second query method includes searching in a data slice corresponding to the business data through a search engine; According to a data query operation triggered on the data query page to request querying target data, determining a target query method from the first query method and the second query method; The interface corresponding to the target query method is called to query the target data through the target query method.
2. The method according to claim 1, characterized in that The step of determining a target query method from the first query method and the second query method according to triggering a data query operation requesting querying target data on the data query page includes: Acquire query conditions for the target data according to a data query operation triggered on the data query page to request querying the target data; A recommended query method matching the query condition is determined from the first query method and the second query method, and a target query method is determined based on the recommended query method.
3. The method according to claim 2, characterized in that The determining a recommended query method matching the query condition from the first query method and the second query method includes: If the query condition is a time search range corresponding to the target data, obtaining the update frequency of the data slices related to the target data in the search engine; In a case where it is determined according to the update frequency that the data slices related to the target data within the time search range are not updated, using the first query mode as a recommended query mode; When it is determined according to the update frequency that the data slices related to the target data within the time search range have been updated, the second query mode is used as a recommended query mode.
4. The method according to claim 3, characterized in that The calling of the interface corresponding to the target query method includes: If the target query method is the first query method, displaying a query condition adding prompt, wherein the query condition adding prompt is used to prompt the user to add other query conditions except the time search range; The newly added other query conditions are received, an interface call request including the time search range and the other query conditions is generated, and sent to an interface corresponding to the first query method.
5. The method according to claim 2, characterized in that: The determining a recommended query method matching the query condition from the first query method and the second query method includes: If the query condition includes multiple query conditions, predicting the query speed comparison results of the first query method and the second query method under the multiple query conditions; According to the query speed comparison result, a recommended query method is determined from the first query method and the second query method.
6. The method according to claim 5, characterized in that The predicting of the query speed comparison result between the first query mode and the second query mode under the multiple query conditions includes: Calling a pre-trained query speed prediction model, inputting the multiple query conditions into the query speed prediction model, and obtaining a query speed comparison result between the first query method and the second query method; The query speed prediction model is trained based on a sample query condition set and a query speed label, and the query speed label represents a query speed comparison result between the first query method and the second query method when performing data query based on multiple sample query conditions in the sample query condition set.
7. A data query device, characterized in that: The device comprises: A page display module, used to display a data query page; the data query page provides a first query mode and a second query mode at the same time, the first query mode includes searching in a database storing business data, and the second query mode includes searching in a data slice corresponding to the business data through a search engine; A target query mode determination module, configured to determine a target query mode from the first query mode and the second query mode according to a data query operation triggered on the data query page to request querying target data; The data query module is used to call the interface corresponding to the target query method to query the target data through the target query method.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Method for creating information search based on data in database
CN104199977A
Mass data quick query method based on polymorphic composition
CN110489445A
Real-time object storage query system based on search engine and relational database
CN116204556A
Knowledge base web end management system and method based on knowledge graph
CN118410157A
Method for finding semantically related search engine queries
US20060248068A1