CN112527976A - Data processing method and device - Google Patents

Data processing method and device Download PDF

Info

Publication number
CN112527976A
CN112527976A CN201910888370.6A CN201910888370A CN112527976A CN 112527976 A CN112527976 A CN 112527976A CN 201910888370 A CN201910888370 A CN 201910888370A CN 112527976 A CN112527976 A CN 112527976A
Authority
CN
China
Prior art keywords
query
target text
field
standard
terminal equipment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910888370.6A
Other languages
Chinese (zh)
Inventor
胡亦武
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201910888370.6A priority Critical patent/CN112527976A/en
Publication of CN112527976A publication Critical patent/CN112527976A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation

Abstract

The application discloses a data processing method, which comprises the following steps: acquiring a target text input by a user on terminal equipment; if the query mode determination message sent by the terminal equipment is not received before the target text is obtained, matching the target text with the standard query statement in the grammar library; and if the standard query sentence matched with the target text does not exist in the grammar library, sending an error prompt message to the terminal equipment, so that the terminal equipment displays the error prompt message. If the query mode determining message sent by the terminal equipment is received before the target text is acquired, determining the corresponding query field according to the query mode determining message, and determining the target text as a query value corresponding to the query field; and generating a standard query statement which accords with the elastic search query grammar according to the determined query field and the query value corresponding to the query field, and finishing data query based on the generated standard query statement. The scheme can facilitate the user to query by utilizing the ES and improve the query efficiency.

Description

