Summary of the invention
The invention provides a kind of data enquire method, data query server, data acquisition unit and data query system, can improve the processing speed of data query, the system resource that alleviates data acquisition unit takies the load pressure with the data query server, promotes the processing power of whole system.
For achieving the above object, first aspect present invention provides a kind of data enquire method, and described method comprises:
Receive the query requests of input, carry the field that to inquire about and the query word in the described field in the described query requests;
Inquiry obtains collector sign corresponding to described query word, the corresponding relation of the query word in the described centralized indexes table in the described field of storage and collector sign from the centralized indexes table of described Related fields;
Generate the querying command that carries described field and query word according to described query requests, and described querying command sent to data acquisition unit corresponding to described collector sign, in order to described data acquisition unit in the local index table of the Related fields that querying command described in the described data acquisition unit carries, inquiry obtain with described querying command in the data that are complementary of the query word that carries;
Receive the described data that described data acquisition unit returns, according to Query Result and the output of the described query requests of data formation that receives.
In conjunction with first aspect, in the possible embodiment of the first of first aspect, the described inquiry from the centralized indexes table of described Related fields obtains also comprising before collector sign corresponding to described query word:
For described field, set up the centralized indexes table of described Related fields;
The described centralized indexes table of setting up described Related fields comprises:
Receive the concordance list that reports of described field that each data acquisition unit sends, described reporting comprises in the concordance list that the data that send in the described data acquisition unit that reports concordance list are corresponding to the query word of described field;
In the centralized indexes table of described field, the sign of storage data acquisition unit and the corresponding relation that reports the query word of this field in the concordance list that described data acquisition unit reports.
In conjunction with first aspect, in the possible embodiment of the second of first aspect, the described inquiry from the centralized indexes table of described Related fields obtains collector sign corresponding to described query word, comprising:
If carry at least two fields that will inquire about in the described query requests, obtain the query word of each field in the described query requests, and record the logical relation between the query word of described each field;
Inquiry obtains the collector sign corresponding to query word of described each field from the centralized indexes table of described each Related fields;
According to the logical relation between the query word of described each field, screening is met the collector sign of described logical relation from the described collector sign that inquiry obtains.
Second aspect, the present invention also provides a kind of data enquire method, and described method comprises:
The querying command that the receive data querying server sends, described querying command comprise the field that will inquire about of carrying in the query requests that described data query server receives and the query word in the described field;
From the local index table of described Related fields inquiry obtain with described querying command in the data storage position that is complementary of query word, the query word in the described local index table in the described field of storage and the corresponding relation of described data storage position;
According to described data storage position, obtain described Data Concurrent and give described data query server.
In conjunction with second aspect, in the possible embodiment of the first of second aspect, described from the local index table of described Related fields inquiry obtain with described querying command in the data storage position that is complementary of query word before, also comprise:
For described field, set up the local index table of described Related fields;
The described local index table of setting up described Related fields comprises:
Obtain data and described data storage position in the current data collector, comprise the content of at least one field in the described data;
For each field, described data at the content of this field query word as described data, are set up the mapping relations of described query word and described memory location, form this field at the local index table of described current data collector.
In conjunction with the possible embodiment of the first of second aspect, in the possible embodiment of the second of second aspect, described in the local index table of field described in the described current data collector, store after the corresponding relation of the query word of described data and described data storage position, also comprise:
From the local index table of this field, extract described query word, described query word gone heavily to process, form described current data collector described field report concordance list;
The concordance list that reports of described field is sent to described data query server, set up the centralized indexes table of described Related fields in order to described data query server.
In conjunction with second aspect, in the third possible embodiment of second aspect, described from the local index table of described Related fields inquiry obtain with described querying command in the data storage position that is complementary of query word, comprising:
If carry at least two fields that will inquire about in the described querying command, obtain the query word of each field in the described querying command, and record the logical relation between the query word of described each field;
From the local index table of described each Related fields inquiry obtain with described querying command in the data storage position that is complementary of the query word of each field;
According to the logical relation between the query word of described each field, screening is met the data storage position of described logical relation from the described data storage position that inquiry obtains.
The third aspect, the present invention also provides a kind of data query server, and described data query server comprises:
The first receiving element be used for to receive the query requests of input, carries the field that will inquire about and the query word in the described field in the described query requests;
The first query unit, be used for the centralized indexes table from described Related fields, inquiry obtains collector sign corresponding to query word that described query requests that described the first receiving element receives is carried, the corresponding relation that the query word in the described centralized indexes table in the described field of storage and collector identify;
The first processing unit, be used for generating the querying command that carries described field and query word according to described query requests, and described querying command sent to data acquisition unit corresponding to collector sign that the inquiry of described the first query unit obtains, in order to described data acquisition unit in the local index table of the Related fields that querying command described in the described data acquisition unit carries, inquiry obtain with described querying command in the data that are complementary of the query word that carries;
The first output unit is used for receiving the described data that described data acquisition unit returns, according to Query Result and the output of the described query requests of data formation that receives.
In conjunction with the third aspect, in the possible embodiment of the first of the third aspect, described data query server also comprises:
The first indexing units is used for for described field, sets up the centralized indexes table of described Related fields;
Described the first indexing units comprises:
First receives subelement, is used for receiving the concordance list that reports of described field that each data acquisition unit sends, and described reporting comprises in the concordance list that the data that send in the described data acquisition unit that reports concordance list are corresponding to the query word of described field;
The first index subelement is used for the centralized indexes table in described field, the sign of storage data acquisition unit and the corresponding relation that reports the query word of this field in the concordance list that described data acquisition unit reports.
In conjunction with the third aspect, in the possible embodiment of the second of the third aspect, described the first query unit comprises:
First resolves subelement, carries at least two fields that will inquire about if be used for the described query requests that described the first receiving element receives, and obtains the query word of each field in the described query requests, and records the logical relation between the query word of described each field;
The first inquiry subelement is used for obtaining the described first collector sign corresponding to query word of resolving described each field that subelement obtains from the centralized indexes table inquiry of described each Related fields;
First filters subelement, for the logical relation between the query word of described each field of obtaining according to described the first parsing subelement, from the described collector sign that described the first inquiry subelement inquiry obtains, screen the collector that is met described logical relation and identify.
Fourth aspect, the present invention also provides a kind of data acquisition unit, and described data acquisition unit comprises:
The second receiving element is used for the querying command that the receive data querying server sends, and described querying command carries the field that will inquire about and the query word in the described field;
The second query unit, be used for the data storage position that the query word from the querying command that the local index table inquiry of described Related fields obtains receiving with described the second receiving element is complementary, the query word in the described local index table in the described field of storage and the corresponding relation of described data storage position;
The second processing unit is used for inquiring about the described data storage position that obtains according to described the second query unit, obtains described Data Concurrent and gives described data query server.
In conjunction with fourth aspect, in the possible embodiment of the first of fourth aspect, described data acquisition unit also comprises:
The second indexing units is used for for described field, sets up the local index table of described Related fields;
Described the second indexing units comprises:
Obtain subelement, for the data and the described data storage position that obtain the current data collector, comprise the content of at least one field in the described data;
The second index subelement, be used for obtaining each field that subelement obtains for described, with described data at the content of this field query word as described data, in the local index table of field described in the described data acquisition unit, store the query word of described data and the corresponding relation of described data storage position.
In conjunction with the possible embodiment of the first of fourth aspect, in the possible embodiment of the second of fourth aspect, described the second indexing units also comprises:
The 3rd index subelement, the local index table that is used for this field of obtaining from described the second index subelement extracts described query word, and described query word is gone heavily to process, form described current data collector described field report concordance list;
Send subelement, the concordance list that reports that is used for described field that will described the 3rd index subelement formation sends to described data query server, sets up the centralized indexes table of described field in order to described data query server.
In conjunction with fourth aspect, in the third possible embodiment of fourth aspect, described the second query unit comprises:
Second resolves subelement, carries at least two fields that will inquire about if be used for the described querying command that described the second receiving element receives, and obtains the query word of each field in the described querying command, and records the logical relation between the query word of described each field;
The second inquiry subelement, the data storage position that the query word of each field is complementary the described querying command that obtains obtaining with described the second parsing subelement for the local index table inquiry from described each Related fields;
Second filters subelement, for the logical relation between the query word of described each field of obtaining according to described the second parsing subelement, screening is met the data storage position of described logical relation from the described data storage position that described the second inquiry subelement inquiry obtains.
The 5th aspect, the present invention also provides a kind of data query system, and described system comprises:
The data acquisition unit that the data query server that the above-mentioned third aspect provides and above-mentioned fourth aspect provide.
The data enquire method that the embodiment of the invention provides, data query server, data acquisition unit and data query system, by in data acquisition unit and data query server, setting up respectively local index table and centralized indexes table, the system resource that can effectively alleviate data acquisition unit takies, make data acquisition unit can have more resource to be used for improving the performance that gathers, thereby the processing power of elevator system integral body, the processing speed of raising data query.
Embodiment
Below by drawings and Examples, technical scheme of the present invention is described in further detail.
Fig. 1 is the Organization Chart of the data query system that provides of the embodiment of the invention, as shown in Figure 1, the present invention adopts distributed structure/architecture, comprise that a data query server 10 and many number of units are according to collector 20, the data acquisition unit 20 responsible processing such as the data acquisitions such as massive logs (comprising reception, format, merger), storage and index that Log Source 30 is reported, data query server 10 is unified entrances of data query.
Data enquire method provided by the invention can be used for the fast query of mass data, describes as an example of daily record data example in the following embodiments.
Embodiment one
Before the inquiry of carrying out daily record data, need in advance the data of having stored in the system to be set up index, usually when storing, data carry out, carry out the inquiry of data in order to system according to the concordance list of setting up.
In data acquisition unit and data query server, set up respectively local index table and centralized indexes table in the present embodiment.The local index table is used for the index of the daily record data of storage current data collector, and its effect is: when providing querying condition, can find the concrete memory location of qualified all daily records in the local data.The centralized indexes table is used for the query word of each field of storage and the index of collector sign, its effect is: when providing querying condition, can find data to be checked and may be stored on which data acquisition unit, provide the identification information of the data acquisition unit that stores data to be checked in the centralized indexes table.
Fig. 2 is the signaling diagram that process set up in index that the present embodiment provides, as shown in Figure 2, comprising:
Step S101, data acquisition unit obtain data and the described data storage position in the current data collector.
The data of storing in the data acquisition unit alternatively, are the original log data that Log Source reports.After Log Source reported original log data to data collector, data acquisition unit also needed to build local index for the original log data.
Data acquisition unit formats with merger the original log data and processes, the original log data are treated to the form (being the every line item in the log sheet) of every record in the log sheet, each log sheet may have a plurality of fields, as shown in table 1 below, this log sheet comprises the fields such as field 1 and field 2, and sequence number represents the data storage position.
Table 1
Sequence number | Field | 1 content |
Field 2 contents |
... |
1 |
bbb |
fff |
... |
2 |
aaa |
ccc |
... |
3 |
aaa |
ggg |
... |
Step S102, data acquisition unit are for each field, with described data at the content of this field query word as described data, set up the mapping relations of described query word and described memory location, form this field at the local index table of described current data collector.
In the local index of data acquisition unit, each field for every record in the log sheet is set up respectively the local index table, and the data of certain field contents and certain field contents that contains described appointment are at the stored position information of log sheet in the log sheet of the corresponding appointment of each concordance list.Wherein, field contents is as the query word of corresponding data.The mapping relations of described query word and described memory location can but be not limited to adopt the form of form to represent, as shown in table 2 below is the local index table of field 1 in the data acquisition unit:
Table 2
Field 1 content |
The position |
aaa |
2 |
aaa |
3 |
Local index table by corresponding field can find the particular location of data on this data acquisition unit rapidly.For example, the particular location of field 1 certain content, then according to the local index table of field 1, can find fast corresponding position.
Step S103, data acquisition unit extract described query word from the local index table of this field, described query word is gone heavily to process, form described current data collector described field report concordance list.
Data acquisition unit extracts the concordance list that reports that reports according to the local index table of field.Report the concrete original log position that has not had each index content corresponding in the concordance list, and only have each data to content that should field, i.e. query word.Usually before reporting, also can go heavily to process to query word, make the not duplicate contents of each field that reports.For example have two aaa and a bbb in the table 2 in the field 1, after the past heavily processes, report and only have an aaa and a bbb in the concordance list, as shown in table 3 below.
Table 3
Field 1 content |
aaa |
bbb |
... |
For the query word that extracts in the newly-increased local index table, itself and the concordance list that reports that has reported are compared, if query word is identical, then do not add reporting in the concordance list to, only upload the newly-increased unduplicated concordance list that reports.
Step S104, data acquisition unit send to described data query server with the concordance list that reports of described field.
Data acquisition unit reports the data query server with the concordance list that reports as shown in table 3.For more news is arranged in the local index table, then only upload the content newly-increased in the concordance list that reports according to the local index table generation after upgrading.
The data query server gathers for the concordance list that reports that a plurality of data acquisition units send, and sets up respectively the centralized indexes table of each Related fields in the data query server, specifically comprises:
Step S105, data query server receive the concordance list that reports of described field that each data acquisition unit sends.
The data that the reporting of data acquisition unit comprises in the concordance list in this data acquisition unit are corresponding to the query word of described field.
Step S106, set up the mapping relations of described query word and described collector sign, form the centralized indexes table of described field.
For different fields, the data query server is set up respectively the centralized indexes table of corresponding field.For example for field 1, the query word that comprises on each data acquisition unit of meeting storage in the centralized indexes table of data query server and corresponding collector identify, and be as shown in table 4 below:
Table 4
Field 1 content |
Collector ID |
aaa |
Collector |
1 |
aaa |
Collector 2 |
bbb | Collector | 1 |
Again for example, for field 2, the centralized indexes table that the data query server is set up is as shown in table 5 below:
Table 5
Field 2 contents |
Collector ID |
ccc |
Collector |
1 |
ddd |
Collector 2 |
eee |
Collector 3 |
Corresponding each field has a centralized indexes table in the data query server, the concordance list that reports that each data acquisition unit is reported is aggregated in the centralized indexes table of data query server, namely in the centralized indexes table of the above field of data query server, store the sign of data acquisition unit and the corresponding relation that reports the query word of this field in the concordance list that described data acquisition unit reports.
After setting up concordance list, when receiving query requests, can find the data that need inquiry by concordance list.
Fig. 3 is the data enquire method process flow diagram that the present embodiment provides, and as shown in Figure 3, data enquire method of the present invention comprises:
Step S201, data query server receive the query requests of input.
The user is by the modes such as form retrieval or expression formula retrieval, input inquiry request.For the form retrieval mode, and can provide fixing field in user's the interactive interface, the user can be in the prompting frame of a plurality of fields the input inquiry word, at last by submitting to button that query requests is submitted to the data query server.For the mode of expression formula retrieval, then be that the user directly inputs the field that will inquire about and the query word of this field, submit to the data query server.
Carry the field that to inquire about and the query word of described field in the query requests that the data query server receives.
When query requests comprised a plurality of field, the query requests that the data query server receives was also carried the logical relation between the query word of each field.For example, the user is at different search field input inquiry words, and the data query server receives these logical relations between the query word of each different search field and each query word.
For example, the query requests of input is: (field 1=aaa) AND (field 2=ccc), comprise field 1 and field 2 these two fields in this query requests, its corresponding query word is respectively aaa and ccc, AND represent the logical relation between these two query words be " with " relation.
Step S202, data query server are inquired about from the centralized indexes table of described Related fields and are obtained collector sign corresponding to described query word.
When comprising field 1 in the query requests, then obtain the query word that is complementary with query word in the centralized indexes table of field 1, obtain corresponding collector sign, thereby obtain described query word at which data acquisition unit.
For example, query requests is: field 1=aaa, then inquiry obtains collector corresponding to aaa and is designated collector 1 and collector 3 from the centralized indexes table shown in the table 4.
Comprise the situation of a plurality of fields for query requests, this step specifically comprises:
Step S2021, obtain the query word of each field in the described query requests, and record the logical relation between the query word of described each field of carrying in the described query requests.
Step S2022, inquiry obtains collector sign corresponding to the query word of described each field from the centralized indexes table of described each Related fields.
Step S2023, according to the logical relation between the query word of described each field, the described collector sign screening that obtains from step S2022 inquiry is met the collector sign of described logical relation.
For example, query requests is: (field 1=aaa) AND (field 2=ccc), then inquiry obtains collector corresponding to aaa and is designated collector 1 and collector 3 from the centralized indexes table shown in the table 4, inquiry obtains collector corresponding to ccc and is designated collector 1 from the centralized indexes table shown in the table 5, logical relation between aaa and the ccc be " with ", then can filter out the collector sign that satisfies logical relation and only have collector 1.
Step S203, data query server generate the querying command that carries described field and query word according to described query requests, and described querying command is sent to data acquisition unit corresponding to described collector sign.
The querying command that the data query server generates can be identical with the query requests of input, also can include only the query word that the destination data collector that sends comprises.For example, query requests is: (field 1=aaa) OR (field 2=ccc), then inquiry obtains collector corresponding to aaa and is designated collector 1 and collector 3 from the centralized indexes table shown in the table 4, inquiry obtains collector corresponding to ccc and is designated collector 1 from the centralized indexes table shown in the table 5, logical relation between aaa and the ccc is "or", the querying command that sends to collector 1 is: (field 1=aaa) OR (field 2=ccc), the querying command that sends to collector 3 is: field 2=ccc.
The local index table inquiry of described data acquisition unit by described data acquisition unit obtains the data that are complementary with described query word, and concrete process is follow-up to be elaborated in conjunction with Fig. 3.
Step S204, data query server receive the described data that described data acquisition unit returns, according to Query Result and the output of the described query requests of data formation that receives.
The data query server gathers the data that receive, can but be not limited to formal output with form.
For example, for query requests be: (field 1=aaa) AND (field 2=ccc), the Query Result of output is as shown in table 6 below at last:
Table 6
Sequence number | Field | 1 |
Field 2 |
Field 3 |
2 |
aaa |
ccc |
iii |
Fig. 4 is the another data enquire method process flow diagram that the present embodiment provides, and as shown in Figure 4, data enquire method of the present invention comprises:
The querying command that step S301, data acquisition unit receive data querying server send.
Described querying command comprises the field that will inquire about of carrying in the query requests that described data query server receives and the query word of described field, alternatively, also can comprise the query word of a plurality of fields and the logical relation between the described query word.
Step S302, data acquisition unit are inquired about from the local index table of described Related fields and are obtained the data storage position that is complementary with described querying command.
For the situation of the query word that comprises a plurality of fields in the querying command, this step specifically comprises:
The query word of each field in the querying command that step S3021, data acquisition unit obtaining step S301 receive, and record logical relation between the query word of each field of carrying in the described querying command.
Step S3022, data acquisition unit are inquired about from the local index table of described each Related fields and are obtained the data storage position that the query word with described each field is complementary.
For example, querying command is: (field 1=aaa) OR (field 2=ccc), and then inquiring about in the local index table of field 1 and obtaining memory location corresponding to data is 2, inquiring about in the local index table of field 2 and obtaining memory location corresponding to data also is 2.
Step S3023, data acquisition unit are according to the logical relation between the query word of described each field, and screening is met the data storage position of described logical relation from the described data storage position that inquiry obtains.
Data acquisition unit screens the data storage position that is met described logical relation to the data storage position that coupling obtains according to the logical relation between the query word.
Step S303, data acquisition unit obtain described Data Concurrent and give described data query server according to described data storage position.
Data acquisition unit obtains corresponding described data according to the data storage position that step S302 obtains, and for example: can acquire the data that satisfy described querying command is:
Sequence number | Field | 1 |
Field 2 |
Field 3 |
2 |
aaa |
ccc |
iii |
Data acquisition unit sends to the data query server with described data, gathers the Query Result of exporting described query requests in order to the data query server.
The data enquire method that the present embodiment provides, by in data acquisition unit and data query server, setting up respectively local index table and centralized indexes table, when data query, centralized indexes table by corresponding field finds collector sign corresponding to query word, thereby in data acquisition unit corresponding to collector sign, obtain corresponding data, the system resource that can effectively alleviate like this data query server and data acquisition unit takies, make data acquisition unit can have more resource to be used for improving the performance that gathers, improve the processing speed of data query.
More than be the detailed description that data enquire method provided by the present invention is carried out, the below is described in detail data query system provided by the invention.
Embodiment two
Fig. 5 is the schematic diagram of the data query system that provides of the present embodiment, and as shown in Figure 5, the data query system of the embodiment of the invention comprises: data query server 10 and data acquisition unit 20.Wherein, data acquisition unit 20 is responsible for data acquisitions, comprises reception, format, merger, and data storage is also set up index to the data of storage.Data query server 10 is used for the content of storage on a plurality of data acquisition units 20 is carried out unified management, and as the unified entrance of data query.
Fig. 6 is the data query server 10 that provides of the present embodiment and the schematic diagram of data acquisition unit 20, as shown in Figure 6, data query server 10 comprises the first indexing units 100, the first receiving element 101, the first query unit 102, the first processing unit 103 and the first output unit 104.
Data acquisition unit 20 comprises the second indexing units 200, the second receiving element 201, the second query unit 202 and the second processing unit 203.
Before the inquiry of carrying out daily record data, data acquisition unit 20 and data query server 10 need in advance the data of having stored in the system to be set up index, usually finish when data are stored, and carry out the inquiry of data in order to system according to the concordance list of setting up.Data query server 10 utilizes the first indexing units 100 for each described field, sets up the centralized indexes table of described field.Data acquisition unit 20 utilizes the second indexing units 200 to set up the local index table of field.
The local index table is used for the index of the daily record data of storage current data collector, and its effect is: when providing querying condition, can find the concrete memory location of qualified all daily records in the local data.The centralized indexes table is used for storing the index of data to be checked and collector sign, its effect is: when providing querying condition, can find data to be checked and may be stored on which data acquisition unit, provide the identification information of the data acquisition unit that stores data to be checked in the centralized indexes table.
Wherein, the second indexing units 200 comprises and obtains subelement 2001, the second index subelement 2002, the 3rd index subelement 2003 and send subelement 2004.
Obtain subelement 2001 for the data and the described data storage position that obtain the current data collector, comprise the content of at least one field in the described data.
The data of storing in the data acquisition unit alternatively, are the original log data that Log Source reports.After Log Source reported original log data to data collector, data acquisition unit also needed to build local index for the original log data.
Data acquisition unit formats with merger the original log data and processes, the original log data are treated to the form (being the every line item in the log sheet) of every record in the log sheet, each log sheet may have a plurality of fields, as shown in table 1, this log sheet comprises the fields such as field 1 and field 2, and sequence number represents the data storage position.
The second index subelement 2002 is used for for each field, with described data at the content of this field query word as described data, set up the mapping relations of described query word and described memory location, form this field at the local index table of described current data collector.
In the local index of data acquisition unit 20, each field for every record in the log sheet is set up respectively the local index table, and the data of certain field contents and certain field contents that contains described appointment are at the stored position information of log sheet in the log sheet of the corresponding appointment of each concordance list.Wherein, field contents is as the query word of corresponding data.The mapping relations of described query word and described memory location can but be not limited to adopt the form of form to represent, as shown in table 2.
Local index table by corresponding field can find the particular location of data on this data acquisition unit rapidly.For example, the particular location of field 1 certain content, then according to the local index table of field 1, can find fast corresponding position.
The 3rd index subelement 2003 is used for extracting described query word from the local index table of this field, and described query word is gone heavily to process, form described current data collector described field report concordance list.
Data acquisition unit extracts the concordance list that reports that reports according to the local index table of field.Report the concrete original log position that has not had each index content corresponding in the concordance list, and only have each data to content that should field, i.e. query word.Usually before reporting, also can go heavily to process to query word, make the not duplicate contents of each field that reports.For example have two aaa and a bbb in the table 2 in the field 1, after the past heavily processes, report and only have an aaa and a bbb in the concordance list, as shown in table 3.
For the query word that extracts in the newly-increased local index table, itself and the concordance list that reports that has reported are compared, if query word is identical, then do not add reporting in the concordance list to, only upload the newly-increased unduplicated concordance list that reports.
Send subelement 2004 and be used for the concordance list that reports of described field is sent to the first indexing units 100 of data query server 10, set up the centralized indexes table of described field in order to described data query server.
The first indexing units 100 comprises that first receives subelement 1001 and the first index subelement 1002.
First receives subelement 1001 for the concordance list that reports of the described field that receives each data acquisition unit transmission.Described reporting comprises in the concordance list that the data that send in the data acquisition unit report concordance list are corresponding to the query word of described field.
The first index subelement 1002 is used for setting up the mapping relations of described query word and described collector sign, forms the centralized indexes table of described field.
The first index subelement 1002 is set up respectively the centralized indexes table of corresponding field for different fields.For example for field 1, the query word that comprises on each data acquisition unit of meeting storage in the centralized indexes table and corresponding collector identify, and be as shown in table 4.
The first index subelement 1002 corresponding each field are set up a centralized indexes table, and the concordance list that reports that each data acquisition unit reports is aggregated in the centralized indexes table of data query server.
After in data query server 10 and data acquisition unit 20, setting up concordance list respectively by the first indexing units 100 and the second indexing units 200, when receiving query requests, can find the data that need inquiry by concordance list.
The first receiving element 101 is used for receiving the query requests of input.
The user is by the modes such as form retrieval or expression formula retrieval, input inquiry request.For the form retrieval mode, and can provide fixing field in user's the interactive interface, the user can be in the prompting frame of a plurality of fields the input inquiry word, at last by submitting to button that query requests is submitted to the data query server.For the mode of expression formula retrieval, then be that the user directly inputs the field that will inquire about and the query word of this field, submit to the data query server.
Carry the field that to inquire about and the query word of described field in the query requests that the first receiving element 101 receives.
When query requests comprised a plurality of field, the query requests that the first receiving element 101 receives also comprised the logical relation between the query word of each field.For example, the user is at different search field input inquiry words, and the first receiving element 101 receives these in the query word of each different search field and the logical relation between each query word.
The first query unit 102 is used for the centralized indexes table from described field, and inquiry obtains collector sign corresponding to query word that described query requests that the first receiving element 101 receives is carried.
When comprising field 1 in the query requests, 102 of the first query unit obtain the query word that is complementary with query word from the centralized indexes table of field 1, obtain corresponding collector sign, thereby obtain described query word at which data acquisition unit.
The situation that comprises a plurality of fields for query requests, the first query unit 102 comprises: resolve subelement, the first inquiry subelement and the first filtration subelement (not shown).
First resolves subelement is used for obtaining the query word of described each field of query requests, and records the logical relation between the query word of described each field.
The first inquiry subelement is used for obtaining the described first collector sign corresponding to query word of resolving described each field that subelement obtains from the centralized indexes table inquiry of described Related fields.
First filters subelement, is used for the logical relation of resolving between the query word of described each field that subelement obtains according to described first, and the described collector sign screening that obtains from the first inquiry subelement inquiry is met the collector sign of described logical relation.
The first processing unit 103 is used for generating the querying command that carries described field and query word according to described query requests, and described querying command is sent to data acquisition unit 20 corresponding to collector sign that 102 inquiries of the first query unit obtain.
The querying command that the first processing unit 103 generates can be identical with the query requests of input, also can include only the query word that the destination data collector that sends comprises.For example, query requests is: (field 1=aaa) OR (field 2=ccc), then the first query unit 102 is inquired about from the centralized indexes table shown in the table 4 and is obtained collector corresponding to aaa and be designated collector 1 and collector 3, the first query unit 102 is inquired about from the centralized indexes table shown in the table 5 and is obtained collector corresponding to ccc and be designated collector 1, logical relation between aaa and the ccc is "or", the first processing unit 103 generates the querying command that sends to collector 1: (field 1=aaa) OR (field 2=ccc), the first processing unit 103 generate the querying command that sends to collector 3 and are: field 2=ccc.
The second receiving element 201 of data acquisition unit 20 is used for the querying command that receive data querying server 10 sends.
Described querying command comprises the field that will inquire about of carrying in the query requests that data query server 10 receives and the query word of described field, can comprise the query word of a plurality of fields and the logical relation between the described query word.
The second query unit 202 is used for the data storage position that the query word from the querying command that the local index table inquiry of described Related fields obtains receiving with the second receiving element 201 is complementary.
Alternatively, for the situation of the query word that comprises a plurality of fields in the querying command, the second query unit 202 comprises: second resolves subelement, the second inquiry subelement and the second filtration subelement (not shown).
When if the described querying command that the second parsing subelement receives for the second receiving element 201 carries a plurality of field that will inquire about, obtain the query word of each field in the described querying command, and record the logical relation between the query word of each field of carrying in the described querying command.
The data storage position that the query word of each field is complementary the described querying command that the second inquiry subelement obtains obtaining with described the second parsing subelement for the local index table inquiry from described each Related fields.
Second filters subelement for the logical relation between the query word of described each field of obtaining according to described the second parsing subelement, and screening is met the data storage position of described logical relation from the described data storage position that described the second inquiry subelement inquiry obtains.
The second processing unit 203 is used for the described data storage position that 202 inquiries obtain according to the second query unit, obtains described Data Concurrent and gives described data query server.
The data that the second processing unit 203 obtains 202 inquiries of the second query unit send to the first output unit 104 of data query server 10, in order to export the Query Result of described query requests.
The described data that the second processing unit 203 that the first output unit 104 is used for receive data collector 20 returns are according to Query Result and the output of the described query requests of data formation that receives.
Data query server, data acquisition unit and system that the embodiment of the invention provides, utilize the first indexing units in the data query server, to set up the centralized indexes table, utilize the second indexing units in data acquisition unit, to set up the local index table, can improve the processing speed of data query.The situation that only is present in the minority data acquisition unit for data to be checked, the present invention need not every number of units go inquiry according to collector, has reduced the burden of data acquisition unit.Log system for the frequent inquiry of needs, the system resource that the scheme that the embodiment of the invention provides can effectively alleviate data acquisition unit takies, make data acquisition unit can have more resource to be used for improving the performance that gathers, thus the processing power of elevator system integral body.
Embodiment three
The schematic diagram of the data query server 10 that Fig. 7 provides for the present embodiment, as shown in Figure 7, described data query server 10 comprises: network interface 71, processor 72 and storer 73.System bus 74 is used for interconnection network interface 71, processor 72 and storer 73.
Network interface 71 is used for communicating with data acquisition unit 20.
Storer 73 can be permanent storage, and for example hard disk drive and flash memory have software module and device driver in the storer 73.Software module can be carried out the various functional modules of said method of the present invention; Device driver can be network and interface drive program.
When starting, these component softwares are loaded in the storer 73, are then accessed and carry out as giving an order by processor 72:
Receive the query requests of input, carry the field that to inquire about and the query word in the described field in the described query requests;
Inquiry obtains collector sign corresponding to described query word, the corresponding relation of the query word in the described centralized indexes table in the described field of storage and collector sign from the centralized indexes table of described Related fields;
Generate the querying command that carries described field and query word according to described query requests, and described querying command sent to data acquisition unit corresponding to described collector sign, the local index table inquiry of the Related fields that carries by querying command described in the described data acquisition unit in order to described data acquisition unit obtain with described querying command in the data that are complementary of the query word that carries;
Receive the described data that described data acquisition unit returns, according to Query Result and the output of the described query requests of data formation that receives.
The data query server of the present embodiment finds collector sign corresponding to query word by the centralized indexes table of field, thereby in data acquisition unit corresponding to collector sign, obtain corresponding data, the system resource that can effectively alleviate the data query server takies, and improves the processing speed of data query.
Further, behind the component software of described processor access storer 73, carry out the instruction of following process:
For described field, set up the centralized indexes table of described Related fields;
The described centralized indexes table of setting up described Related fields comprises:
Receive the concordance list that reports of described field that each data acquisition unit sends, described reporting comprises in the concordance list that the data that send in the described data acquisition unit that reports concordance list are corresponding to the query word of described field;
Set up the mapping relations of described query word and described collector sign, form the centralized indexes table of described field.
Above-mentioned instruction process is exactly the process that the data query server is set up the centralized indexes table, by setting up the mapping relations of query word and collector sign, so that when data query, find collector corresponding to query word sign, and the data that obtain mating from the data acquisition unit of correspondence.
Further, behind the component software of described processor access storer 73, carry out the instruction of following process:
When carrying at least two fields that will inquire about in the described query requests, obtain the query word of each field in the described query requests, and record the logical relation between the query word of described each field;
Inquiry obtains the collector sign corresponding to query word of described each field from the centralized indexes table of described each Related fields;
According to the logical relation between the query word of described each field, screen the collector sign that is met described logical relation from the described collector sign that inquiry obtains.
Above-mentioned instruction process is exactly the data query server is searched corresponding collector sign for the query word of a plurality of fields that will inquire about process, can avoid accessing the data acquisition unit that can not satisfy query requests fully.
The schematic diagram of the data acquisition unit 20 that Fig. 8 provides for the present embodiment, as shown in Figure 8, described data acquisition unit 20 comprises: network interface 81, processor 82 and storer 83.System bus 84 is used for interconnection network interface 81, processor 82 and storer 83.
Network interface 81 is used for communicating with data query server 10.
Storer 83 can be permanent storage, and for example hard disk drive and flash memory have software module and device driver in the storer 83.Software module can be carried out the various functional modules of said method of the present invention; Device driver can be network and interface drive program.
When starting, these component softwares are loaded in the storer 83, are then accessed and carry out as giving an order by processor 82:
The querying command that the receive data querying server sends, described querying command comprise the field that will inquire about of carrying in the query requests that described data query server receives and the query word in the described field;
Inquiry obtains the data storage position that is complementary with described querying command from the local index table of described Related fields, the query word in the described local index table in the described field of storage and the corresponding relation of described data storage position;
According to described data storage position, obtain described Data Concurrent and give described data query server.
The data acquisition unit of the present embodiment finds data corresponding to query word by the local index table of field, offer the data query server, the system resource that can effectively alleviate data acquisition unit takies, make data acquisition unit can have more resource to be used for improving the performance that gathers, improve the processing speed of data query.
Further, behind the component software of described processor access storer 83, carry out the instruction of following process:
For described field, set up the local index table of described Related fields;
The described local index table of setting up described Related fields comprises:
Obtain data and described data storage position in the current data collector, comprise the content of at least one field in the described data;
For each field, described data at the content of this field query word as described data, are set up the mapping relations of described query word and described memory location, form this field at the local index table of described current data collector.
Above-mentioned instruction process is exactly the process that data acquisition unit is set up the local index table, by setting up the mapping relations of query word and data storage position, thus the data storage position acquisition data corresponding according to query word.
Further, behind the component software of described processor access storer 83, carry out the instruction of following process:
From the local index table of this field, extract described query word, described query word gone heavily to process, form described current data collector described field report concordance list;
The concordance list that reports of described field is sent to described data query server, set up the centralized indexes table of described Related fields in order to described data query server.
Above-mentioned instruction process is exactly that data acquisition unit is set up the process that reports concordance list and send to the data query server according to the local index table, so that the data query server is set up the centralized indexes table.
Further, behind the component software of described processor access storer 83, carry out the instruction of following process:
When carrying at least two fields that will inquire about in the described querying command, obtain the query word of each field in the described querying command, and record the logical relation between the query word of described each field;
Inquiry obtains the data storage position that the query word with described each field is complementary from the local index table of described each Related fields;
According to the logical relation between the query word of described each field, screening is met the data storage position of described logical relation from the described data storage position that inquiry obtains.
Above-mentioned instruction process is exactly data acquisition unit finds corresponding memory location for the query word of a plurality of fields that will inquire about process, can avoid obtaining the data that can not satisfy querying command fully.
The professional should further recognize, unit and the algorithm steps of each example of describing in conjunction with embodiment disclosed herein, can realize with electronic hardware, computer software or the combination of the two, for the interchangeability of hardware and software clearly is described, composition and the step of each example described in general manner according to function in the above description.These functions are carried out with hardware or software mode actually, depend on application-specific and the design constraint of technical scheme.The professional and technical personnel can specifically should be used for realizing described function with distinct methods to each, but this realization should not thought and exceeds scope of the present invention.
The method of describing in conjunction with embodiment disclosed herein or the step of algorithm can use the software module of hardware, processor execution, and perhaps the combination of the two is implemented.Software module can place the storage medium of any other form known in random access memory (RAM), internal memory, ROM (read-only memory) (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or the technical field.
Above-described embodiment; purpose of the present invention, technical scheme and beneficial effect are further described; institute is understood that; the above only is the specific embodiment of the present invention; the protection domain that is not intended to limit the present invention; within the spirit and principles in the present invention all, any modification of making, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.