Summary of the invention
The embodiment of the present invention provides a kind of search method and device, for realizing very complicated inquiry, statistics, analytic function.
A kind of search method, comprises the following steps:
Receive the compound query statement of user's input, described compound query statement comprises at least two statements be together in series by predetermined symbol, and described predetermined symbol is used to indicate the input of the result of described predetermined symbol side statement as described predetermined symbol opposite side statement;
Utilize described compound query statement to carry out corresponding operating to index file or database, obtain result for retrieval.
Some beneficial effects of the embodiment of the present invention can comprise: by receiving the compound query statement of user's input, and analytic operation is carried out to compound query statement, and then obtain final result for retrieval, make user only in the search box input inquiry statement can realize complicated inquiry and statistical study, save a large amount of time and human resources, thus realize very complicated inquiry, statistics, analytic function.
In one embodiment, described compound query statement comprises at least two statements be together in series by pipe, and described at least two statements comprise query statement and/or perform statement;
Describedly utilize described compound query statement to carry out corresponding operating to index file or database, obtain result for retrieval, comprising:
Corresponding operating is carried out to the statement in described compound query statement from left to right on the left of first pipe, obtains the first result; Using the input of the statement of described first result on the right side of described first pipe, corresponding operating is carried out to the statement on the right side of described first pipe, obtains the second result; Using the input of the statement of described second result in described compound query statement from left to right on the right side of second pipe, corresponding operating is carried out to the statement on the right side of described second pipe, obtain the 3rd result; The like, until carry out corresponding operating to the statement in described compound query statement from left to right on the right side of last pipe, obtain described result for retrieval.
By receiving at least two query statements and/or the perform statement of user's input, and utilize pipe to carry out analytic operation at least two query statements and/or perform statement, and then obtain final result for retrieval, make user only in the search box input inquiry statement can realize complicated inquiry and statistical study, save a large amount of time and human resources, thus realize very complicated inquiry, statistics, analytic function.
In one embodiment, described compound query statement comprises at least two the system script orders be together in series by order connector;
Describedly utilize described compound query statement to carry out corresponding operating to index file or database, obtain result for retrieval, comprising:
To perform in described compound query statement the system script order inside first order connector from the inside to surface, obtain the 4th result; Using the input of described 4th result as the system script order outside described first order connector, perform the system script order outside described first order connector, obtain the 5th result; Using the input of the system script order of described 5th result in described compound query statement outside second order connector from the inside to surface, perform the system script order outside described second order connector, obtain the 6th result; The like, until to execute in described compound query statement the system script order outside last order connector from the inside to surface, obtain described result for retrieval.
By receiving at least two system script orders of user's input, and utilize order connector analyze at least two system script orders and perform the corresponding command, and then obtain final result for retrieval, make user only in the search box input inquiry statement can realize complicated inquiry and statistical study, save a large amount of time and human resources, thus realize very complicated inquiry, statistics, analytic function.
In one embodiment, described method also comprises:
Receive the data that user uploads;
The described data received are converted into structural data by unstructured data;
Index is set up to the structural data after described conversion, and is stored in index file or database.
Data user uploaded are converted into structural data by unstructured data, and be stored in index file or database, facilitate and utilize query statement to carry out unified retrieval and analysis, make user only in the search box input inquiry statement can realize complicated inquiry and statistical study, save a large amount of time and human resources, thus realize very complicated inquiry, statistics, analytic function.
In one embodiment, described method also comprises:
By the result for retrieval of described compound query statement and described compound query statement corresponding stored;
When receiving the operation selecting described compound query statement, read the result for retrieval that described compound query statement is corresponding.
By the result for retrieval of compound query statement and compound query statement corresponding stored, when making again to this compound query sentence retrieval, without the need to carrying out corresponding analytic operation again, directly from index file or database, read corresponding result for retrieval, save the expense of a large amount of time and analytic operation etc., achieve efficient complex query and statistical study.
A kind of indexing unit, comprising:
First receiver module, for receiving the compound query statement of user's input, described compound query statement comprises at least two statements be together in series by predetermined symbol, and described predetermined symbol is used to indicate the input of the result of described predetermined symbol side statement as described predetermined symbol opposite side statement;
Operational module, for utilizing described compound query statement to carry out corresponding operating to index file or database, obtains result for retrieval.
In one embodiment, described operational module comprises:
First operating unit, at least two statements be together in series by pipe are comprised for described compound query statement, when described at least two statements comprise query statement and/or perform statement, corresponding operating is carried out to the statement in described compound query statement from left to right on the left of first pipe, obtains the first result; Using the input of the statement of described first result on the right side of described first pipe, corresponding operating is carried out to the statement on the right side of described first pipe, obtains the second result; Using the input of the statement of described second result in described compound query statement from left to right on the right side of second pipe, corresponding operating is carried out to the statement on the right side of described second pipe, obtain the 3rd result; The like, until carry out corresponding operating to the statement in described compound query statement from left to right on the right side of last pipe, obtain described result for retrieval.
In one embodiment, described operational module comprises:
Second operating unit, when comprising for described compound query statement at least two the system script orders be together in series by order connector, to perform in described compound query statement the system script order inside first order connector from the inside to surface, obtain the 4th result; Using the input of described 4th result as the system script order outside described first order connector, perform the system script order outside described first order connector, obtain the 5th result; Using the input of the system script order of described 5th result in described compound query statement outside second order connector from the inside to surface, perform the system script order outside described second order connector, obtain the 6th result; The like, until to execute in described compound query statement the system script order outside last order connector from the inside to surface, obtain described result for retrieval.
In one embodiment, described device also comprises:
Second receiver module, for receiving the data that user uploads;
Conversion module, for being converted into structural data by the described data received by unstructured data;
First memory module, for setting up index to the structural data after described conversion, and is stored in index file or database.
In one embodiment, described device also comprises:
Second memory module, for by the result for retrieval of described compound query statement and described compound query statement corresponding stored;
Read module, for when receiving the operation selecting described compound query statement, reads the result for retrieval that described compound query statement is corresponding.
Other features and advantages of the present invention will be set forth in the following description, and, partly become apparent from instructions, or understand by implementing the present invention.Object of the present invention and other advantages realize by structure specifically noted in write instructions, claims and accompanying drawing and obtain.
Below by drawings and Examples, technical scheme of the present invention is described in further detail.
Embodiment
Below in conjunction with accompanying drawing, the preferred embodiments of the present invention are described, should be appreciated that preferred embodiment described herein is only for instruction and explanation of the present invention, is not intended to limit the present invention.
The invention provides a kind of search method and device, for realizing very complicated inquiry, statistics, analytic function.Fig. 1 is the process flow diagram of a kind of search method in the embodiment of the present invention.As shown in Figure 1, the method is used for, in terminal, comprising the following steps S11-S12:
Step S11, receive the compound query statement of user's input, compound query statement comprises at least two statements be together in series by predetermined symbol, and predetermined symbol is used to indicate the input of the result of predetermined symbol side statement as predetermined symbol opposite side statement;
Step S12, utilizes compound query statement to carry out corresponding operating to index file or database, obtains result for retrieval.
The technical scheme that the embodiment of the present invention provides, by receiving the compound query statement of user's input, and analytic operation is carried out to compound query statement, and then obtain final result for retrieval, make user only in the search box input inquiry statement can realize complicated inquiry and statistical study, save a large amount of time and human resources, thus realize very complicated inquiry, statistics, analytic function.
Said method, before implementation step S11, further comprising the steps of A1-A3:
Steps A 1, receives the data that user uploads;
The data received are converted into structural data by unstructured data by steps A 2;
Steps A 3, sets up index to the structural data after transforming, and is stored in index file or database.
Data user uploaded are converted into structural data by unstructured data, and are stored in index file or database, facilitate and utilize query statement to carry out unified retrieval and analysis.User is in the search box after input inquiry statement, terminal is analyzed or computing query statement, query statement can be a simple statement (such as a keyword or a perform statement), also can be in series by multiple statements of complexity, when user input be compound query statement time, terminal carries out analytic operation to compound query statement, utilize the result of analytic operation to carry out corresponding operating to the data prestored in index file or database, obtain final result for retrieval.
In said method, compound query statement can be at least two statements be together in series by pipe, also can be at least two the system script orders be together in series by order connector.Respectively the search method of these two kinds of compound query statements is described below.
In one embodiment, compound query statement comprises at least two statements be together in series by pipe, and wherein, at least two statements comprise query statement and/or perform statement.Now, step S12 can be embodied as following steps B1-B4:
Step B1, carries out corresponding operating to the statement in compound query statement from left to right on the left of first pipe, obtains the first result;
Step B2, using the input of the statement of the first result on the right side of first pipe, carries out corresponding operating to the statement on the right side of first pipe, obtains the second result;
Step B3, using the input of the statement of the second result in compound query statement from left to right on the right side of second pipe, carries out corresponding operating to the statement on the right side of second pipe, obtains the 3rd result;
Step B4, the like, until carry out corresponding operating to the statement in compound query statement from left to right on the right side of last pipe, obtain result for retrieval.
Such as, user is input inquiry statement " apache|count " in the search box, and the symbol " | " in this query statement is the pipe of multiple statement that is used for connecting, and is used to indicate the input of the result of statement on the left of pipe as statement on the right side of pipe.Therefore, when terminal is retrieved query statement " apache|count ", first the result retrieving query statement " apache " in the data prestored from index file or database is come, and using the input of result as perform statement " count ", the number of the result for retrieval of statistics " apache ".
Fig. 2 is the process flow diagram of a kind of search method in one embodiment of the invention.In this embodiment, for compound query statement " apache|group by IP|count ", compound query statement " apache|group by IP|count " is made up of three statements be together in series by pipe, wherein, " apache " is query statement, and " group by IP " and " count " are perform statement.As shown in Figure 2, S21-S24 is comprised the following steps:
Step S21, receives the query statement " apache|group by IP|count " of user's input;
Step S22, retrieves query statement " apache ", obtains the first result from index file or database;
Step S23, using the input of the first result as perform statement " group by IP ", performs " group by IP ", obtains the second result; That is, divide into groups to the result for retrieval of query statement " apache " with the difference of IP address;
Step S24, using the input of the second result as perform statement " count ", performs " count ", obtains final result for retrieval.
The technical scheme that the embodiment of the present invention provides, by receiving at least two query statements and/or the perform statement of user's input, and utilize pipe to carry out analytic operation at least two query statements and/or perform statement, and then obtain final result for retrieval, make user only in the search box input inquiry statement can realize complicated inquiry and statistical study, save a large amount of time and human resources, thus realize very complicated inquiry, statistics, analytic function.
In another embodiment, compound query statement comprises at least two the system script orders be together in series by order connector.Now, step S12 can be embodied as following steps C1-C4:
Step C1, to perform in compound query statement the system script order inside first order connector from the inside to surface, obtains the 4th result;
Step C2, using the input of the 4th result as the system script order outside first order connector, performs the system script order outside first order connector, obtains the 5th result;
Step C3, using the input of the system script order of the 5th result in compound query statement outside second order connector from the inside to surface, performs the system script order outside second order connector, obtains the 6th result;
Step C4, the like, until to execute in compound query statement the system script order outside last order connector from the inside to surface, obtain result for retrieval.
Such as, the query statement that user inputs in the search box is the order " command1 [command2] " in Unix/Linux script, symbol " [] " in this query statement is the order connector of multiple system script order that is used for connecting, and is used to indicate the input of the result of statement inside order connector as statement outside order connector.Therefore, when terminal is retrieved query statement " command1 [command2] ", first according to the data executive system script command " command2 " prestored in index file or database, and the execution result of " command2 " will be ordered as the input of system script order " command1 ", fill order " command1 ", thus obtain final result for retrieval.
Fig. 3 is the process flow diagram of a kind of search method in one embodiment of the invention.In this embodiment, for compound query statement " command1 [command2 [command3]] ", compound query statement " command1 [command2 [command3]] " is made up of three the system script orders be together in series by order connector.As shown in Figure 3, S31-S34 is comprised the following steps:
Step S31, receives the query statement " command1 [command2 [command3]] " of user's input;
Step S32, according to the data fill order " command3 " prestored in index file or database, obtains the 4th result;
Step S33, using the input of the 4th result as order " command2 ", fill order " command2 ", obtains the 5th result;
Step S34, using the input of the 5th result as order " command1 ", fill order " command1 ", obtains final result for retrieval.
The technical scheme that the embodiment of the present invention provides, by receiving at least two system script orders of user's input, and utilize order connector analyze at least two system script orders and perform the corresponding command, and then obtain final result for retrieval, make user only in the search box input inquiry statement can realize complicated inquiry and statistical study, save a large amount of time and human resources, thus realize very complicated inquiry, statistics, analytic function.
In one embodiment, said method is further comprising the steps of: by the result for retrieval of compound query statement and compound query statement corresponding stored; When receiving the operation selecting compound query statement, read the result for retrieval that compound query statement is corresponding.By the result for retrieval of compound query statement and compound query statement corresponding stored, when making again to this compound query sentence retrieval, without the need to carrying out corresponding analytic operation again, directly from index file or database, read corresponding result for retrieval, save the expense of a large amount of time and analytic operation etc., achieve efficient complex query and statistical study.
Fig. 4 is the block diagram of a kind of indexing unit in the embodiment of the present invention.As shown in Figure 4, comprising:
First receiver module 41, for receiving the compound query statement of user's input, compound query statement comprises at least two statements be together in series by predetermined symbol, and predetermined symbol is used to indicate the input of the result of predetermined symbol side statement as predetermined symbol opposite side statement;
Operational module 42, for utilizing compound query statement to carry out corresponding operating to index file or database, obtains result for retrieval.
In one embodiment, as shown in Figure 5, operational module 42 comprises:
First operating unit 421, at least two statements be together in series by pipe are comprised for compound query statement, when at least two statements comprise query statement and/or perform statement, corresponding operating is carried out to the statement in compound query statement from left to right on the left of first pipe, obtains the first result; Using the input of the statement of the first result on the right side of first pipe, corresponding operating is carried out to the statement on the right side of first pipe, obtains the second result; Using the input of the statement of the second result in compound query statement from left to right on the right side of second pipe, corresponding operating is carried out to the statement on the right side of second pipe, obtain the 3rd result; The like, until carry out corresponding operating to the statement in compound query statement from left to right on the right side of last pipe, obtain result for retrieval.
Second operating unit 422, when comprising for compound query statement at least two the system script orders be together in series by order connector, to perform in compound query statement the system script order inside first order connector from the inside to surface, obtain the 4th result; Using the input of the 4th result as the system script order outside first order connector, perform the system script order outside first order connector, obtain the 5th result; Using the input of the system script order of the 5th result in compound query statement outside second order connector from the inside to surface, perform the system script order outside second order connector, obtain the 6th result; The like, until to execute in compound query statement the system script order outside last order connector from the inside to surface, obtain result for retrieval.
In one embodiment, as shown in Figure 6, said apparatus also comprises:
Second receiver module 43, for receiving the data that user uploads;
Conversion module 44, for being converted into structural data by the data received by unstructured data;
First memory module 45, for setting up index to the structural data after conversion, and is stored in index file or database;
Second memory module 46, for by the result for retrieval of compound query statement and compound query statement corresponding stored;
Read module 47, for when receiving the operation selecting compound query statement, reads the result for retrieval that compound query statement is corresponding.
The technical scheme that the embodiment of the present invention provides, by receiving the compound query statement of user's input, and analytic operation is carried out to compound query statement, and then obtain final result for retrieval, make user only in the search box input inquiry statement can realize complicated inquiry and statistical study, save a large amount of time and human resources, thus realize very complicated inquiry, statistics, analytic function.
Those skilled in the art should understand, embodiments of the invention can be provided as method, system or computer program.Therefore, the present invention can adopt the form of complete hardware embodiment, completely software implementation or the embodiment in conjunction with software and hardware aspect.And the present invention can adopt in one or more form wherein including the upper computer program implemented of computer-usable storage medium (including but not limited to magnetic disk memory and optical memory etc.) of computer usable program code.
The present invention describes with reference to according to the process flow diagram of the method for the embodiment of the present invention, equipment (system) and computer program and/or block scheme.Should understand can by the combination of the flow process in each flow process in computer program instructions realization flow figure and/or block scheme and/or square frame and process flow diagram and/or block scheme and/or square frame.These computer program instructions can being provided to the processor of multi-purpose computer, special purpose computer, Embedded Processor or other programmable data processing device to produce a machine, making the instruction performed by the processor of computing machine or other programmable data processing device produce device for realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be stored in can in the computer-readable memory that works in a specific way of vectoring computer or other programmable data processing device, the instruction making to be stored in this computer-readable memory produces the manufacture comprising command device, and this command device realizes the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be loaded in computing machine or other programmable data processing device, make on computing machine or other programmable devices, to perform sequence of operations step to produce computer implemented process, thus the instruction performed on computing machine or other programmable devices is provided for the step realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
Obviously, those skilled in the art can carry out various change and modification to the present invention and not depart from the spirit and scope of the present invention.Like this, if these amendments of the present invention and modification belong within the scope of the claims in the present invention and equivalent technologies thereof, then the present invention is also intended to comprise these change and modification.