Data processing method and device
Technical Field
The present application relates to the field of data processing, and in particular, to a data processing method and apparatus.
Background
With the development of science and technology, many data are stored in a database at present, and if a user wants to view the corresponding data, the user can inquire the data from the database.
An Elastic Search (ES) is a search engine library for full-text search, which provides a search engine for full-text search. The ES has the query grammar belonging to the ES, and when the ES is used for carrying out data query, query sentences need to be written based on the query grammar supported by the ES, so that the purpose of data query is realized.
On one hand, when data query is performed by using the ES, a query statement needs to be written based on the query syntax supported by the ES, and many users do not have good knowledge about the query syntax of the ES, so that it is inconvenient for the users to perform query by using the ES. In addition, the query grammar of the ES is relatively complex, and even for a user who knows the query grammar of the ES, the user is inevitable to write a query sentence incorrectly. At present, when a user queries data by using ES, if a query statement input by the user has a syntax error, the user needs to wait until the query statement is executed before knowing. The query statement requires a certain amount of time to be executed, which results in a low efficiency of using the ES query in the conventional art.
Disclosure of Invention
The technical problems to be solved by the application are that in the conventional technology, a user is very inconvenient to query by using an ES (electronic storage system) and the efficiency of the user for querying data by using the ES is low, and a data processing method and a data processing device are provided.
In a first aspect, an embodiment of the present application provides a data processing method, where the method includes:
acquiring a target text input by a user on terminal equipment;
if the query mode determination message sent by the terminal equipment is not received before the target text is acquired, then:
matching the target text with standard query sentences in a grammar library;
if the standard query sentence matched with the target text does not exist in the grammar library, sending an error prompt message to the terminal equipment so that the terminal equipment displays the error prompt message;
if receiving a query mode determination message sent by the terminal device before acquiring the target text, then:
determining a message according to the query mode, determining a corresponding query field, and determining the target text as a query value corresponding to the query field;
and generating a standard query statement conforming to the elastic search query grammar according to the determined query field and the query value corresponding to the query field, and finishing data query based on the generated standard query statement.
Optionally, the standard query sentence matched with the target text does not exist in the grammar library, and the method includes:
no standard query statement including the target text exists in the grammar library.
Optionally, the method further includes:
inquiring standard inquiry sentences, the matching degree of which with the target text meets preset conditions, from the grammar library;
and sending the standard query sentence with the character matching degree meeting the preset condition to the terminal equipment, so that the terminal equipment displays the standard query sentence with the character matching degree meeting the preset condition.
Optionally, if a standard query statement matching the target text exists in the grammar library, and the standard query statement matching the target text is different from the target text, the method further includes:
determining a standard query sentence matched with the target text and a difference sentence of the target text;
and sending the difference sentence to the terminal equipment to enable the terminal equipment to display the difference sentence.
Optionally, the method further includes:
receiving a data export request sent by terminal equipment, wherein the data export request carries a corresponding relation between a first field and a name corresponding to the first field; the first field is any field in the first query statement; 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 based on the first query statement query into a file with a preset format;
and sending the file with the preset format to the terminal equipment.
Optionally, writing the name corresponding to the first field and the value of the first field in the queried data into a file in a preset format, including:
and writing the name corresponding to the first field and the value of the first field in the inquired data into a target domain in the excel file.
Optionally, the target domain in the excel file includes:
blank lines of the excel file; or blank columns of the excel file.
In a second aspect, an embodiment of the present application provides a data processing apparatus, where the apparatus includes:
the acquisition unit is used for acquiring a target text input by a user on the terminal equipment;
the matching unit is used for matching the target text with a standard query statement in a grammar library if the query mode determination message sent by the terminal equipment is not received before the target text is obtained;
a first sending unit, configured to send an error prompt message to the terminal device if a standard query sentence matched with the target text does not exist in the grammar library, so that the terminal device displays the error prompt message;
a first determining unit, configured to determine, if a query mode determination message sent by the terminal device is received before the target text is obtained, a corresponding query field according to the query mode determination message, and determine the target text as a query value corresponding to the query field;
the statement generating unit is used for generating a standard query statement which accords with the elastic search query grammar according to the determined query field and the query value corresponding to the query field;
and the first query unit is used for finishing data query based on the generated standard query statement.
Optionally, the standard query sentence matched with the target text does not exist in the grammar library, and the method includes:
no standard query statement including the target text exists in the grammar library.
Optionally, the apparatus further comprises:
the second query unit is used for querying a standard query statement, the matching degree of which with the target text meets a preset condition, from the grammar library;
and the second sending unit is used for sending the standard query statement with the character matching degree meeting the preset condition to the terminal equipment so that the terminal equipment displays the standard query statement with the character matching degree meeting the preset condition.
Optionally, the apparatus further comprises:
a second determining unit, configured to determine a standard query statement matched with the target text and a difference statement of the target text if the standard query statement matched with the target text exists in the grammar library and is different from the target text;
a third sending unit, configured to send the difference sentence to the terminal device, so that the terminal device displays the difference sentence.
Optionally, the apparatus further comprises:
a receiving unit, configured to 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; the first field is any field in the first query statement; the first query statement is a standard query statement existing in the grammar library;
the file generation unit is used for writing the name corresponding to the first field and the value of the first field in the data obtained by the query based on the first query statement into a file with a preset format;
and the fourth sending unit is used for sending the file with the preset format to the terminal equipment.
Optionally, the file generating unit is specifically configured to:
and writing the name corresponding to the first field and the value of the first field in the inquired data into a target domain in the excel file.
Optionally, the target domain in the excel file includes:
blank lines of the excel file; or blank columns of the excel file.
In a third aspect, an embodiment of the present application provides a storage medium, where the storage medium includes a stored program, where the program executes the data processing method according to any one of the above first aspects.
In a fourth aspect, an embodiment of the present application provides an electronic device, where the device includes at least one processor, and at least one memory and a bus connected to the processor; the processor and the memory complete mutual communication through the bus; the processor is configured to invoke program instructions in the memory to perform the data processing method of any of the above first aspects.
Compared with the prior art, the embodiment of the application has the following advantages:
the embodiment of the application provides a data processing method, when a user needs to query by using an ES, if the user does not know ES query grammar, the user can select a quick query mode to query. If the user selects the quick query mode, the user can directly input the corresponding query value on the terminal equipment without inputting a query statement conforming to the ES query grammar. If the user selects the quick query mode, the terminal device can send a query mode determination message to the server, the server can determine the message according to the received query mode, determine a corresponding query field, determine a target text input on the terminal device by the user as a query value corresponding to the query field, then the server generates a standard query statement conforming to the elastic search query grammar according to the determined query field and the query value corresponding to the query field, and completes data query based on the generated standard query statement. Therefore, in the embodiment of the application, the data query can be completed by using the ES even if the user does not know the ES query grammar. For a user who knows the ES query grammar, the user can also directly input a corresponding query statement for query, and it can be understood that if the user does not select the quick query mode, the server does not receive the corresponding query mode determination message. For this case, the server may obtain the target text input by the user on the terminal device, and match the target text with the standard query sentence in the grammar library. And if the standard query sentence matched with the target text does not exist in the grammar library, namely the matching is unsuccessful, the grammar library indicates that grammar errors exist 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. Therefore, the user can determine that the grammatical error exists in the input target text through the error prompt message displayed by the terminal equipment, and the user can further modify the target text to obtain the query sentence without the grammatical error, so that the data query is completed. Therefore, according to the scheme provided by the embodiment of the application, if the target text input by the user has an error, the terminal displays a corresponding error prompt message, instead of knowing that the target text has a grammatical error only after the target text with the grammatical error is executed, as in the conventional technology. By the aid of the method and the device, waiting time of the user before knowing that the target text has errors can be saved, namely time for executing the target text is saved, and accordingly query efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic flowchart of a data processing method according to an embodiment of the present application;
fig. 2 is a flowchart illustrating a method for providing error correction candidates for a user according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating a method for providing an input prompt to a user according to an embodiment of the present application;
fig. 4 is a schematic flowchart of a data export method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an apparatus according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The inventor of the present application has found, through research, that in the conventional technology, on one hand, when data query is performed by using an ES, a query statement needs to be written based on query syntax supported by the ES, and many users do not have a good understanding of the query syntax of the ES, so that it is very inconvenient for the users to perform query by using the ES. When a user queries data using ES, if there is a syntax error in a query expression input by the user, the user needs to wait until the query expression is executed before the user knows it. The query statement requires a certain time to be executed, which results in low query efficiency. It can be understood that the user can not find the input query statement in error in time. This results in that the user may need to modify the query statement multiple times and query the corresponding data after the query statements corresponding to the multiple modifications are all executed, which results in low query efficiency.
In order to solve the above problem, embodiments of the present application provide a data processing method, which can avoid the above problem, so that a user who does not know the ES query syntax can also query by using the ES, and query efficiency can also be effectively improved.
Various non-limiting embodiments of the present application are described in detail below with reference to the accompanying drawings.
Exemplary method
Referring to fig. 1, the figure is a schematic flow chart of a data processing method according to an embodiment of the present application.
The data processing method provided by the embodiment of the application can be executed by a server. The server is not specifically limited in the embodiment of the present application, and the server may be a dedicated server for executing the data processing method provided in the embodiment of the present application, or may also be a general server having other data processing functions, and the embodiment of the present application is not specifically limited.
The data processing method provided by the embodiment of the application can be realized through the following steps of S101-S103a or S101-S103b, for example.
S101: and acquiring a target text input by a user on the terminal equipment.
The terminal device mentioned in the embodiment of the present application may be a mobile terminal such as a smart phone and a tablet computer, or a terminal device such as a desktop computer, and the embodiment of the present application is not particularly limited.
In the embodiment of the application, when a user needs to query by using an ES, if the user does not know ES query grammar, the user can select a quick query mode to query. If the user selects the quick query mode, the user can directly input the corresponding query value on the terminal equipment without inputting a query statement conforming to the ES query grammar. Of course, for a user who knows the syntax of the ES query, the user can also select to directly input the corresponding query statement without selecting the shortcut query mode.
In the embodiment of the application, if the user triggers the shortcut query mode determination operation on the terminal device, the terminal device generates a corresponding query mode determination message and sends the query mode determination message to the server. After receiving the query mode determination message, the server activates processing logic corresponding to the shortcut query mode, i.e., S102b-S103b mentioned below. If the user does not trigger the corresponding shortcut query mode determination operation on the terminal device, the corresponding server will not receive the query mode determination message sent by the terminal device, and for this case, the server starts the processing logic corresponding to the general query, i.e. S102a-S103a mentioned below.
It should be noted that, in the embodiment of the present application, a specific implementation manner of triggering a shortcut query mode determination operation by a user is not specifically limited, and as an example, the user triggers a corresponding query mode determination operation by, for example, clicking a query mode button displayed on a terminal device.
The query mode determination message is not specifically limited in the embodiment of the present application, and the query mode determination message may carry a corresponding query field, for example, and the query field may be determined by the foregoing shortcut query mode determination operation. For example, if the user clicks a "query by name" button on the terminal device, the query mode determination message carries a query field "name"; for another example, if the user clicks a "query by time" button on the terminal device, the query mode determines that the query field "time" is carried in the message, and so on.
In the embodiment of the application, if the user does not trigger the shortcut query mode determination operation on the terminal device, the target text may be a query statement input by the user when the user queries by using the ES. The target text may be a complete query statement or an incomplete query statement, for example, a part of the complete query statement, and the embodiment of the present application is not particularly limited. If the user triggers the shortcut query mode determination operation on the terminal device, the target text may be a value of a query field input by the user.
In this embodiment, the target text may be a target text input by a user on a web page displayed on the terminal device. Specifically, the web page may be a web page supporting an ES query. The user can input a corresponding website on a certain page displayed on the terminal device, so as to enter the webpage supporting the ES query, and further, the user can input a target text on the webpage supporting the ES query.
The embodiment of the present application does not specifically limit a specific implementation manner in which the server obtains the target text input by the user on the terminal device, and as an example, when the user inputs the target text by using the terminal device, an input method system installed on the terminal device generally needs to be called. Therefore, in the embodiment of the application, the terminal device can acquire the target text input on the terminal device by the user through the input method system and send the target text to the server.
S102 a: and matching the target text with a standard query statement in a grammar library.
S103 a: and if the standard query sentence matched with the target text does not exist in the grammar library, sending an error prompt message to the terminal equipment so that the terminal equipment displays the error prompt message.
In the embodiment of the present application, the server may store a syntax library of the ES, and the syntax library stores standard query statements in syntax formats supported by the ES. It is understood that only when the target text input by the user conforms to the syntax format supported by the ES, the target text can be normally executed and data conforming to the target text can be searched. And if the target text input by the user conforms to the grammar format supported by the ES, the standard query sentence matched with the target text in the grammar library can be represented. Therefore, in the embodiment of the present application, after the server obtains the target text, the target text may be matched with the standard query statement in the grammar library, and if the matching is successful, that is, the standard query statement matched with the target text exists in the grammar library, it indicates that the target text conforms to the grammar format supported by the ES. If the matching is unsuccessful, that is, the grammar library does not have the standard query sentence matched with the target text, it may indicate that the target text has a certain grammar error to a certain extent, and for this situation, in this embodiment of the present application, the server may send an error prompt message to the terminal device. After receiving the prompting message, the terminal device may display the error prompting message. In this way, the user can determine that the input target text has an error through the error prompt message. Further, the user can modify the target text to obtain a query statement without grammar error, thereby completing data query.
It should be noted that, in an implementation manner of the embodiment of the present application, the standard query statement matching the target text exists in the grammar library, for example, the standard query statement including the target text exists in the grammar library, in other words, when the standard query statement matching the target text exists in the grammar library, the target text may be the same as the corresponding standard query statement, or may be a part of a standard tile 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 sentence, a standard query sentence matched with the target text exists in the grammar library, and the target text can be understood to be the same as the corresponding standard query sentence. When the target text is a part of a complete query statement, a standard query statement matching the target text exists in the grammar library, and the target text can be understood as a part of a corresponding standard query statement.
Similarly, the standard query sentence matching the target text does not exist in the grammar library, for example, the standard query sentence including the target text does not exist in the grammar library, and specifically, when the target text is a complete query sentence, the standard query sentence matching the target text does not exist in the grammar library, and it can be understood that the target text is different from the corresponding standard query sentence. When the target text is a part of a complete query sentence, a standard query sentence matched with the target text does not exist in the grammar library, and it can be understood that a part of the corresponding standard query sentence is different from the target text.
As can be seen from the above description, with the data processing method provided in the embodiment of the present application, if the target text input by the user has an error, the terminal may display a corresponding error prompt message, instead of knowing that the target text has a grammatical error only after the target text having the grammatical error is executed, as in the conventional technology. By the aid of the method and the device, waiting time of the user before knowing that the target text has errors, namely the time of executing the target text can be saved, and accordingly query efficiency is improved.
Moreover, with the adoption of the scheme provided by the embodiment of the application, a user does not need to know that the query statement has errors after the query statement is executed, so that the problems that the query statement needs to be modified for many times and corresponding data can be queried after the query statements corresponding to the modification for many times are all executed in the traditional technology, and the query efficiency is low are solved. Because once the query sentence input by the user (for example, the query sentence modified by the target text by the user) has a grammatical error, the terminal device can display corresponding error prompt information, and the user can further modify the currently input query sentence with the grammatical error based on the error prompt information.
S102 b: and determining a message according to the query mode, determining a corresponding query field, and determining the target text as a query value corresponding to the query field.
As described above, the query mode determination message carries a query field. Thus, after the server receives the mode query determination message, the query mode message may be parsed to obtain the query field. In addition, it can be understood that, in practical applications, after the user determines the query mode, basically all the input texts are the values corresponding to the query field, so as to perform the query based on the values. Therefore, in the embodiment of the present application, the server may determine the obtained target text as the query value corresponding to the query field.
S103 b: and generating a standard query statement conforming to the elastic search query grammar according to the determined query field and the query value corresponding to the query field, and finishing data query based on the generated standard query statement.
After determining the query field and the query value corresponding to the query field, the server may query the ES query statement corresponding to the query field, and assemble the queried ES query statement and the target text (i.e., the query value corresponding to the query field), thereby obtaining a standard query statement conforming to ES query syntax. Further, the server may complete the data query based on the generated standard query statement.
Therefore, in the embodiment of the application, the data query can be completed by using the ES even if the user does not know the ES query grammar.
In consideration of the fact that in practical application, if the target text is an ES query sentence input by a user, when the target text has a grammar error, the user generally modifies the target text to obtain a query sentence without the grammar error, thereby completing data query. In the embodiment of the application, in order to further improve the query efficiency, on the premise that the target text has a grammatical error, an error correction candidate item may be provided to the user, so that the user modifies the target text based on the error correction candidate item, and a query sentence without the grammatical error is obtained.
The following describes a method for providing error correction candidates for a user according to an embodiment of the present application with reference to fig. 2. Referring to fig. 2, the flowchart of a method for providing error correction candidates for a user according to an embodiment of the present application is schematically shown. The method shown in fig. 2 can be implemented, for example, by the following steps S201-S202.
S201: and querying a standard query statement with the matching degree with the target text meeting a preset condition from the grammar library.
In the embodiment of the present application, the standard query sentence with the matching degree with the target text meeting the preset condition may be regarded as the query sentence which the user actually wants to input. It is considered that in practical application, even if the target text has grammatical errors, the probability that all characters have errors is not very high, and the probability that some characters in the target text have errors is higher. Therefore, in an implementation manner of the embodiment of the present application, the standard query statement queried from the grammar library and having a matching degree with the target text that meets the preset condition may be, for example, the standard query statement having the matching degree with the target text that is greater than or equal to a preset threshold. The value of the preset threshold may be determined according to actual conditions, and the embodiment of the present application is not particularly limited.
It is understood that the higher the degree of matching, the greater the likelihood that the query sentence that the user actually wishes to input is the standard query sentence. Therefore, in another implementation manner of the embodiment of the present application, the standard query statement that is obtained by querying from the grammar library and has a matching degree with the target text that meets the preset condition may be, for example, the standard query statement that is obtained by querying from the grammar library and has a highest matching degree with the target text.
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.
S202: and sending the standard query sentence with the character matching degree meeting the preset condition to the terminal equipment, so that the terminal equipment displays the standard query sentence with the character matching degree meeting the preset condition.
As described in S201, the standard query sentence in the grammar library, which matches the target text to a predetermined degree, may be regarded as the query sentence that the user actually wishes to input to some extent. Therefore, in the embodiment of the present application, the standard query statement whose character matching degree meets the preset condition may be sent to the terminal device. After the terminal device receives the standard query statement with the character matching degree meeting the preset condition, the terminal device can display the standard query statement with the character matching degree meeting the preset condition. The user can modify the target text based on the standard query sentence with the character matching degree meeting the preset conditions displayed by the terminal equipment, so that the query sentence without grammar errors can be rapidly modified, and the query efficiency is further improved.
It is to be understood that when the standard query statement queried from the grammar library and having a matching degree with the target text that meets the preset condition is a standard query statement having a matching degree with the target text that is greater than or equal to a preset threshold, there may be a plurality of standard query statements queried. In this case, the server may send all the standard query sentences to the terminal device, and accordingly, the terminal device may display the standard query sentences, and the user may determine which standard query sentence is specifically based on which target text is modified. Of course, the server may also send some of the standard query statements in the plurality of standard query statements to the terminal device, which is not specifically limited in this embodiment of the application. For example, the server may sort the plurality of standard query statements according to a descending order of the matching degree, send a preset number of standard query statements that are sorted in front to the terminal device, and display that the preset number of standard query statements are received by the terminal device. The specific value of the preset number is not specifically limited in the embodiment of the application, and the specific value of the preset number can be determined according to the actual situation.
In the embodiment of the application, in order to reduce the possibility of grammar errors of the query sentence input by the user and further improve the query efficiency, in the embodiment of the application, an input prompt can be provided for the user in the process of inputting the query sentence on the terminal device by the user. I.e. after the user has entered a partial query statement, the user may be prompted for the next characters that may be entered.
The method for providing the input prompt for the user provided by the embodiment of the present application is described below with reference to fig. 3. Specifically, when the target text is an incomplete query sentence input by the user and there is no grammar error in the target text, the method shown in fig. 3 may be executed. When the target text is an incomplete query sentence input by a user and the target text has no grammar error, it can be understood that a standard query sentence matched with the target text exists in the grammar library, and the standard query sentence matched with the target text is different from the target text. The standard query sentence matched with the target text is different from the target text, and may indicate that the target text is a part of the standard query sentence matched with the target text.
Referring to fig. 3, the flowchart illustrates a method for providing an input prompt for a user according to an embodiment of the present application. The method shown in fig. 3 can be implemented, for example, by the following steps S301 to S302.
S301: and determining a standard query sentence matched with the target text and a difference sentence of the target text.
It will be appreciated that the standard query statement that matches the target text may be considered the complete input query statement that the user actually wishes to enter. While the current user has only entered a portion of the "complete input query sentence the user actually wishes to enter", i.e. the user has only entered the target text. Therefore, in the embodiment of the present application, the standard query sentence matched with the target text and the difference sentence of the target text can be determined. It is to be understood that the difference sentence may be regarded as a query sentence which has not been input by the user "a complete input query sentence which the user actually wishes to input".
S302: and sending the difference sentence to the terminal equipment to enable the terminal equipment to display the difference sentence.
After the server determines the difference sentence, the difference sentence may be transmitted to the terminal device. After the terminal device receives the difference sentence, the difference sentence can be displayed, and the user can determine the content needing to be input next based on the difference sentence displayed by the terminal device. Because the difference sentence is determined according to the standard query sentence, the user determines the content to be input next based on the difference sentence displayed by the terminal device, so that the possibility of inputting the content with grammar error in the subsequent input process can be reduced, and the query efficiency is improved.
In the conventional technology, after the ES is used for query, because the ES does not support a data export function, a user can only manually record the queried data, and the user experience is poor. In order to improve user experience, the data processing method provided by the embodiment of the application can further have a data export function. The data export method provided by the embodiment of the present application is described below with reference to fig. 4.
Referring to fig. 4, the figure is a schematic flowchart of a data export method according to an embodiment of the present application. The data derivation method shown in fig. 4 can be implemented by the following steps S401 to S403.
S401: receiving a data export request sent by a terminal device, wherein the data export request carries a corresponding relation between a first field and a name corresponding to the first field.
After a user inputs a query statement without grammar error on the terminal equipment, query operation can be triggered, so that corresponding data are obtained through query. For convenience of description, the "query sentence without syntax error" is referred to as a first query sentence. It will be appreciated that the first query statement is free of syntax errors and is thus a standard query statement present in the syntax repository.
In this embodiment of the application, after the user completes data query by using the first query statement, a corresponding data export request may be triggered on the terminal device. After the user triggers a data export request on the terminal device, the terminal device may send the data export request to the server.
In this embodiment of the application, the data export request may carry a correspondence between the first field and a name corresponding to the first field, and the server exports the queried value corresponding to the first field according to the correspondence.
In this embodiment of the present application, the corresponding relationship between the first field and the name corresponding to the first field may be generated based on an export setting operation performed by a user on a terminal device, that is, the user may customize data content to be exported. For example, after the user clicks a data export button on the terminal device, the terminal device pops up an export settings page on which the user enters a first field such as "age" and a name corresponding to the first field such as "age". The terminal equipment acquires the first field input by the user and the name of the first field based on the export setting operation executed by the user on the terminal equipment, and adds the corresponding relation between the first field and the name of the first field to the data export request.
It should be noted that the first field may be any one of the fields in the foregoing first query statement, and this embodiment of the application is not particularly limited. The name of the first field can be customized by a user, and generally speaking, the name of the first field can be used for embodying the physical meaning of the first field. For example, the first field is "age", and the name of the first field may 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 intention of data security. The embodiments of the present application are not particularly limited.
S402: and writing the name corresponding to the first field and the value of the first field in the data obtained based on the query of the first query statement into a file with a preset format.
After receiving the data export request, the server may extract a value of the first field from the data queried based on the first query statement, and then export the value of the first field. Since the name corresponding to the first field is set by the user, the server may export the name corresponding to the first field and the value corresponding to the first field in the queried data, so that the user knows the meaning of the exported data.
In this embodiment of the present application, the name corresponding to the first field and the value of the first field in the queried data may be written in a file in a preset format. The embodiment of the application does not specifically limit the preset file, considers that the interface of the excel file is visual, data are easy to observe, and various data calculation functions are provided. Therefore, in an implementation manner of the embodiment of the present application, the file in the preset format may 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 queried data may be written into the target domain in the excel file. In the embodiment of the application, the target domain in the excel file is not specifically limited, and it is considered that in practice, a user is used to place data with the same attribute in a certain row or a certain column in the excel file, so as to perform corresponding calculation on the data with the same attribute. Therefore, in an implementation manner of the embodiment of the present application, the target domain in the excel file may be a blank line of the excel file; or blank columns of the excel file.
S403: and sending the file with the preset format to the terminal equipment.
After writing the name corresponding to the first field and the value of the first field in the queried data into a file in a preset format, the server may send the file in the preset format to the terminal device, and the user may store the file in the preset format on the terminal device. And the data obtained by query do not need to be manually recorded by the user as in the traditional technology, so that the user experience is improved.
Exemplary device
Based on the data processing method provided by the above embodiment, the embodiment of the present application further provides a data processing apparatus, which is described below with reference to the accompanying drawings.
Referring to fig. 5, this figure is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application.
The data processing apparatus 500 shown in fig. 5 may specifically include, for example: 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 querying unit 506.
An obtaining unit 501, configured to obtain a target text input by a user on a terminal device;
a matching unit 502, 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 the target text is obtained;
a first sending unit 503, configured to send an error notification message to the terminal device if a standard query sentence matched with the target text does not exist in the grammar library, so that the terminal device displays the error notification message;
a first determining unit 504, configured to determine, if a query mode determination message sent by the terminal device is received before the target text is obtained, a corresponding query field according to the query mode determination message, and determine the target text as a query value corresponding to the query field;
a statement generating unit 505, configured to generate a standard query statement that conforms to the flexible search query syntax according to the determined query field and the query value corresponding to the query field;
a first query unit 506, configured to complete a data query based on the generated standard query statement.
Optionally, the standard query sentence matched with the target text does not exist in the grammar library, and the method includes:
no standard query statement including the target text exists in the grammar library.
Optionally, the apparatus further comprises:
the second query unit is used for querying a standard query statement, the matching degree of which with the target text meets a preset condition, from the grammar library;
and the second sending unit is used for sending the standard query statement with the character matching degree meeting the preset condition to the terminal equipment so that the terminal equipment displays the standard query statement with the character matching degree meeting the preset condition.
Optionally, the apparatus further comprises:
a second determining unit, configured to determine a standard query statement matched with the target text and a difference statement of the target text if the standard query statement matched with the target text exists in the grammar library and is different from the target text;
a third sending unit, configured to send the difference sentence to the terminal device, so that the terminal device displays the difference sentence.
Optionally, the apparatus further comprises:
a receiving unit, configured to 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; the first field is any field in the first query statement; the first query statement is a standard query statement existing in the grammar library;
the file generation unit is used for writing the name corresponding to the first field and the value of the first field in the data obtained by the query based on the first query statement into a file with a preset format;
and the fourth sending unit is used for sending the file with the preset format to the terminal equipment.
Optionally, the file generating unit is specifically configured to:
and writing the name corresponding to the first field and the value of the first field in the inquired data into a target domain in the excel file.
Optionally, the target domain in the excel file includes:
blank lines of the excel file; or blank columns of the excel file.
Since the apparatus 500 is an apparatus corresponding to the method provided in the above method embodiment, and the specific implementation of each unit of the apparatus 500 is the same as that of the above method embodiment, for the specific implementation of each unit of the apparatus 500, reference may be made to the description part of the above method embodiment, and details are not repeated here.
The data processing 500 apparatus includes a processor and a memory, the obtaining unit 501, the matching unit 502, the first sending unit 503, the first determining unit 504, the statement generating unit 505, the first querying unit 506, and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. One or more than one kernel can be set, and the data processing method provided by the embodiment of the application is realized by adjusting kernel parameters.
An embodiment of the present invention provides a storage medium, on which a program is stored, which, when executed by a processor, implements the data processing method provided by the above method embodiment.
The embodiment of the invention provides a processor, which is used for running a program, wherein the program executes the data processing method provided by the method embodiment when running.
An electronic device according to an embodiment of the present invention is provided, and referring to fig. 6, which is a schematic structural diagram of a device according to an embodiment of the present invention, a device 60 shown in fig. 6 includes at least one processor 601, at least one memory 602 connected to the processor 601, and a bus 603; the processor 601 and the memory 602 complete communication with each other through the bus 603; the processor 601 is used to call program instructions in the memory 602 to execute the above-mentioned data processing method. The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device:
acquiring a target text input by a user on terminal equipment;
if the query mode determination message sent by the terminal equipment is not received before the target text is acquired, then:
matching the target text with standard query sentences in a grammar library;
if the standard query sentence matched with the target text does not exist in the grammar library, sending an error prompt message to the terminal equipment so that the terminal equipment displays the error prompt message;
if receiving a query mode determination message sent by the terminal device before acquiring the target text, then:
determining a message according to the query mode, determining a corresponding query field, and determining the target text as a query value corresponding to the query field;
and generating a standard query statement conforming to the elastic search query grammar according to the determined query field and the query value corresponding to the query field, and finishing data query based on the generated standard query statement.
Optionally, the standard query sentence matched with the target text does not exist in the grammar library, and the method includes:
no standard query statement including the target text exists in the grammar library.
Optionally, the method further includes:
inquiring standard inquiry sentences, the matching degree of which with the target text meets preset conditions, from the grammar library;
and sending the standard query sentence with the character matching degree meeting the preset condition to the terminal equipment, so that the terminal equipment displays the standard query sentence with the character matching degree meeting the preset condition.
Optionally, if a standard query statement matching the target text exists in the grammar library, and the standard query statement matching the target text is different from the target text, the method further includes:
determining a standard query sentence matched with the target text and a difference sentence of the target text;
and sending the difference sentence to the terminal equipment to enable the terminal equipment to display the difference sentence.
Optionally, the method further includes:
receiving a data export request sent by terminal equipment, wherein the data export request carries a corresponding relation between a first field and a name corresponding to the first field; the first field is any field in the first query statement; 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 based on the first query statement query into a file with a preset format;
and sending the file with the preset format to the terminal equipment.
Optionally, writing the name corresponding to the first field and the value of the first field in the queried data into a file in a preset format, including:
and writing the name corresponding to the first field and the value of the first field in the inquired data into a target domain in the excel file.
Optionally, the target domain in the excel file includes:
blank lines of the excel file; or blank columns of the excel file.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a device includes one or more processors (CPUs), memory, and a bus. The device may also include input/output interfaces, network interfaces, and the like.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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 disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method of data processing, the method comprising:
acquiring a target text input by a user on terminal equipment;
if the query mode determination message sent by the terminal equipment is not received before the target text is acquired, then:
matching the target text with standard query sentences in a grammar library;
if the standard query sentence matched with the target text does not exist in the grammar library, sending an error prompt message to the terminal equipment so that the terminal equipment displays the error prompt message;
if receiving a query mode determination message sent by the terminal device before acquiring the target text, then:
determining a message according to the query mode, determining a corresponding query field, and determining the target text as a query value corresponding to the query field;
and generating a standard query statement conforming to the elastic search query grammar according to the determined query field and the query value corresponding to the query field, and finishing data query based on the generated standard query statement.
2. The method of claim 1, wherein the absence of a standard query statement in the grammar library that matches the target text comprises:
no standard query statement including the target text exists in the grammar library.
3. The method of claim 1, further comprising:
inquiring standard inquiry sentences, the matching degree of which with the target text meets preset conditions, from the grammar library;
and sending the standard query sentence with the character matching degree meeting the preset condition to the terminal equipment, so that the terminal equipment displays the standard query sentence with the character matching degree meeting the preset condition.
4. The method according to any one of claims 1-3, wherein 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 not the same as the target text, the method further comprises:
determining a standard query sentence matched with the target text and a difference sentence of the target text;
and sending the difference sentence to the terminal equipment to enable the terminal equipment to display the difference sentence.
5. The method according to any one of claims 1-3, further comprising:
receiving a data export request sent by terminal equipment, wherein the data export request carries a corresponding relation between a first field and a name corresponding to the first field; the first field is any field in the first query statement; 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 based on the first query statement query into a file with a preset format;
and sending the file with the preset format to the terminal equipment.
6. The method according to claim 5, wherein writing the name corresponding to the first field and the value of the first field in the queried data into a file with a preset format comprises:
and writing the name corresponding to the first field and the value of the first field in the inquired data into a target domain in the excel file.
7. The method according to claim 6, wherein the target domain in the excel file comprises:
blank lines of the excel file; or blank columns of the excel file.
8. A data processing apparatus, characterized in that the apparatus comprises:
the acquisition unit is used for acquiring a target text input by a user on the terminal equipment;
the matching unit is used for matching the target text with a standard query statement in a grammar library if the query mode determination message sent by the terminal equipment is not received before the target text is obtained;
a first sending unit, configured to send an error prompt message to the terminal device if a standard query sentence matched with the target text does not exist in the grammar library, so that the terminal device displays the error prompt message;
a first determining unit, configured to determine, if a query mode determination message sent by the terminal device is received before the target text is obtained, a corresponding query field according to the query mode determination message, and determine the target text as a query value corresponding to the query field;
the statement generating unit is used for generating a standard query statement which accords with the elastic search query grammar according to the determined query field and the query value corresponding to the query field;
and the first query unit is used for finishing data query based on the generated standard query statement.
9. A storage medium characterized by comprising a stored program, wherein the program executes the data processing method of any one of claims 1 to 7.
10. An electronic device comprising at least one processor, and at least one memory, bus connected to the processor; the processor and the memory complete mutual communication through the bus; the processor is arranged to call program instructions in the memory to perform the data processing method of any of claims 1 to 7.
CN201910888370.6A 2019-09-19 2019-09-19 Data processing method and device Pending CN112527976A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910888370.6A CN112527976A (en) 2019-09-19 2019-09-19 Data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910888370.6A CN112527976A (en) 2019-09-19 2019-09-19 Data processing method and device

