Summary of the invention
Fundamental purpose of the present invention is to provide a kind of query site collection method and device, to solve the problem easily collecting irrelevant information when collection network Query Information.
To achieve these goals, according to an aspect of the present invention, a kind of query site collection method is provided.This query site collection method comprises: website controller receives inquiry request; Inquiry request is converted into query statement by website controller; Website controller performs query statement, and obtains the Query Result performing query statement and obtain; And website controller record queries result.
Further, website controller receives the inquiry request of outside input by the display interface on website, and website is provided with the interface for providing input inquiry request.
Further, inquiry request is converted into query statement and comprises by website controller: website controller carries out analyzing and processing to inquiry request, obtains the querying condition in inquiry request, and wherein, querying condition is used to indicate the Query Result that inquiry meets querying condition; And querying condition is converted into query statement by website controller.
Further, after inquiry request is converted into query statement by website controller, network inquiry collection method also comprises: judge whether website controller starts to perform query statement; If judge that website controller starts to perform query statement, then the record start moment, wherein, initial time is the moment that website controller starts to perform query statement; After website controller performs query statement, network inquiry collection method also comprises: judge that website controller performs query statement and whether completes; If judge that website controller performs query statement and completes, then the end of record (EOR) moment, wherein, finish time is the moment that website controller execution query statement terminates; After record start moment and finish time, network inquiry collection method also comprises: calculate by initial time and finish time the duration that website controller performs query statement.
Further, carry user ID in inquiry request, user ID is the mark of the user for input inquiry request, after website controller receives inquiry request, network inquiry collection method also comprises: carry out analyzing and processing to inquiry request, obtains the user ID of carrying in inquiry request; Website controller record queries result comprises: website controller record user identifications, Query Result, and the corresponding relation between record user identifications and Query Result.
Further, in website controller record user identifications, Query Result, and after corresponding relation between record user identifications and Query Result, method also comprises: website controller receives the first statistics request, wherein, the first statistics request is added up the inquiry times of first user for asking; Website controller obtains first user mark, and first user is designated user ID corresponding to first user; Website controller obtains Query Result corresponding to first user mark according to corresponding relation; And website controller is added up according to the inquiry times of Query Result to first user of first user mark correspondence.
Further, after the controller record queries result of website, network inquiry collection method comprises: the Web portal address obtaining memory storage, and wherein, memory storage is used for storing queries result; Generate the statement inserting Query Result; And statement is written in memory storage corresponding to Web portal address.
To achieve these goals, according to a further aspect in the invention, a kind of network inquiry gathering-device is provided.This network inquiry gathering-device comprises: the first receiver module, receives inquiry request for website controller; Conversion module, is converted into query statement for website controller by inquiry request; Execution module, performs query statement for website controller, and obtains the Query Result performing query statement and obtain; And first logging modle, for website controller record queries result.
Further, network inquiry gathering-device also comprises: the first judge module, for judging whether website controller starts to perform query statement; Second logging modle, for when judging that website controller starts to perform query statement, then the record start moment, wherein, initial time is the moment that website controller starts to perform query statement; Second judge module, for judging that website controller performs query statement and whether completes; 3rd logging modle, for when judging that website controller execution query statement completes, then the end of record (EOR) moment, wherein, finish time is the moment that website controller execution query statement terminates; Computing module, for calculating by initial time and finish time the duration that website controller performs query statement.
Further, network inquiry gathering-device also comprises: analysis and processing module, for carrying out analyzing and processing to inquiry request, obtains the user ID of carrying in inquiry request; 4th logging modle, for website controller record user identifications, Query Result, and the corresponding relation between record user identifications and Query Result; Second receiver module, receives the first statistics request for website controller, and wherein, the first statistics request is added up the inquiry times of first user for asking; First acquisition module, obtain first user mark for website controller, first user is designated user ID corresponding to first user; Second acquisition module, obtains Query Result corresponding to first user mark for website controller according to corresponding relation; And statistical module, the Query Result inquiry times to first user corresponding according to first user mark for website controller is added up.
By the present invention, website controller is adopted to receive inquiry request; Inquiry request is converted into query statement by website controller; Website controller performs query statement, and obtains the Query Result performing query statement and obtain; And website controller record queries result, to be performed by website controller in network layer and record the Query Result performing query statement and obtain, avoid and easily collect irrelevant information by database performance collection kit information of collecting, solve the problem easily collecting irrelevant information when collection network Query Information, and then reach the effect of Optimizing Queries experience.
Embodiment
It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combine mutually.Below with reference to the accompanying drawings and describe the present invention in detail in conjunction with the embodiments.
Better the present invention program is understood in order to make those skilled in the art, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the embodiment of a part of the present invention, instead of whole embodiments.Based on the embodiment in the present invention, the every other embodiment obtained under those of ordinary skill in the art do not make creative work prerequisite, all should belong to protection scope of the present invention.
It should be noted that, term " first ", " second " etc. in instructions of the present invention and claims and above-mentioned accompanying drawing are for distinguishing similar object, and need not be used for describing specific order or precedence.Should be appreciated that the data used like this can be exchanged in the appropriate case, so as embodiments of the invention described herein can with except here diagram or describe those except order implement.In addition, term " comprises " and " having " and their any distortion, and intention is to cover not exclusive comprising.
The present invention aims to provide a kind of query site collection method and device.Fig. 1 is the process flow diagram of the first embodiment according to query site collection method of the present invention, and as shown in Figure 1, this query site collection method comprises following step S101 to step S104:
Step S101, website controller receives inquiry request.
Website in the embodiment of the present invention is that website controller is the controller of the website according to MVC Model Design, and this website controller is positioned at network layer according to Model View Controller (Model View Controller, referred to as MVC) Model Design.Be provided with display interface on the web site, this display interface is the interface for providing inquiry request to input, and website controller receives the inquiry request of outside input by the display interface on website.MVC is a kind of program development Design Mode, achieves being separated of display module and functional module, improves the maintainability of program, portability, extensibility and reusability, reduce the development difficulty of program.MVC comprises model, view, controller three layers.Model is the main part of application program, mainly comprises business logic modules and data module.Model and data layout have nothing to do, and such model can provide data for multiple view.Only need write due to the code being applied to model and once just can be reused by multiple view, so decrease the repetition of code.View provides the mutual interface with user.Controller receives the request from interface and gives model and processes.The embodiment of the present invention is based on MVC design pattern, and design website, utilizes the inquiry request that website controller process Website front-end user inputs, and encapsulate the service logic of website.The inquiry request that user inputs is converted into corresponding query statement by website controller, and performs query manipulation, obtains Query Information, is stored by the Query Information that execution query statement obtains, is convenient to combined data, finds out inquiry bottleneck.
User ID is carried in the inquiry request that website controller receives, user ID is the mark of the user for input inquiry request, after website controller receives inquiry request, website controller carries out analyzing and processing to inquiry request, obtains the user ID of carrying in inquiry request.
Step S102, inquiry request is converted into query statement by website controller.
Website controller carries out analyzing and processing to inquiry request after receiving inquiry request, obtains the querying condition in inquiry request.Wherein, querying condition is used to indicate the Query Result that inquiry meets querying condition.After obtaining querying condition, querying condition is converted into query statement by website controller.
Step S103, website controller performs query statement, and obtains the Query Result performing query statement and obtain.
Website controller performs this query statement after inquiry request is converted into query statement.Query site collection method of the present invention, in order to Optimizing Queries, after inquiry request is converted into query statement by website controller, judges whether website controller starts to perform query statement; If judge that website controller starts to perform query statement, then the record start moment, wherein, initial time is the moment that website controller starts to perform query statement; After website controller performs query statement, judge that website controller performs query statement and whether completes; If judge that website controller performs query statement and completes, then the end of record (EOR) moment, wherein, finish time is the moment that website controller execution query statement terminates; After record start moment and finish time, calculate by initial time and finish time the duration that website controller performs query statement.
Step S104, website controller record queries result.
The Query Result performing query statement and obtain is obtained after website controller performs query statement, wherein, this Query Result comprises the duration that website controller performs query statement, user ID, and the corresponding relation of Query Result that the inquiry request of user ID and user corresponding to this user ID of execution obtains.
After the controller record queries result of website, this Query Result is stored.First obtain the Web portal address of memory storage, wherein, memory storage is used for storing queries result.Then generate the statement inserting Query Result, and statement is written in memory storage corresponding to Web portal address.Memory storage in the embodiment of the present invention can be tables of data, also can be that other can realize the container of memory function.The Query Result write storage device that execution query statement obtains there is multiple implementation method.Such as, if memory storage is tables of data, so the modes such as NLog, Entityframework can be adopted.Preferably, in the embodiment of the present invention, the Query Result write tables of data that execution query statement obtains directly is adopted SQL statement, generate SQL statement Query Result being inserted this tables of data.Website controller performs this SQL statement, is write by Query Result in memory storage corresponding to Web portal address.
The query site collection method of the embodiment of the present invention adopts website controller to receive inquiry request; Inquiry request is converted into query statement by website controller; Website controller performs query statement, and obtains the Query Result performing query statement and obtain; And website controller record queries result, solve the problem easily collecting irrelevant information when collection network Query Information, and then reach the effect of Optimizing Queries experience.Meanwhile, the duration performing Query Result, user ID and the network controller execution query statement that query statement obtains is stored, is convenient to express-analysis and inquires about the information such as consuming time and inquiry times, thus realize Optimizing Queries targetedly.
Fig. 2 is the process flow diagram of the second embodiment according to query site collection method of the present invention, and as shown in Figure 2, in order to express-analysis user inquiry times, this query site collection method comprises following step S201 to step S208:
Step S201 to S204, with above-mentioned step S101 to S104.
Step S205, website controller receives the first statistics request, and wherein, the first statistics request is added up the inquiry times of first user for asking.
In order to analysis and consult number of times more accurately, the net news inquiry collection method of the embodiment of the present invention can realize the statistical study without inquiry times to same user, can also realize the statistical study of the different user to same queries request.Looking in new result in the embodiment of the present invention not only comprises user ID, performs the Query Result that query statement obtains, also includes the corresponding relation of user ID and Query Result simultaneously.After the complete Query Result of website controller record, in order to Optimizing Queries, can find fast from Query Result and analysis and consult number of times.The first statistics request that website controller receives is added up the inquiry times of first user for asking.
Step S206, website controller obtains first user mark, and first user is designated user ID corresponding to first user.
In order to add up the inquiry times of different user, first website controller will obtain the user ID of different user, and the corresponding relation of Query Result that user ID and execution query statement obtain.First user in the embodiment of the present invention is not limited only to first user, and first user herein can be any user in website input inquiry request.In the embodiment of the present invention preferably using the network address of the server at user place as user ID, the network address is the preferred embodiment of the present invention, and this user ID can also be the user name etc. that user registers on website as required.
Step S207, website controller obtains Query Result corresponding to first user mark according to corresponding relation.
Owing to recording the corresponding relation of user ID and Query Result in the controller of website, therefore, after acquisition user ID, website controller can directly obtain the Query Result corresponding with this user ID.
Step S208, the inquiry times of Query Result to first user that website controller is corresponding according to first user mark is added up.
User may carry out repeatedly User behavior within a period of time.Website controller is by record user identifications and the corresponding relation performing the Query Result that query statement obtains, the Query Result of first user can be filtered out, by adding up the inquiry times obtaining first user to the Query Result of this first user from this corresponding relation.In like manner, website controller can carry out statistical study to the inquiry times of any user of input inquiry request on that network.
The query site collection method of this embodiment adopts website controller to receive inquiry request; Inquiry request is converted into query statement by website controller; Website controller performs query statement, and obtains the Query Result performing query statement and obtain; And website controller record queries result; Website controller receives the first statistics request, and wherein, the first statistics request is added up the inquiry times of first user for asking; Website controller obtains first user mark, and first user is designated user ID corresponding to first user; Website controller obtains Query Result corresponding to first user mark according to corresponding relation; And website controller is added up according to the inquiry times of Query Result to first user of first user mark correspondence, solves the problem easily collecting irrelevant information when collection network Query Information, and then reaches the effect of Optimizing Queries experience.Meanwhile, utilize website controller record user identifications and the corresponding relation of Query Result performing query statement and obtain, the inquiry times of user can be analyzed by express statistic.
It should be noted that, can perform in the computer system of such as one group of computer executable instructions in the step shown in the process flow diagram of accompanying drawing, and, although show logical order in flow charts, but in some cases, can be different from the step shown or described by order execution herein.
The embodiment of the present invention additionally provides a kind of query site gathering-device.It should be noted that, this query site gathering-device may be used for the query site collection method performing the embodiment of the present invention.
Fig. 3 is the schematic diagram of the first embodiment according to query site gathering-device of the present invention.As shown in Figure 3, this query site gathering-device comprises: the first receiver module 10, conversion module 20, execution module 30 and the first logging modle 40.
First receiver module 10, receives inquiry request for website controller.
Conversion module 20, is converted into query statement for website controller by inquiry request.
Wherein, conversion module 20 specifically comprises acquisition submodule, carries out analyzing and processing for website controller to inquiry request, obtains the querying condition in inquiry request, and wherein, querying condition is used to indicate the Query Result that inquiry meets querying condition; Transformant module, is converted into query statement for website controller by querying condition.
Execution module 30, performs query statement for website controller, and obtains the Query Result performing query statement and obtain.
First logging modle 40, for website controller record queries result.Wherein, the first logging modle 40 can also be used for website controller record user identifications, Query Result, and the corresponding relation between record user identifications and Query Result.
The query site device of this embodiment also comprises: the first judge module, the second logging modle, the second judge module, the 3rd logging modle and computing module.Wherein, the first judge module, for judging whether website controller starts to perform query statement.Second logging modle, for when judging that website controller starts to perform query statement, then the record start moment, wherein, initial time is the moment that website controller starts to perform query statement.Second judge module, for judging that website controller performs query statement and whether completes.3rd logging modle, for when judging that website controller execution query statement completes, then the end of record (EOR) moment, wherein, finish time is the moment that website controller execution query statement terminates.Computing module, for calculating by initial time and finish time the duration that website controller performs query statement.
The query site gathering-device of the present embodiment comprises the first receiver module 10, conversion module 20, execution module 30, the first logging modle 40.In order to add up the inquiry times of user, the query site device of this embodiment also comprises the first judge module, the second logging modle, the second judge module, the 3rd logging modle and computing module.By this embodiment, solve the problem easily collecting irrelevant information when collection network Query Information, and then reach the effect of Optimizing Queries experience.Meanwhile, utilize website controller record user identifications and the corresponding relation performing the Query Result that query statement obtains, be convenient to the inquiry times of express statistic analysis user.
Fig. 4 is the schematic diagram of the second embodiment according to query site gathering-device of the present invention.As shown in Figure 4, this query site gathering-device comprises: the first receiver module 10, conversion module 20, execution module 30, the first logging modle 40, analysis and processing module 110,4th logging modle 120, second receiver module 130, first acquisition module 140, second acquisition module 150 and statistical module 160.
Analysis and processing module 110, for carrying out analyzing and processing to inquiry request, obtains the user ID of carrying in inquiry request.
4th logging modle 120, for website controller record user identifications, Query Result, and the corresponding relation between record user identifications and Query Result.
Second receiver module 130, receives the first statistics request for website controller, and wherein, the first statistics request is added up the inquiry times of first user for asking.
First acquisition module 140, obtain first user mark for website controller, first user is designated user ID corresponding to first user.
Second acquisition module 150, obtains Query Result corresponding to first user mark for website controller according to corresponding relation.
Statistical module 160, the Query Result inquiry times to first user corresponding according to first user mark for website controller is added up.
The query site gathering-device of the embodiment of the present invention comprises: the first receiver module 10, conversion module 20, execution module 30, first logging modle 40, analysis and processing module 110, the 4th logging modle 120, second receiver module 130, first acquisition module 140, second acquisition module 150 and statistical module 160.This query site gathering-device can also comprise: the 3rd acquisition module, and for obtaining the Web portal address of memory storage, wherein, memory storage is used for storing queries result; Generation module, for generating the statement inserting Query Result; Writing module, for being written to statement in memory storage corresponding to Web portal address.The problem easily collecting irrelevant information when collection network Query Information is solved by the query site gathering-device of the embodiment of the present invention.
Query site collection method of the present invention and device, website controller is utilized to obtain inquiry request, this inquiry request is converted into query statement, perform query statement and obtain the Query Result performing query statement and obtain, and record queries result, the above-mentioned Query Information relevant with record execution User behavior about the behavior of inquiry is all realized by the controller of website, this query site cell phone methods and device solve the problem easily collecting irrelevant information when collection network Query Information, and then reach the effect of Optimizing Queries experience.Simultaneously, utilize website controller record to perform query statement and obtain Query Result inquiry duration used, utilize the Query Result that website controller collection execution query statement obtains, user ID, and the corresponding relation of Query Result and user ID, can the inquiry times of Statistic Query duration and user fast.
Obviously, those skilled in the art should be understood that, above-mentioned of the present invention each module or each step can realize with general calculation element, they can concentrate on single calculation element, or be distributed on network that multiple calculation element forms, alternatively, they can realize with the executable program code of calculation element, thus, they can be stored and be performed by calculation element in the storage device, or they are made into each integrated circuit modules respectively, or the multiple module in them or step are made into single integrated circuit module to realize.Like this, the present invention is not restricted to any specific hardware and software combination.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.