A data processing method and device
Patent Information
- Application Number
- CN201910888370.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-19
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2039-09-19
AI Technical Summary
[0005]本申请所要解决的技术问题是传统技术中用户利用ES进行查询十分不便、以及用户利用ES进行数据查询的效率比较低的问题,提供一种数据处理方法及装置
[0056]The embodiment of the present application provides a data processing method. When the user needs to use ES for query, if the user does not understand the ES query syntax, the user can select the quick query mode to query. If the user selects the quick query mode, the user can directly enter the corresponding query value on the terminal device without entering a query statement that conforms to ES query syntax. If the user selects the quick query mode, the terminal device can send a query mode determination message to the server, and the server can determine the corresponding query field according to the received query mode determination message, and determine the target text input by the user on the terminal device as The query value corresponding to the query field, and then, the server generates a standard query statement that conforms to the elastic search query syntax based on the determined query field and the query value corresponding to the query field, and completes the data based on the generated standard query statement Query. It can be seen that in the embodiment of the present application, even if the user does not understand the ES query syntax, he can still use ES to complete the data query. For users who understand the ES query syntax, the user can also directly enter the corresponding query statement for query. It is understandable that if the user does not select the quick query mode, the server will not receive the corresponding query mode confirmation message. For this case, the server can obtain the target text input by the user on the terminal device and match the target text with the standard query statement in the grammar library. If there is no standard query statement matching the target text in the grammar library, that is, the matching is unsuccessful, it means that there is a grammatical error in the target text input by the user. For this situation, in this embodiment of the present application, the server may send an error prompt message to the terminal device, so that the terminal device displays the error prompt message. In this way, the user can determine that the input target text contains grammatical errors through the error message displayed on the terminal device. The user can further modify the target text to obtain a query statement without grammatical errors, thereby completing the data query. It can be seen that with the solution provided by the embodiments of the present application, if there is an error in the target text input by the user, the terminal will display the corresponding error message, instead of as in the traditional technology, the user only needs to read the target text with grammatical errors. It is only after it is executed that it is known that the target text contains grammatical errors. This solution can save the user's waiting time before knowing that there is an error in the target text, that is, it can save the time for the target text to be executed, thereby improving query efficiency.
Smart Images