Publications (1)

Publication Number Publication Date
CN112527976A true CN112527976A (en) 2021-03-19

Family

ID=74974416

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910888370.6A Pending CN112527976A (en) 2019-09-19 2019-09-19 Data processing method and device

Country Status (1)

Country Link
CN (1) CN112527976A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106649630A (en) * 2016-12-07 2017-05-10 乐视控股(北京)有限公司 Data query method and device
CN106934062A (en) * 2017-03-28 2017-07-07 广东工业大学 A kind of realization method and system of inquiry elasticsearch
CN106980619A (en) * 2016-01-18 2017-07-25 北京国双科技有限公司 Data query method and device
CN110020072A (en) * 2017-09-30 2019-07-16 北京国双科技有限公司 A kind of data processing method and terminal based on Elasticsearch
US20190236203A1 (en) * 2018-01-31 2019-08-01 Splunk, Inc. Non-tabular datasource connector

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106980619A (en) * 2016-01-18 2017-07-25 北京国双科技有限公司 Data query method and device
CN106649630A (en) * 2016-12-07 2017-05-10 乐视控股(北京)有限公司 Data query method and device
CN106934062A (en) * 2017-03-28 2017-07-07 广东工业大学 A kind of realization method and system of inquiry elasticsearch
CN110020072A (en) * 2017-09-30 2019-07-16 北京国双科技有限公司 A kind of data processing method and terminal based on Elasticsearch
US20190236203A1 (en) * 2018-01-31 2019-08-01 Splunk, Inc. Non-tabular datasource connector