Figure CN112527976B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a data processing method and device. Background Art
[0002] With the development of science and technology, many data are currently stored in databases. If users want to view corresponding data, they can query the data from the database.
[0003] Elasticsearch (ES) is a full-text search search engine library that provides a full-text search search engine. ES has its own query syntax. When using ES for data query, you need to write query statements based on the query syntax supported by ES to achieve the purpose of data query.
[0004] On the one hand, when using ES for data query, it is necessary to write query statements based on the query syntax supported by ES, and many users are not very familiar with the query syntax of ES, which makes it very inconvenient for users to use ES for query. In addition, the query syntax of ES is relatively complex. Even users who understand the query syntax of ES will inevitably make mistakes when writing query statements. At present, when users use ES for data query, if there is a grammatical error in the query statement entered by the user, the user needs to wait until the query statement is executed before the user knows. It takes a certain amount of time for the query statement to be executed, which leads to the low efficiency of using ES query in traditional technology. Summary of the invention
[0005] The technical problem to be solved by the present application is that it is very inconvenient for users to use ES to query in traditional technologies, and the efficiency of users using ES to query data is relatively low, and a data processing method and device are provided.
[0006] In a first aspect, an embodiment of the present application provides a data processing method, the method comprising:
[0007] Get the target text entered by the user on the terminal device;
[0008] If the query mode determination message sent by the terminal device is not received before the target text is obtained, then:
[0009] Matching the target text with a standard query statement in a grammar library;
[0010] If there is no standard query sentence matching the target text in the grammar library, sending an error prompt message to the terminal device so that the terminal device displays the error prompt message;
[0011] If a query mode determination message sent by the terminal device is received before the target text is acquired, then:
[0012] Determine a message according to the query mode, determine a corresponding query field, and determine the target text as a query value corresponding to the query field;
[0013] A standard query statement conforming to elastic search query syntax is generated according to the determined query field and the query value corresponding to the query field, and data query is completed based on the generated standard query statement.
[0014] Optionally, the grammar library does not contain a standard query statement matching the target text, including:
[0015] There is no standard query sentence including the target text in the grammar library.
[0016] Optionally, the method further includes:
[0017] Searching the grammar library for a standard query sentence whose matching degree with the target text meets a preset condition;
[0018] The standard query statement whose character matching degree meets the preset condition is sent to the terminal device, so that the terminal device displays the standard query statement whose character matching degree meets the preset condition.
[0019] Optionally, if there is a standard query sentence matching the target text in the grammar library, and the standard query sentence matching the target text is different from the target text, the method further includes:
[0020] Determine a standard query sentence matching the target text and a difference sentence of the target text;
[0021] The difference statement is sent to the terminal device so that the terminal device displays the difference statement.
[0022] Optionally, the method further includes:
[0023] Receive a data export request sent by a terminal device, wherein the data export request carries a correspondence between a first field and a name corresponding to the first field; the first field is any field in a first query statement; and the first query statement is a standard query statement existing in the grammar library;
[0024] Writing the name corresponding to the first field and the value of the first field in the data obtained by querying the first query statement into a file in a preset format;
[0025] The file in the preset format is sent to the terminal device.
[0026] Optionally, writing the name corresponding to the first field and the value of the first field in the data obtained by the query into a file in a preset format includes:
[0027] The name corresponding to the first field and the value of the first field in the data obtained by the query are written into the target domain in the Excel file.
[0028] Optionally, the target domain in the Excel file includes:
[0029] A blank row of the Excel file; or a blank column of the Excel file.
[0030] In a second aspect, an embodiment of the present application provides a data processing device, the device comprising:
[0031] An acquisition unit, used to acquire a target text input by a user on a terminal device;
[0032] A matching unit, configured to match the target text with a standard query statement in a grammar library if a query mode determination message sent by the terminal device is not received before acquiring the target text;
[0033] A first sending unit, configured to send an error prompt message to the terminal device if there is no standard query sentence matching the target text in the grammar library, so that the terminal device displays the error prompt message;
[0034] A first determination unit is configured to determine a corresponding query field according to the query mode determination message if a query mode determination message is received from the terminal device before the target text is acquired, and determine the target text as a query value corresponding to the query field;
[0035] A statement generating unit, configured to generate a standard query statement conforming to elastic search query syntax according to the determined query field and the query value corresponding to the query field;
[0036] The first query unit is used to complete data query based on the generated standard query statement.
[0037] Optionally, the grammar library does not contain a standard query statement matching the target text, including:
[0038] There is no standard query sentence including the target text in the grammar library.
[0039] Optionally, the device further comprises:
[0040] A second query unit, configured to query the grammar library for a standard query sentence whose matching degree with the target text meets a preset condition;
[0041] The second sending unit is used to send the standard query statement whose character matching degree meets the preset conditions to the terminal device, so that the terminal device displays the standard query statement whose character matching degree meets the preset conditions.
[0042] Optionally, the device further comprises:
[0043] A second determining unit is configured to determine a difference sentence between the standard query sentence matching the target text and the target text if there is a standard query sentence matching the target text in the grammar library and the standard query sentence matching the target text is different from the target text;
[0044] The third sending unit is used to send the difference statement to the terminal device, so that the terminal device displays the difference statement.
[0045] Optionally, the device further comprises:
[0046] A receiving unit, configured to receive a data export request sent by a terminal device, wherein the data export request carries a correspondence between a first field and a name corresponding to the first field; the first field is any field in a first query statement; and the first query statement is a standard query statement existing in the grammar library;
[0047] A file generating unit, configured to write a name corresponding to the first field and a value of the first field in the data obtained by querying the first query statement into a file in a preset format;
[0048] The fourth sending unit is used to send the file in the preset format to the terminal device.
[0049] Optional, file generation unit, specifically used for:
[0050] The name corresponding to the first field and the value of the first field in the data obtained by the query are written into the target domain in the Excel file.
[0051] Optionally, the target domain in the Excel file includes:
[0052] A blank row of the Excel file; or a blank column of the Excel file.
[0053] In a third aspect, an embodiment of the present application provides a storage medium, wherein the storage medium includes a stored program, wherein the program executes the data processing method described in any one of the first aspects above.
[0054] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; and the processor is used to call program instructions in the memory to execute the data processing method described in any one of the first aspects above.
[0055] Compared with the prior art, the embodiments of the present application have the following advantages:
[0056] The embodiment of the present application provides a data processing method. When a user needs to use ES to query, if the user does not understand the ES query syntax, the user can select the quick query mode to query. If the user selects the quick query mode, the user can directly enter the corresponding query value on the terminal device without entering the query statement that conforms to the ES query syntax. If the user selects the quick query mode, the terminal device can send a query mode determination message to the server, and the server can determine the corresponding query field according to the received query mode determination message, and determine the target text entered by the user on the terminal device as the query value corresponding to the query field, and then, the server generates a standard query statement that conforms to the elastic search query syntax according to the determined query field and the query value corresponding to the query field, and completes the data query based on the generated standard query statement. It can be seen that in the embodiment of the present application, even if the user does not understand the ES query syntax, the data query can be completed using ES. For users who understand the ES query syntax, the user can also directly enter the corresponding query statement for query. It can be understood that if the user does not select the quick query mode, the server will not receive the corresponding query mode determination message. In this case, the server can obtain the target text entered by the user on the terminal device and match the target text with the standard query statement in the grammar library. If there is no standard query statement that matches the target text in the grammar library, that is, the match is unsuccessful, it means that the target text input by the user has a grammatical error. For this situation, in an embodiment of the present application, the server can send an error prompt message to the terminal device so that the terminal device displays the error prompt message. In this way, the user can determine that the input target text has a grammatical error through the error prompt message displayed by the terminal device, and the user can further modify the target text to obtain a query statement without grammatical errors, thereby completing data query. It can be seen that, using the solution provided by the embodiment of the present application, if the target text input by the user has an error, the terminal will display the corresponding error prompt message, rather than as in the traditional technology, the user only knows that the target text has a grammatical error after the target text with grammatical errors is executed. Using this solution, the waiting time before the user knows that the target text has an error can be saved, that is, the time when the target text is executed is saved, thereby improving the query efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0058] Figure 1 A flowchart of a data processing method provided in an embodiment of the present application;
[0059] Figure 2 A flowchart of a method for providing error correction candidates to a user provided in an embodiment of the present application;
[0060] Figure 3 A flowchart of a method for providing input prompts to a user provided in an embodiment of the present application;
[0061] Figure 4 A flowchart of a data export method provided in an embodiment of the present application;
[0062] Figure 5 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application;
[0063] Figure 6 A schematic diagram of the structure of a device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0064] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0065] The inventor of the present application has found through research that in the traditional technology, on the one hand, when using ES for data query, it is necessary to write query statements based on the query syntax supported by ES, and many users are not very familiar with the query syntax of ES, which makes it very inconvenient for users to use ES for query. In addition, when users use ES for data query, if there is a grammatical error in the query statement entered by the user, the user will not know until the query statement is executed. It takes a certain amount of time for the query statement to be executed, which leads to relatively low query efficiency. It is understandable that it is precisely because the user cannot find out that there are errors in the query statement entered in time. This means that the user may need to modify the query statement multiple times, and after the query statements corresponding to the multiple modifications are executed, they can query and obtain the corresponding data, and the query efficiency is low.
[0066] In order to solve the above problems, a data processing method is provided in an embodiment of the present application, which can avoid the above problems, so that users who do not understand the ES query syntax can also use ES to query, and can also effectively improve the query efficiency.
[0067] Various non-limiting implementations of the present application are described in detail below in conjunction with the accompanying drawings.
[0068] Exemplary Methods
[0069] See also Figure 1 , which is a flow chart of a data processing method provided in an embodiment of the present application.
[0070] The data processing method provided in the embodiment of the present application can be executed by a server. The embodiment of the present application does not specifically limit the server. The server can be a dedicated server for executing the data processing method provided in the embodiment of the present application, or a general server with other data processing functions. The embodiment of the present application does not specifically limit the server.
[0071] The data processing method provided in the embodiment of the present application can be implemented, for example, through the following steps S101-S103a or S101-S103b.
[0072] S101: Acquire a target text input by a user on a terminal device.
[0073] The terminal device mentioned in the embodiments of the present application may be a mobile terminal such as a smart phone or a tablet computer, or may be a terminal device such as a desktop computer, and the embodiments of the present application do not make any specific limitations.
[0074] In the embodiment of the present application, when the user needs to use ES to query, if the user does not understand the ES query syntax, the user can select the quick query mode to query. If the user selects the quick query mode, the user can directly enter the corresponding query value on the terminal device without entering the query statement that conforms to the ES query syntax. Of course, for users who understand the ES query syntax, the user can also choose to directly enter the corresponding query statement without selecting the quick query mode.
[0075] In an embodiment of the present application, if the user triggers a quick query mode determination operation on a terminal device, the terminal device generates a corresponding query mode determination message and sends the query mode determination message to the server. After the server receives the query mode determination message, it starts the processing logic corresponding to the quick query mode, i.e., S102b-S103b mentioned below. If the user does not trigger the corresponding quick query mode determination operation on the terminal device, the corresponding server will not receive the query mode determination message sent by the terminal device. In this case, the server starts the processing logic corresponding to the normal query, i.e., S102a-S103a mentioned below.
[0076] It should be noted that the embodiments of the present application do not specifically limit the specific implementation method of the user triggering the quick query mode determination operation. As an example, the user triggers the corresponding query mode determination operation by, for example, clicking the query mode button displayed on the terminal device.
[0077] The embodiment of the present application does not specifically limit the query mode determination message, and the query mode determination message may carry a corresponding query field, which may be determined by the aforementioned quick query mode determination operation. For example, if the user clicks the "Query by Name" button on the terminal device, the query mode determination message carries the query field "name"; for another example, if the user clicks the "Query by Time" button on the terminal device, the query mode determination message carries the query field "time", and so on.
[0078] In an embodiment of the present application, if the user does not trigger the quick query mode determination operation on the terminal device, the target text may be the query statement entered by the user when querying using ES. The target text may be a complete query statement or an incomplete query statement, such as a part of a complete query statement, which is not specifically limited in the embodiment of the present application. If the user triggers the quick query mode determination operation on the terminal device, the target text may be the value of the query field entered by the user.
[0079] In an embodiment of the present application, the target text may be a target text input by a user on a web page displayed on a terminal device. Specifically, the web page may be a web page supporting ES query. The user may enter a corresponding URL on a certain page displayed on the terminal device to enter a web page supporting ES query, and further, the user may enter the target text on the web page supporting ES query.
[0080] The embodiment of the present application does not specifically limit the specific implementation method of the server obtaining the target text input by the user on the terminal device. As an example, considering that when the user uses the terminal device to input the target text, it is generally necessary to call the input method system installed on the terminal device. Therefore, in the embodiment of the present application, the terminal device can obtain the target text input by the user on the terminal device through the input method system, and send the target text to the server.
[0081] S102a: Match the target text with a standard query statement in a grammar library.
[0082] S103a: If there is no standard query sentence matching the target text in the grammar library, an error prompt message is sent to the terminal device, so that the terminal device displays the error prompt message.
[0083] In an embodiment of the present application, the server may store a grammar library of ES, in which a standard query statement of a grammar format supported by ES is stored. It is understandable that only when the target text input by the user conforms to the grammar format supported by ES, the target text can be executed normally and the data conforming to the target text can be queried. If the target text input by the user conforms to the grammar format supported by ES, it can be indicated that the standard query statement matching the target text exists in the grammar library. Therefore, in an embodiment of the present application, after the server obtains the target text, the target text can be matched with the standard query statement in the grammar library. If the match is successful, that is, there is a standard query statement matching the target text in the grammar library, it means that the target text conforms to the grammar format supported by ES. If the match is unsuccessful, that is, there is no standard query statement matching the target text in the grammar library, it can be indicated to a certain extent that the target text has certain grammatical errors. For this case, in an embodiment of the present application, the server can send an error prompt message to the terminal device. After the terminal device receives the prompt message, the error prompt message can be displayed. In this way, the user can determine that there is an error in the input target text through the error prompt message. Furthermore, the user may also modify the target text to obtain a query statement without grammatical errors, thereby completing the data query.
[0084] It should be noted that in one implementation of the embodiment of the present application, there is a standard query statement matching the target text in the grammar library, for example, there may be a standard query statement including the target text in the grammar library. In other words, when there is a standard query statement matching the target text in the grammar library, the target text may be the same as the corresponding standard query statement, or may be a part of the standard query statement. Because as mentioned above, the target text may be a complete query statement, or an incomplete query statement, for example, a part of a complete query statement. When the target text is a complete query statement, there is a standard query statement matching the target text in the grammar library, which can be understood as the target text being the same as the corresponding standard query statement. When the target text is a part of a complete query statement, there is a standard query statement matching the target text in the grammar library, which can be understood as the target text being a part of the corresponding standard query statement.
[0085] Similarly, the grammar library does not contain a standard query statement that matches the target text, for example, the grammar library does not contain a standard query statement that includes the target text. Specifically, when the target text is a complete query statement, the grammar library does not contain a standard query statement that matches the target text, which can be understood as the target text and the corresponding standard query statement are different. When the target text is a part of a complete query statement, the grammar library does not contain a standard query statement that matches the target text, which can be understood as a part of the corresponding standard query statement is different from the target text.
[0086] From the above description, it can be seen that, using the data processing method provided by the embodiment of the present application, if the target text input by the user has an error, the terminal will display a corresponding error prompt message, instead of the user knowing that the target text has a grammatical error only after the target text with a grammatical error is executed as in the traditional technology. Using this solution, the waiting time before the user knows that the target text has an error, that is, the time when the target text is executed, can be saved, thereby improving the query efficiency.
[0087] Moreover, by using the solution provided by the embodiment of the present application, the user does not need to know that the query statement has an error after the query statement is executed, so there is no problem of low query efficiency in the traditional technology that the query statement needs to be modified multiple times and the corresponding query statements of the multiple modifications are executed before the corresponding data can be queried. Because once the query statement input by the user (for example, the query statement after the user modifies the target text) has a grammatical error, the terminal device can display the corresponding error prompt information, and the user can further modify the currently input query statement with grammatical errors based on the error prompt information.
[0088] S102b: Determine a message according to the query mode, determine a corresponding query field, and determine the target text as a query value corresponding to the query field.
[0089] As mentioned above, the query mode determination message carries a query field. Therefore, after the server receives the mode query determination message, it can parse the query mode message to obtain the query field. In addition, it can be understood that in actual applications, after the user determines the query mode, basically the text entered is the value corresponding to the query field, so as to query based on the value. Therefore, in an embodiment of the present application, the server can determine the acquired target text as the query value corresponding to the query field.
[0090] S103b: Generate a standard query statement that complies with the elastic search query syntax according to the determined query field and the query value corresponding to the query field, and complete the data query based on the generated standard query statement.
[0091] After the server determines the query field and the query value corresponding to the query field, it can query the ES query statement corresponding to the query field, and assemble the queried ES query statement with the target text (i.e., the query value corresponding to the query field) to obtain a standard query statement that conforms to the ES query syntax. Further, the server can complete the data query based on the generated standard query statement.
[0092] It can be seen that in the embodiments of the present application, even if the user does not understand the ES query syntax, ES can be used to complete data query.
[0093] Considering that in actual applications, if the target text is an ES query statement input by a user, when the target text has a grammatical error, the user generally modifies the target text to obtain a query statement without grammatical errors, thereby completing the data query. In an embodiment of the present application, in order to further improve the query efficiency, error correction candidates can also be provided to the user on the premise that the target text has a grammatical error, so that the user can modify the target text based on the error correction candidate to obtain a query statement without grammatical errors.
[0094] The following combination Figure 2 The present invention provides a method for providing error correction options to a user. Figure 2 , which is a flow chart of a method for providing error correction candidates to a user provided in an embodiment of the present application. Figure 2 The method shown can be implemented, for example, through the following steps S201-S202.
[0095] S201: Searching for a standard query sentence from the grammar library, the degree of which matches the target text meets a preset condition.
[0096] In an embodiment of the present application, the standard query statement whose degree of matching with the target text meets the preset conditions can be considered as the query statement that the user actually wants to input. Considering that in actual applications, even if the target text has grammatical errors, the possibility that all characters have errors is not very large, while the possibility that some characters in the target text have errors is relatively high. Therefore, in an implementation method of an embodiment of the present application, the standard query statement whose degree of matching with the target text obtained by querying from the grammar library meets the preset conditions, for example, can be a standard query statement whose degree of matching with the target text is greater than or equal to a preset threshold. Regarding the value of the preset threshold, it can be determined according to actual conditions, and the embodiment of the present application does not make specific restrictions.
[0097] It is understandable that the higher the matching degree is, the greater the possibility that the query statement that the user actually wants to input is the standard query statement. Therefore, in another implementation of the embodiment of the present application, the standard query statement whose matching degree with the target text obtained from the grammar library meets the preset conditions can be, for example, the standard query statement whose matching degree with the target text obtained from the grammar library is the highest.
[0098] It should be noted that the matching degree between the target text and the standard query statement may be, for example, the character matching degree between the target text and the standard query statement.
[0099] S202: Sending the standard query statement whose character matching degree meets the preset condition to the terminal device, so that the terminal device displays the standard query statement whose character matching degree meets the preset condition.
[0100] As described in S201, the standard query statement in the grammar library whose degree of matching with the target text meets the preset conditions can be considered to be the query statement that the user actually wants to input to a certain extent. Therefore, in an embodiment of the present application, the standard query statement whose degree of character matching meets the preset conditions can be sent to the terminal device. After the terminal device receives the standard query statement whose degree of character matching meets the preset conditions, it can display the standard query statement whose degree of character matching meets the preset conditions. The user can modify the target text based on the standard query statement whose degree of character matching meets the preset conditions displayed by the terminal device, thereby quickly modifying the query statement to obtain a query statement without grammatical errors, further improving the query efficiency.
[0101] It is understandable that when the standard query statement whose matching degree with the target text obtained from the grammar library meets the preset conditions, and is a standard query statement whose matching degree with the target text is greater than or equal to the preset threshold, there may be multiple standard query statements obtained by the query. In this case, the server can send all the multiple standard query statements to the terminal device, and accordingly, the terminal device can display the multiple standard query statements, and the user determines which standard query statement is specifically based on which to modify the target text. Of course, the server can also send some of the multiple standard query statements to the terminal device, and the embodiment of the present application does not make specific restrictions. For example, the server can sort the multiple standard query statements in the order from large to small according to the matching degree, and send the preset number of standard query statements with the top sorting to the terminal device, and the terminal device displays that the preset number of standard query statements has been received. The embodiment of the present application does not specifically limit the specific value of the preset number, and the specific value of the preset number can be determined according to actual conditions.
[0102] In the embodiment of the present application, in order to reduce the possibility of grammatical errors in the query statement input by the user and further improve the query efficiency, in the embodiment of the present application, an input prompt can be provided to the user during the process of the user inputting the query statement on the terminal device. That is, after the user enters part of the query statement, the user can be prompted with the next character that can be entered.
[0103] The following combination Figure 3 The method for providing input prompts to users provided by the embodiment of the present application is introduced. Specifically, when the aforementioned target text is an incomplete query sentence input by the user and there is no grammatical error in the target text, the prompt can be executed. Figure 3 The method shown. Wherein, when "the aforementioned target text is an incomplete query statement input by the user, and the target text does not have a grammatical error", it can be understood that there is a standard query statement matching the target text in the grammar library, and the standard query statement matching the target text is different from the target text. Wherein, the standard query statement matching the target text is different from the target text, which can indicate that the target text is a part of the standard query statement matching the target text.
[0104] See also Figure 3 , which is a flow chart of a method for providing input prompts to users provided in an embodiment of the present application. Figure 3 The method shown can be implemented, for example, through the following steps S301-S302.
[0105] S301: Determine a standard query sentence matching the target text and a difference sentence of the target text.
[0106] It is understandable that the standard query statement that matches the target text can be considered as the complete input query statement that the user actually wants to enter. However, the current user has only entered a part of the "complete input query statement that the user actually wants to enter", that is, the user has only entered the target text. Therefore, in an embodiment of the present application, the difference statement between the standard query statement that matches the target text and the target text can be determined. It is understandable that the difference statement can be considered as the query statement that the user has not yet entered in the "complete input query statement that the user actually wants to enter".
[0107] S302: Send the difference statement to the terminal device, so that the terminal device displays the difference statement.
[0108] After the server determines the difference statement, it can send the difference statement to the terminal device. After the terminal device receives the difference statement, it can display the difference statement, and the user can determine the content to be input next based on the difference statement displayed by the terminal device. Since the difference statement is determined based on the standard query statement, the user determines the content to be input next based on the difference statement displayed by the terminal device, which can reduce the possibility of inputting content with grammatical errors in the subsequent input process, thereby improving the query efficiency.
[0109] In traditional technology, after querying using ES, since ES does not support the data export function, users can only manually record the query data, which leads to poor user experience. In order to improve the user experience, the data processing method provided in the embodiment of the present application can also have a data export function. Figure 4 , introduces the data export method provided in the embodiment of the present application.
[0110] See also Figure 4 , which is a flow chart of a data export method provided in an embodiment of the present application. Figure 4 The data export method shown can be implemented through the following steps S401-S403.
[0111] S401: Receive a data export request sent by a terminal device, where the data export request carries a correspondence between a first field and a name corresponding to the first field.
[0112] After the user inputs a query statement without grammatical errors on the terminal device, a query operation can be triggered to query and obtain the corresponding data. For the convenience of description, the "query statement without grammatical errors" is called the first query statement. It can be understood that the first query statement does not have grammatical errors, so the first query statement is a standard query statement existing in the grammar library.
[0113] In the embodiment of the present application, after the user completes the data query using the first query statement, a corresponding data export request can be triggered on the terminal device. After the user triggers the data export request on the terminal device, the terminal device can send the data export request to the server.
[0114] In an embodiment of the present application, the data export request may carry a correspondence between a first field and a name corresponding to the first field, and the server exports the value corresponding to the queried first field based on the correspondence.
[0115] In an embodiment of the present application, the correspondence between the first field and the name corresponding to the first field can be generated based on the export setting operation performed by the user on the terminal device, that is, the user can customize the data content to be exported. For example, after the user clicks the data export button on the terminal device, the terminal device pops up an export setting page, and the user enters the first field such as "age" and the name corresponding to the first field such as "age" on the export setting page. Based on the export setting operation performed by the user on the terminal device, the terminal device obtains the first field entered by the user and the name of the first field, and adds the correspondence between the first field and the name of the first field to the data export request.
[0116] It should be noted that the first field can be any field in the aforementioned first query statement, and the embodiment of the present application does not make specific limitations. The name of the first field can be customized by the user. Generally speaking, the name of the first field can be used to reflect the physical meaning of the first field. For example, if the first field is "age", the name of the first field can be "age". However, the name of the first field may not correspond to the physical meaning of the first field. For example, the user sets the name of the first field to a name that does not correspond to the physical meaning of the first field based on the original intention of data confidentiality. The embodiment of the present application does not make specific limitations.
[0117] S402: Write the name corresponding to the first field and the value of the first field in the data obtained by querying the first query statement into a file in a preset format.
[0118] After receiving the data export request, the server can extract the value of the first field from the data obtained by querying based on the first query statement, and then export the value of the first field. Since the user sets the name corresponding to the first field, the server can export the name corresponding to the first field and the value of the first field in the data obtained by the query, so that the user knows the meaning of the exported data.
[0119] In an embodiment of the present application, the name corresponding to the first field and the value of the first field in the data obtained by the query can be written into a file of a preset format. The embodiment of the present application does not specifically limit the preset file, considering that the interface of the excel file is more intuitive, easy to observe data, and also provides various data calculation functions. Therefore, in an implementation method of the embodiment of the present application, the file of the preset format can be an excel file. Correspondingly, in the specific implementation of S402, the name corresponding to the first field and the value of the first field in the data obtained by the query can be written into the target domain in the excel file. The embodiment of the present application does not specifically limit the target domain in the excel file, considering that in practice, users are accustomed to putting data of the same attribute in a row or a column in the excel file, so as to facilitate the corresponding calculation of the data of the same attribute. Therefore, in an implementation method of the embodiment of the present application, the target domain in the excel file can be a blank row of the excel file; or, a blank column of the excel file.
[0120] S403: Send the file in the preset format to the terminal device.
[0121] After writing the name corresponding to the first field and the value of the first field in the queried data into a file of a preset format, the server can send the file of the preset format to the terminal device, and the user can save the file of the preset format on the terminal device. Through the file of the preset format, the user can obtain the data that the user wants to save, and further, the user can analyze the data in the file of the preset format. It is not necessary for the user to manually record the queried data as in the traditional technology, which improves the user experience.
[0122] Exemplary Devices
[0123] Based on the data processing method provided in the above embodiment, the embodiment of the present application further provides a data processing device, which is described below in conjunction with the accompanying drawings.
[0124] See also Figure 5 , which is a structural schematic diagram of a data processing device provided in an embodiment of the present application.
[0125] Figure 5 The data processing device 500 shown, for example, may specifically include: an acquisition unit 501, a matching unit 502, a first sending unit 503, a first determining unit 504, a sentence generating unit 505 and a first query unit 506.
[0126] An acquisition unit 501 is used to acquire a target text input by a user on a terminal device;
[0127] A matching unit 502, configured to match the target text with a standard query statement in a grammar library if no query mode determination message sent by the terminal device is received before the target text is acquired;
[0128] A first sending unit 503 is configured to send an error prompt message to the terminal device if there is no standard query sentence matching the target text in the grammar library, so that the terminal device displays the error prompt message;
[0129] The first determination unit 504 is configured to determine a corresponding query field according to the query mode determination message if a query mode determination message is received from the terminal device before the target text is acquired, and determine the target text as a query value corresponding to the query field;
[0130] A statement generating unit 505, configured to generate a standard query statement conforming to elastic search query syntax according to the determined query field and the query value corresponding to the query field;
[0131] The first query unit 506 is used to complete data query based on the generated standard query statement.
[0132] Optionally, the grammar library does not contain a standard query statement matching the target text, including:
[0133] There is no standard query sentence including the target text in the grammar library.
[0134] Optionally, the device further comprises:
[0135] A second query unit, configured to query the grammar library for a standard query sentence whose matching degree with the target text meets a preset condition;
[0136] The second sending unit is used to send the standard query statement whose character matching degree meets the preset conditions to the terminal device, so that the terminal device displays the standard query statement whose character matching degree meets the preset conditions.
[0137] Optionally, the device further comprises:
[0138] A second determining unit is configured to determine a difference sentence between the standard query sentence matching the target text and the target text if there is a standard query sentence matching the target text in the grammar library and the standard query sentence matching the target text is different from the target text;
[0139] The third sending unit is used to send the difference statement to the terminal device, so that the terminal device displays the difference statement.
[0140] Optionally, the device further comprises:
[0141] A receiving unit, configured to receive a data export request sent by a terminal device, wherein the data export request carries a correspondence between a first field and a name corresponding to the first field; the first field is any field in a first query statement; and the first query statement is a standard query statement existing in the grammar library;
[0142] A file generating unit, configured to write a name corresponding to the first field and a value of the first field in the data obtained by querying the first query statement into a file in a preset format;
[0143] The fourth sending unit is used to send the file in the preset format to the terminal device.
[0144] Optional, file generation unit, specifically used for:
[0145] The name corresponding to the first field and the value of the first field in the data obtained by the query are written into the target domain in the Excel file.
[0146] Optionally, the target domain in the Excel file includes:
[0147] A blank row of the Excel file; or a blank column of the Excel file.
[0148] Since the device 500 is a device corresponding to the method provided in the above method embodiment, the specific implementation of each unit of the device 500 is based on the same concept as the above method embodiment. Therefore, for the specific implementation of each unit of the device 500, reference can be made to the description part of the above method embodiment, which will not be repeated here.
[0149] The data processing 500 device includes a processor and a memory. The above-mentioned acquisition unit 501, matching unit 502, first sending unit 503, first determination unit 504, statement generation unit 505 and first query unit 506 are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0150] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the data processing method provided in the embodiment of the present application is implemented by adjusting kernel parameters.
[0151] An embodiment of the present invention provides a storage medium on which a program is stored. When the program is executed by a processor, the data processing method provided by the above method embodiment is implemented.
[0152] An embodiment of the present invention provides a processor, which is used to run a program, wherein the program executes the data processing method provided by the above method embodiment when running.
[0153] An embodiment of the present invention provides an electronic device, which can be seen in Figure 6 , which is a schematic diagram of the structure of a device provided in an embodiment of the present application, Figure 6 The device 60 shown includes at least one processor 601, at least one memory 602 and a bus 603 connected to the processor 601; the processor 601 and the memory 602 communicate with each other through the bus 603; the processor 601 is used to call the program instructions in the memory 602 to execute the above data processing method. The device in this article can be a server, a PC, a PAD, a mobile phone, etc.
[0154] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing the following method steps:
[0155] Get the target text entered by the user on the terminal device;
[0156] If the query mode determination message sent by the terminal device is not received before the target text is obtained, then:
[0157] Matching the target text with a standard query statement in a grammar library;
[0158] If there is no standard query sentence matching the target text in the grammar library, sending an error prompt message to the terminal device so that the terminal device displays the error prompt message;
[0159] If a query mode determination message sent by the terminal device is received before the target text is acquired, then:
[0160] Determine a message according to the query mode, determine a corresponding query field, and determine the target text as a query value corresponding to the query field;
[0161] A standard query statement conforming to elastic search query syntax is generated according to the determined query field and the query value corresponding to the query field, and data query is completed based on the generated standard query statement.
[0162] Optionally, the grammar library does not contain a standard query statement matching the target text, including:
[0163] There is no standard query sentence including the target text in the grammar library.
[0164] Optionally, the method further includes:
[0165] Searching the grammar library for a standard query sentence whose matching degree with the target text meets a preset condition;
[0166] The standard query statement whose character matching degree meets the preset condition is sent to the terminal device, so that the terminal device displays the standard query statement whose character matching degree meets the preset condition.
[0167] Optionally, if there is a standard query sentence matching the target text in the grammar library, and the standard query sentence matching the target text is different from the target text, the method further includes:
[0168] Determine a standard query sentence matching the target text and a difference sentence of the target text;
[0169] The difference statement is sent to the terminal device so that the terminal device displays the difference statement.
[0170] Optionally, the method further includes:
[0171] Receive a data export request sent by a terminal device, wherein the data export request carries a correspondence between a first field and a name corresponding to the first field; the first field is any field in a first query statement; and the first query statement is a standard query statement existing in the grammar library;
[0172] Writing the name corresponding to the first field and the value of the first field in the data obtained by querying the first query statement into a file in a preset format;
[0173] The file in the preset format is sent to the terminal device.
[0174] Optionally, writing the name corresponding to the first field and the value of the first field in the data obtained by the query into a file in a preset format includes:
[0175] The name corresponding to the first field and the value of the first field in the data obtained by the query are written into the target domain in the Excel file.
[0176] Optionally, the target domain in the Excel file includes:
[0177] A blank row of the Excel file; or a blank column of the Excel file.
[0178] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0179] In a typical configuration, the device includes one or more processors (CPU), memory and bus. The device may also include input / output interface, network interface and the like.
[0180] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
[0181] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0182] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0183] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0184] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: Acquire a target text input by a user on a terminal device; the target text is a complete query statement, an incomplete query statement, or a query value corresponding to a query field; If the query mode determination message sent by the terminal device is not received before the target text is obtained, then: Matching the target text with a standard query statement in a grammar library; If the standard query sentence including the target text does not exist in the grammar library, an error prompt message is sent to the terminal device so that the terminal device displays the error prompt message; If a query mode determination message sent by the terminal device is received before the target text is acquired, then: Determine a message according to the query mode, determine a corresponding query field, and determine the target text as a query value corresponding to the query field; A standard query statement conforming to elastic search query syntax is generated according to the determined query field and the query value corresponding to the query field, and data query is completed based on the generated standard query statement.
2. The method according to claim 1, characterized in that: The method further comprises: Searching the grammar library for a standard query sentence whose matching degree with the target text meets a preset condition; A standard query statement whose character matching degree meets the preset condition is sent to the terminal device, so that the terminal device displays the standard query statement whose character matching degree meets the preset condition.
3. The method according to any one of claims 1 or 2, characterized in that: If there is a standard query sentence matching the target text in the grammar library, and the standard query sentence matching the target text is different from the target text, the method further includes: Determine a standard query sentence matching the target text and a difference sentence of the target text; The difference statement is sent to the terminal device so that the terminal device displays the difference statement.
4. The method according to any one of claims 1 or 2, characterized in that: The method further comprises: Receive a data export request sent by a terminal device, wherein the data export request carries a correspondence between a first field and a name corresponding to the first field; the first field is any field in a first query statement; and the first query statement is a standard query statement existing in the grammar library; Writing the name corresponding to the first field and the value of the first field in the data obtained by querying the first query statement into a file in a preset format; The file in the preset format is sent to the terminal device.
5. The method according to claim 4, characterized in that Writing the name corresponding to the first field and the value of the first field in the data obtained by the query into a file in a preset format includes: The name corresponding to the first field and the value of the first field in the data obtained by the query are written into the target domain in the Excel file.
6. The method according to claim 5, characterized in that The target fields in the Excel file include: A blank row of the Excel file; or a blank column of the Excel file.
7. A data processing device, characterized in that: The device comprises: An acquisition unit, used to acquire a target text input by a user on a terminal device; the target text is a complete query statement, an incomplete query statement or a query value corresponding to a query field; A matching unit, configured to match the target text with a standard query statement in a grammar library if a query mode determination message sent by the terminal device is not received before acquiring the target text; a first sending unit, configured to send an error prompt message to the terminal device if the standard query statement including the target text does not exist in the grammar library, so that the terminal device displays the error prompt message; A first determination unit is configured to determine a corresponding query field according to the query mode determination message if a query mode determination message is received from the terminal device before the target text is acquired, and determine the target text as a query value corresponding to the query field; A statement generating unit, configured to generate a standard query statement conforming to elastic search query syntax according to the determined query field and the query value corresponding to the query field; The first query unit is used to complete data query based on the generated standard query statement.
8. A storage medium, characterized in that: The storage medium includes a stored program, wherein the program executes the data processing method according to any one of claims 1 to 6.
9. An electronic device, comprising at least one processor, and at least one memory and bus connected to the processor; wherein: The processor and the memory communicate with each other via the bus; The processor is used to call the program instructions in the memory to execute the data processing method according to any one of claims 1-6.
Citation Information
Patent Citations
Data query method and device
CN106649630A
Data query method and device
CN106980619A