Similar Documents

Publication Publication Date Title
EP3575957A1 (en) Voice function control method and apparatus
US11868710B2 (en) Method and apparatus for displaying a text string copied from a first application in a second application
CN108701121B (en) Dispatching user input to multiple input fields in a user interface
CN105868166B (en) Regular expression generation method and system
WO2014093911A2 (en) Action broker
US10810056B2 (en) Adding descriptive metadata to application programming interfaces for consumption by an intelligent agent
WO2020185330A1 (en) Solution for implementing computing service based on structured query language statement
US20170351691A1 (en) Search method and apparatus
CN108121455B (en) Identification correction method and device
CN110362630B (en) Data management method, device, equipment and computer readable storage medium
EP3467633B1 (en) Method, device, and terminal device for extracting data
CN106970758B (en) Electronic document operation processing method and device and electronic equipment
CN106202440B (en) Data processing method, device and equipment
CN103678706A (en) Picture recognition method, system, equipment and device based on screenshot information
CN111435406A (en) Method and device for correcting database statement spelling errors
US20220284060A1 (en) Question Answering Method and Apparatus Based on Knowledge Graph
CN111752964A (en) Data processing method and device based on data interface
CN112527976A (en) Data processing method and device
CN115033592A (en) SQL statement processing method, device, equipment and storage medium based on database
CN114895997A (en) Task association method and device and electronic equipment
CN113434063A (en) Information display method, device and equipment
CN111753548A (en) Information acquisition method and device, computer storage medium and electronic equipment
US20240143904A1 (en) Human-Computer Interaction Method And Apparatus Thereof
CN111753164A (en) Link event guiding method and device, electronic equipment and storage medium
CN110807089B (en) Question answering method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination