WO2021087679A1 - Paging data query method and apparatus, electronic device, and storage medium - Google Patents

Paging data query method and apparatus, electronic device, and storage medium Download PDF

Info

Publication number
WO2021087679A1
WO2021087679A1 PCT/CN2019/115397 CN2019115397W WO2021087679A1 WO 2021087679 A1 WO2021087679 A1 WO 2021087679A1 CN 2019115397 W CN2019115397 W CN 2019115397W WO 2021087679 A1 WO2021087679 A1 WO 2021087679A1
Authority
WO
WIPO (PCT)
Prior art keywords
query
document identification
identification sequence
storage module
paging
Prior art date
Application number
PCT/CN2019/115397
Other languages
French (fr)
Chinese (zh)
Inventor
郭子亮
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to PCT/CN2019/115397 priority Critical patent/WO2021087679A1/en
Priority to CN201980099816.5A priority patent/CN114286995A/en
Publication of WO2021087679A1 publication Critical patent/WO2021087679A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution

Definitions

  • This application relates to the technical field of electronic equipment, and more specifically, to a method, device, electronic equipment, and storage medium for querying paging data.
  • the service system can usually be The data is stored in a sub-database and sub-table.
  • data can be obtained from the service system through paging query.
  • this application proposes a method, device, electronic equipment, and storage medium for querying paging data to solve the above-mentioned problems.
  • an embodiment of the present application provides a paging data query method, which is characterized in that it is applied to a service system of an electronic device.
  • the service system includes a query engine module, a snapshot storage module, and a data storage module.
  • the method includes :
  • the query engine module receives a paging query request, the paging query request includes a query condition and a paging condition; obtains the document identification sequence corresponding to the query condition from the snapshot storage module as the first document identification sequence;
  • the paging condition acquires a document identification sequence from the first document identification sequence as a second document identification sequence; acquires and feeds back target data corresponding to the second document identification sequence from the data storage module.
  • an embodiment of the present application provides a paging data query device, which is applied to a service system of an electronic device.
  • the service system includes a query engine module, a snapshot storage module, and a data storage module.
  • the device includes: a paging query request
  • the receiving module is used for the query engine module to receive a paging query request, the paging query request includes a query condition and a paging condition;
  • the first document identification sequence obtaining module is used for obtaining the query condition from the snapshot storage module
  • the corresponding document identification sequence is used as the first document identification sequence;
  • the second document identification sequence acquisition module is configured to acquire the document identification sequence from the first document identification sequence based on the paging condition as the second document identification sequence; target data acquisition A module for obtaining and feeding back target data corresponding to the second document identification sequence from the data storage module.
  • an embodiment of the present application provides an electronic device including a memory and a processor, the memory is coupled to the processor, the memory stores instructions, and the instructions are executed when the instructions are executed by the processor.
  • the processor executes the above method.
  • an embodiment of the present application provides a computer-readable storage medium, and the computer-readable storage medium stores program code, and the program code can be invoked by a processor to execute the foregoing method.
  • the query engine module receives the paging query request, the paging query request includes the query condition and the paging condition, and obtains the document corresponding to the query condition from the snapshot storage module
  • the identification sequence is used as the first document identification sequence, the document identification sequence is obtained from the first document identification sequence as the second document identification sequence based on the paging condition, and the target data corresponding to the second document identification sequence is obtained from the data storage module and fed back, thereby
  • the document identification sequence is stored by the snapshot storage module, and the correct document identification sequence is determined from the document identification sequence according to the query conditions and paging conditions in the paging query request, so as to improve the accuracy and efficiency of the paging query.
  • FIG. 1 shows a schematic diagram of an application environment that can be used in the paging data query method provided by the embodiments of the present application;
  • FIG. 2 shows a schematic flowchart of a method for querying paging data provided by an embodiment of the present application
  • FIG. 3 shows a schematic flowchart of a method for querying paging data according to another embodiment of the present application
  • FIG. 4 shows a schematic flowchart of step S230 of the paging data query method shown in FIG. 3 of the present application;
  • FIG. 5 shows a schematic flowchart of step S250 of the paging data query method shown in FIG. 3 of the present application
  • FIG. 6 shows a schematic flowchart of a method for querying paging data provided by still another embodiment of the present application
  • FIG. 7 shows a schematic flowchart of an embodiment of step S360 of the paging data query method shown in FIG. 6 of the present application
  • FIG. 8 shows a schematic flowchart of another embodiment of step S360 of the paging data query method shown in FIG. 6 of the present application;
  • FIG. 9 shows a schematic flowchart of still another embodiment of step S360 of the paging data query method shown in FIG. 6 of the present application.
  • FIG. 10 shows a schematic flowchart of step S362C of the paging data query method shown in FIG. 9 of the present application;
  • Fig. 11 shows a block diagram of a paging data query device provided by an embodiment of the present application
  • FIG. 12 shows a block diagram of an electronic device used to execute the method for querying paging data according to an embodiment of the present application
  • FIG. 13 shows a storage unit for storing or carrying program code for implementing the method for querying paging data according to the embodiment of the present application according to an embodiment of the present application.
  • the service system when obtaining data from the service system through paging query, users request data from the service system according to the filter conditions, and the service system generates paging query expression statements that the storage system can understand according to the filter conditions. If the storage system is Mysql, then The query expression can be a SQL statement. The storage system runs the SQL statement to obtain the paged data and returns it to the service system. Finally, the service system returns the paged data to the user to complete a paged query.
  • U (d 1 ,d 2 ,d 3 ,...,d 10 )
  • the inventor has discovered through long-term research, and proposed the paging data query method, device, electronic device, and storage medium provided by the embodiments of this application.
  • the document identification sequence is stored through the snapshot storage module, and the document identification sequence is stored according to the paging query request.
  • the query condition and the paging condition determine the correct document identification sequence from the document identification sequence to improve the accuracy and efficiency of the paging query.
  • the specific paging data query method will be described in detail in the subsequent embodiments.
  • the following describes a schematic diagram of an environment that can be used in the paging data query method provided in the embodiments of the present application.
  • FIG. 1 shows a schematic diagram of an application environment that can be used for the paging data query method provided by the embodiments of the present application. It includes an electronic device (server) 100 and a user terminal 200, and the electronic device 100 and the user terminal 200 are in communication connection to implement data interaction. For example, the user terminal 200 may send a paging query request to the electronic device 100. Wherein, the electronic device 100 and the user terminal 200 can be connected via a data network or a wireless network.
  • the electronic device 100 and the user terminal 200 When the electronic device 100 and the user terminal 200 are connected via a data network, the electronic device 100 and the user terminal 200 can be connected via a 2G network, a 3G network, a 4G network, When the electronic device 100 and the user terminal 200 are connected through a wireless network, the electronic device 100 and the user terminal 200 can be connected through a wireless fidelity WiFi network, which is not limited here.
  • the electronic device 100 may be a tablet computer, a desktop computer, a server, etc.
  • the user terminal 200 may be a smart phone, a tablet computer, a wearable electronic device, etc., which are not limited herein.
  • the electronic device 100 may be loaded with a service system, and the service system may include a query engine module, a snapshot storage module, and a data storage module.
  • the service system may include a query engine module, a snapshot storage module, and a data storage module.
  • the query engine module can be responsible for the user to receive the paging query request sent by the user through the user terminal, and adaptively go to the data storage module or the snapshot storage module to query the document data and finally return it to the user terminal.
  • the query engine module can have the following functions: (1) Responsible for receiving a paged query request sent by a user through a user terminal, and can generate a unique paged query state according to the paged query condition and the user ID in the paged query request; 2) According to the paging query status, it can be judged whether the data corresponding to the paging query status is directly obtained from the data storage module, or the document identification sequence is obtained from the snapshot storage module and then obtained from the data storage module; (3) It can be generated according to the paging query status
  • the data storage module can understand query expressions and request data from the data storage module.
  • the snapshot storage module is used to store the document identification sequence corresponding to each paged query state.
  • the storage mode uses computer memory for storage to ensure the efficiency of data query.
  • the snapshot storage module may have the following functions: (1) It can store data in the memory in the form of (key, value), that is, the corresponding document identification sequence can be obtained according to each page query state; (2) Support to specify the data expiration time according to the key, and the data will be automatically cleared after the time expires, thereby avoiding insufficient computer memory; (3) Supporting persistent storage of the data in the memory to the disk storage to avoid downtime of the machine where the snapshot storage module is located After the data is dropped.
  • the data storage module is used to persistently store the document content of the user query data.
  • the data storage module may have the following functions: (1) have a fixed query logic expression; (2) support querying data in a paging query mode; (3) support establishing an index based on a certain field of the data.
  • FIG. 2 shows a schematic flowchart of a method for querying paging data provided by an embodiment of the present application.
  • the paging data query method is used to store the document identification sequence through the snapshot storage module, and determine the correct document identification sequence from the document identification sequence according to the query conditions and the paging conditions in the paging query request, so as to improve the accuracy and efficiency of the paging query .
  • the paging data query method is applied to the paging data query device 300 as shown in FIG. 11 and the electronic device 100 equipped with the paging data query device 300 (FIG. 12 ). The following will take an electronic device as an example to describe the specific process of this embodiment.
  • the electronic device applied in this embodiment may be a server, a tablet computer, a desktop computer, etc., which is not limited here.
  • the process shown in Figure 2 will be described in detail below.
  • the electronic device is loaded with a service system.
  • the service system shown includes a query engine module, a snapshot storage module, and a data storage module.
  • the paging data query method may specifically include the following steps:
  • Step S110 The query engine module receives a paging query request, where the paging query request includes a query condition and a paging condition.
  • the query engine module may receive a paged query request sent by a user through the user terminal, where the received paged query request may carry query conditions and paging conditions.
  • the query condition and the paging condition carried by the paging query condition may be pre-configured by the user terminal, or manually configured by the user.
  • the size in the paging condition can be pre-configured with a default value by the user terminal.
  • the default value of the size can be pre-configured by the user terminal.
  • the size in the paging condition can also be configured by the user according to preferences or habits, such as when the user prefers When the number of data displayed on a page is 3, you can manually configure the size in the paging condition to 3, which is not limited here.
  • the paging query request may be generated and sent to the query engine module when the user terminal receives a specified voice input, or may be generated and sent to the query engine module when the user terminal receives a specified touch operation, where Not limited.
  • Step S120 Obtain the document identification sequence corresponding to the query condition from the snapshot storage module as the first document identification sequence.
  • the query engine module may analyze the paging query request, and extract the query conditions carried in the paging query request from the paging query request based on the analysis of the paging query request, and then based on the The query condition acquires the document identification sequence corresponding to the query condition from the snapshot storage module, and uses the acquired document identification sequence corresponding to the query condition as the first document identification sequence.
  • the snapshot storage module can obtain and record multiple query conditions and multiple document identification sequences in advance, and establish a mapping relationship between multiple query conditions and multiple document identification sequences, where the mapping relationship may be multiple One query condition corresponds to multiple document identification sequences, as shown in Table 1.
  • the query engine module when the query engine module obtains the query conditions, it can compare the obtained query conditions with multiple query conditions in the pre-established mapping relationship to obtain the query conditions that match the obtained query conditions, and then based on the mapping The relationship acquires the document identification sequence corresponding to the query condition that matches the acquired query condition.
  • the document identification sequence may be determined as the first document identification sequence .
  • Step S130 Obtain a document identification sequence from the first document identification sequence as a second document identification sequence based on the paging condition.
  • the query engine module may analyze the paging query request, and extract the paging condition carried by the paging query request from the paging query request based on the analysis of the paging query request, and then based on the paging The condition acquires the document identification sequence corresponding to the paging condition from the first document identification sequence, and uses the acquired document identification sequence corresponding to the paging condition as the second document identification sequence.
  • Step S140 Obtain and feed back target data corresponding to the second document identification sequence from the data storage module.
  • the query engine module may acquire target data corresponding to the second document identification sequence from the data storage module based on the second document identification sequence, and feed back the acquired target data To the user terminal to complete a query and feedback of paging data.
  • Corresponding target data and feedback the acquired target data to the user terminal.
  • a query engine module receives a paging query request, the paging query request includes a query condition and a paging condition, and a document identification sequence corresponding to the query condition is obtained from the snapshot storage module as the first document identification Sequence, obtain the document identification sequence from the first document identification sequence as the second document identification sequence based on the paging condition, obtain and feed back the target data corresponding to the second document identification sequence from the data storage module, thereby storing the document identification through the snapshot storage module Sequence, and determine the correct document identification sequence from the document identification sequence according to the query conditions and paging conditions in the paged query request, so as to improve the accuracy and efficiency of the paged query.
  • FIG. 3 shows a schematic flowchart of a method for querying paging data according to another embodiment of the present application.
  • This method is applied to the above-mentioned electronic equipment, and the electronic equipment is loaded with a service system.
  • the service system shown includes a query engine module, a snapshot storage module, and a data storage module. The following will describe the process shown in FIG. 3 in detail.
  • the paging data query method may specifically include the following steps:
  • Step S210 The query engine module receives a paging query request, and the paging query request includes a query condition and a paging condition.
  • step S210 For the specific description of step S210, please refer to step S110, which will not be repeated here.
  • Step S220 Generate a query status identifier based on the query condition.
  • the query engine module can generate a query status identifier based on the query conditions, where the query status identifier is used to identify the paged query record of the user, for example, the query status The identifier is used to identify whether the user has performed a paged query based on the query condition, and whether the user obtains the document identification sequence from the snapshot storage module or directly obtains the data from the data storage module when the user performs a paged query based on the query condition, etc., which is not limited here.
  • the query engine module can analyze the paged query request after receiving the paged query request, and extract the paged query request from the paged query request based on the analysis of the paged query request for uniquely identifying the user.
  • the user identifier is then generated based on the user identifier and the query conditions, and the query status identifier generated uniquely corresponds to the user corresponding to the user identifier.
  • Step S230 Obtain the document identification sequence corresponding to the query status identification from the snapshot storage module as the first document identification sequence.
  • the snapshot storage module can obtain and record multiple query status identifiers and multiple document identifier sequences in advance, and establish a mapping relationship between multiple query status identifiers and multiple document identifier sequences, where the mapping relationship can be There is a one-to-one correspondence between multiple query status identifiers and multiple document identifier sequences, as shown in Table 2.
  • the query engine module when the query engine module obtains the query status identifier, it can compare the acquired query status identifier with multiple query status identifiers in the pre-established mapping relationship to obtain a query status that matches the acquired query status identifier. Identification, and then obtain the document identification sequence corresponding to the query state identifier that matches the acquired query state identifier based on the mapping relationship.
  • the document can be The identification sequence is determined as the first document identification sequence.
  • FIG. 4 shows a schematic flow chart of step S230 of the paging data query method shown in FIG. 3 of the present application.
  • the flow shown in FIG. 4 will be described in detail below.
  • the method may specifically include the following step:
  • Step S231 Determine whether the snapshot storage module satisfies a specified condition based on the query status identifier.
  • the electronic device may preset and store a designated condition, and the designated condition is used as a judgment basis for the snapshot storage module. Therefore, the snapshot storage module can be compared with the specified condition to determine whether the snapshot storage module meets the specified condition.
  • the query status identifier can be used as a parameter for judging whether the snapshot storage module meets the specified condition, that is, it can be based on Query the status flag to determine whether the snapshot storage module meets the specified conditions.
  • Step S232 When the snapshot storage module satisfies the specified condition, obtain the document identification sequence corresponding to the query status identification from the snapshot storage module as the first document identification sequence.
  • the document identification sequence corresponding to the query status identification can be obtained from the snapshot storage module, and the obtained document identification sequence is used as the first document identification sequence.
  • the data corresponding to the paging query request can be directly searched from the data storage module, and the searched data is fed back to the user terminal.
  • Step S240 Acquire a document identification sequence from the first document identification sequence as a second document identification sequence based on the paging condition.
  • step S240 please refer to step S130, which will not be repeated here.
  • Step S250 Generate a query sentence matching the data storage module based on the second document identification sequence.
  • different data storage modules can recognize different query statements. For example, if the data storage module is Mysql, then the query statements that can be recognized by the data storage module are SQL. Therefore, in this embodiment, when the second document identification sequence is obtained, a query sentence matching the data storage module can be generated based on the second document identification sequence. It can be understood that the query sentence can be recognized by the data storage module, and The query sentence may be used to instruct the data storage module to query and feed back the target data corresponding to the second document identification sequence.
  • FIG. 5 shows a schematic flow chart of step S250 of the method for querying paging data shown in FIG. 3 of the present application.
  • the flow shown in FIG. 5 will be described in detail below.
  • the method may specifically include the following step:
  • Step S251 Determine the sentence format supported by the data storage module.
  • the sentence format supported by the data storage module may be determined first, that is, the sentence format understood by the data storage module may be determined first.
  • the attribute information of the data storage module can be obtained, and the sentence format supported by the data storage module can be determined based on the data information of the data storage module. For example, if the attribute information of the data storage module is Mysql, it can be determined that the statement format supported by the data storage module is SQL.
  • Step S252 Generate the query sentence based on the second document identification sequence, and the format of the query sentence is consistent with the sentence format supported by the data storage module.
  • the format of the generated query sentence may be consistent with the sentence format supported by the data storage module to It is ensured that the query statement generated based on the second document identification sequence can be identified by the data storage module.
  • Step S260 Obtain and feed back target data corresponding to the second document identification sequence from the data storage module based on the query sentence.
  • the query engine module can send the query sentence to the data storage module to obtain the target data corresponding to the second document identification sequence from the data storage module based on the query sentence, and the target data The data is fed back to the user terminal.
  • the query engine module receives the paging query request, the paging query request includes the query condition and the paging condition, generates the query status identifier based on the query conditions, and obtains the query status identifier corresponding to the query status identifier from the snapshot storage module
  • the document identification sequence of is used as the first document identification sequence, the document identification sequence is obtained from the first document identification sequence based on the paging condition as the second document identification sequence, and the query sentence matching the data storage module is generated based on the second document identification sequence,
  • the target data corresponding to the second document identification sequence is obtained from the data storage module based on the query sentence and fed back.
  • this embodiment also generates a query status identifier based on query conditions, and obtains the corresponding document identifier sequence from the snapshot storage module based on the query status identifier, so as to improve the accuracy of obtaining the document identifier sequence. Sex.
  • FIG. 6 shows a schematic flowchart of a method for querying paging data according to another embodiment of the present application.
  • the method is applied to the above-mentioned electronic equipment, and the electronic equipment is loaded with a service system.
  • the service system shown includes a query engine module, a snapshot storage module, and a data storage module.
  • the flow shown in FIG. 6 will be described in detail below.
  • the paging data query method may specifically include the following steps:
  • Step S310 The query engine module receives a paging query request, and the paging query request includes a query condition and a paging condition.
  • Step S320 Generate a query status identifier based on the query condition.
  • step S310-step S320 please refer to step S210-step S220, which will not be repeated here.
  • Step S330 Determine whether the snapshot storage module includes a document identification sequence corresponding to the query status identification.
  • the query engine module can determine whether the snapshot storage module includes a document identifier sequence corresponding to the query status identifier. In some implementations, after obtaining the query status identifier, the query engine module may compare the query status identifier with multiple query status identifiers in the pre-established preset relationship to determine whether the preset mapping relationship includes and acquired The query status identifier is consistent with the query status identifier.
  • the judgment result indicates that the preset mapping relationship does not include the query status identifier consistent with the acquired query status identifier
  • the judgment result indicates that the preset mapping relationship includes a query state identifier that is consistent with the acquired query state identifier, it can continue to determine whether there is a document identification sequence corresponding to the query state identifier that is consistent with the acquired query state identifier in the mapping relationship.
  • the snapshot storage module does not include the document identification sequence corresponding to the query state identifier.
  • the judgment result is represented in the There is a document identification sequence corresponding to the query state identifier that is consistent with the acquired query state identifier in the mapping relationship, and it can be determined that the snapshot storage module includes the document identification sequence corresponding to the query state identifier.
  • Step S340 When the snapshot storage module includes the document identification sequence corresponding to the query status identifier, obtain the document identification sequence corresponding to the query status identifier from the snapshot storage module as the first document identification sequence.
  • the characterization may obtain the document identification sequence from the snapshot storage module to improve the accuracy of the requested data acquisition. Therefore, in this embodiment, when the judgment result indicates that the snapshot storage module includes a document identification sequence corresponding to the query status identifier, the document identification sequence corresponding to the query status identifier can be obtained from the snapshot storage module, and the acquired document The identification sequence serves as the first document identification sequence.
  • Step S350 when the snapshot storage module does not include the document identification sequence corresponding to the query status identifier, obtain the document identification sequence under the query status identifier as a third document identification sequence based on the query condition;
  • the characterization cannot obtain the document identification sequence from the snapshot storage module. Therefore, in this embodiment, when the judgment result indicates that the snapshot storage module does not include the document identification sequence corresponding to the query status identifier, the data corresponding to the paging query request can be directly searched from the data storage module, and the query will be based on the analysis. Request the data obtained from the data storage module to be fed back to the user terminal.
  • the characterization snapshot storage module when the judgment result characterizes that the snapshot storage module does not include the document identification sequence corresponding to the query state identifier, the characterization snapshot storage module does not include the query state identifier or does not include the document identifier corresponding to the query state identifier. sequence. Therefore, in this embodiment, when the judgment result indicates that the snapshot storage module does not include the document identification sequence corresponding to the query status identification, the document identification sequence can be obtained based on the query condition, and the obtained document identification sequence can be used as the third document identification. Sequence, it is understandable that the third document identification sequence corresponds to the query status identifier corresponding to the query condition, and further, the third document identification sequence may also correspond to the query status identifier corresponding to the query condition and the user identifier.
  • Step S360 Write the third document identification sequence into the snapshot storage module.
  • the third document identification sequence may be written into the snapshot storage module to record the third document identification sequence corresponding to the query condition in the snapshot storage module.
  • FIG. 7 shows a schematic flow chart of an embodiment of step S360 of the method for querying paging data shown in FIG. 6 of the present application.
  • the flow shown in FIG. 8 will be described in detail below. Specifically, it can include the following steps:
  • Step S361A Establish a mapping relationship between the query status identifier and the third document identifier sequence.
  • the query engine module may establish a mapping relationship between the query status identifier and the third document identifier sequence. For example, the query status identifier and the third document identifier sequence may be established.
  • the key-value pair relationship between document identification sequences, etc., is not limited here.
  • Step S362A Write the mapping relationship into the snapshot storage module.
  • the mapping relationship may be written into the snapshot storage module, so as to subsequently query and obtain the document identification sequence based on the query status identification.
  • the mapping relationship is a key-value pair relationship between the query status identifier and the third document identifier sequence
  • the query status identifier and the third document identifier sequence may be written into the snapshot storage module in a (key, value) manner.
  • the query status identifier is T
  • the query state identifier T and the third document identifier sequence L (k 1 , k 2 , k 3 ,..., k n ) Write the snapshot storage module in (key, value) mode.
  • FIG. 8 shows a schematic flow chart of another embodiment of step S360 of the method for querying paging data shown in FIG. 6 of the present application.
  • the flow shown in FIG. 8 will be described in detail below.
  • the method can specifically include the following steps:
  • Step S361B Write the third document identification sequence into the snapshot storage module and configure the expiration time of the third document identification sequence.
  • the query causing module may configure the expiration time of the third document identification sequence while writing the third document identification sequence to the snapshot storage module.
  • the expiration time may be the default time value of the electronic device, or may be a time value manually configured by the user, which is not limited here.
  • Step S362B Detect the length of time the third document identification sequence is written into the snapshot storage module.
  • the length of time the third document identification sequence is written into the snapshot storage module may be detected.
  • a timer can be started to detect the length of time the third document identification sequence is written into the snapshot storage module through the timer.
  • Step S363B When the duration meets the expiration time, clear the third document identification sequence from the snapshot storage module.
  • the third document identification sequence when it is detected that the duration of writing the third document identification sequence into the snapshot storage module meets the expiration time, the third document identification sequence can be automatically cleared from the snapshot storage module, thereby avoiding the problem of insufficient memory of the electronic device.
  • FIG. 9 shows a schematic flowchart of another embodiment of step S360 of the paging data query method shown in FIG. 6 of the present application. The following will describe the flow shown in FIG. 9 in detail.
  • the method can specifically include the following steps:
  • Step S361C Write the third document identification sequence into the snapshot storage module and store it in the memory of the electronic device.
  • the data in the snapshot storage module can be stored using the memory of the electronic device, thereby ensuring the efficiency of data query. Therefore, in this embodiment, the third document identification sequence can be written into the snapshot storage module and stored in the memory of the electronic device.
  • the mapping relationship between the third document identification sequence and the query status identification can also be stored in the memory of the electronic device, which is not limited here.
  • Step S362C Transfer the third document identification sequence from the internal memory of the electronic device to the magnetic disk of the electronic device for persistent storage.
  • the third document identification sequence stored in the memory of the electronic device can also be transferred from the memory of the electronic device to the disk of the electronic device for persistent storage.
  • FIG. 10 shows a schematic flow chart of step S362C of the method for querying paging data shown in FIG. 9 of the present application.
  • the flow shown in FIG. 10 will be described in detail below.
  • the method may specifically include the following step:
  • Step S362C1 Monitoring the remaining storage capacity of the internal memory of the electronic device.
  • the remaining storage capacity of the memory of the electronic device can be monitored.
  • the remaining storage amount of the memory of the electronic device can be obtained by detecting the memory usage of the electronic device, and based on the memory usage and the total storage amount of the memory of the electronic device.
  • Step S362C2 When the remaining storage capacity is less than the designated storage capacity, transfer the third document identification sequence from the internal memory of the electronic device to the magnetic disk of the electronic device for persistent storage.
  • the electronic device may be preset and stored with a designated storage amount, and the designated storage amount is used as a judgment basis for the remaining storage amount of the internal memory of the electronic device. Therefore, in this embodiment, when the remaining storage capacity of the internal memory of the electronic device is monitored, the remaining storage capacity can be compared with the specified storage capacity to determine whether the remaining storage capacity is less than the specified storage capacity, where, when the remaining storage capacity is When it is less than the designated storage capacity, it indicates that the memory of the electronic device is insufficient, and the third document identification sequence can be transferred from the memory of the electronic device to the disk of the electronic device for persistent storage, and the third document identification sequence stored in the memory of the electronic device can be cleared , In order to release the memory of the electronic device and avoid the loss of the third document identification sequence caused by the snapshot storage module when the electronic device is down. When the remaining storage capacity is not less than the designated storage capacity, it indicates that the memory of the electronic device is sufficient, and the third document identification sequence can be stored in the memory of the electronic device to ensure the efficiency of data query.
  • Step S370 Obtain a document identification sequence from the first document identification sequence as a second document identification sequence based on the paging condition.
  • Step S380 Generate a query sentence matching the data storage module based on the second document identification sequence.
  • Step S390 Obtain and feed back target data corresponding to the second document identification sequence from the data storage module based on the query sentence.
  • step S370-step S390 please refer to step S240-step S260, which will not be repeated here.
  • the query engine module receives the paging query request, the paging query request includes the query condition and the paging condition, generates the query status identifier based on the query conditions, and determines whether the snapshot storage module includes the query status identifier
  • the document identification sequence corresponding to the query status identification is obtained from the snapshot storage module as the first document identification sequence
  • the document identification sequence is obtained from the first document identification sequence based on the paging condition as the second document Identification sequence, based on the second document identification sequence to generate a query statement matching the data storage module, and based on the query statement to obtain the target data corresponding to the second document identification sequence from the data storage module and feedback, when not included, obtain based on the query conditions
  • the document identification sequence under the query status identification is used as the third document identification sequence, and the third document identification sequence is written into the snapshot storage module.
  • this embodiment also generates a query status identifier based on query conditions, and includes a document identifier sequence corresponding to the query status identifier and does not include a document corresponding to the query status identifier for the snapshot storage module.
  • the identification sequence different processing is performed to improve the accuracy and efficiency of obtaining the document identification sequence.
  • FIG. 11 shows a block diagram of a paging data query device 300 provided by an embodiment of the present application.
  • the paging data query device 300 is applied to the above-mentioned electronic equipment, and the electronic equipment is loaded with a service system.
  • the service system shown includes a query engine module, a snapshot storage module, and a data storage module.
  • the following will describe the block diagram shown in FIG. 11.
  • the paging data query device 300 includes: a paging query request receiving module 310, a first document identification sequence acquisition module 320, a second document identification sequence acquisition module 330, and a target data acquisition module 340, wherein:
  • the paging query request receiving module 310 is configured to receive the paging query request by the query engine module, where the paging query request includes a query condition and a paging condition.
  • the first document identification sequence acquisition module 320 is configured to acquire the document identification sequence corresponding to the query condition from the snapshot storage module as the first document identification sequence.
  • the first document identification sequence acquisition module 320 includes: a query status identification generation sub-module and a first document identification sequence acquisition sub-module, wherein:
  • the query status identifier generation sub-module is used to generate the query status identifier based on the query conditions.
  • the paging query request further includes a user identifier
  • the query status identifier generating sub-module includes: a query status identifier generating unit, wherein:
  • the query status identifier generating unit is configured to generate the query status identifier based on the user identifier and the query condition.
  • the first document identification sequence acquisition sub-module is configured to acquire the document identification sequence corresponding to the query status identification from the snapshot storage module as the first document identification sequence.
  • the first document identification sequence obtaining sub-module includes: a first document identification sequence obtaining unit, wherein:
  • the first document identification sequence acquiring unit is configured to acquire a document identification sequence corresponding to the query status identification from the snapshot storage module based on a preset mapping relationship as a first document identification sequence, and the preset mapping relationship includes a plurality of Query the corresponding relationship between the status identifier and the sequence of multiple document identifiers.
  • the first document identification sequence acquisition sub-module includes: a snapshot storage module judgment unit and a first document identification sequence acquisition unit, wherein:
  • the snapshot storage module judging unit is configured to judge whether the snapshot storage module satisfies a specified condition based on the query status identifier.
  • the snapshot storage module judgment unit includes:
  • the snapshot storage module judging subunit is used to judge whether the snapshot storage module includes a document identification sequence corresponding to the query status identification.
  • the first document identification sequence acquiring unit is configured to acquire the document identification sequence corresponding to the query status identification from the snapshot storage module as the first document identification sequence when the snapshot storage module satisfies the specified condition.
  • the first document identification sequence obtaining unit includes: a first document identification sequence obtaining subunit, a third document identification sequence obtaining subunit, and a third document identification sequence writing subunit, wherein:
  • the first document identification sequence obtaining subunit is configured to obtain the document identification corresponding to the query state identification from the snapshot storage module when the snapshot storage module includes the document identification sequence corresponding to the query state identification The sequence serves as the first document identification sequence.
  • the third document identification sequence obtaining subunit is configured to obtain the document identification sequence under the query state identification based on the query condition when the document identification sequence corresponding to the query state identification is not included in the snapshot storage module as The third document identification sequence;
  • the third document identification sequence writing subunit is used to write the third document identification sequence into the snapshot storage module.
  • the third document identification sequence writing sub-unit includes: a mapping relationship establishment sub-submodule and a mapping relationship writing sub-submodule, wherein:
  • the mapping relationship establishment sub-sub-module is used to establish the mapping relationship between the query status identifier and the third document identifier sequence.
  • mapping relationship writing sub-sub-module is used to write the mapping relationship into the snapshot storage module.
  • mapping relationship writing sub-submodule includes: a mapping relationship writing sub-subunit, wherein:
  • mapping relationship writing sub-unit is used to write the query status identifier and the third document identifier sequence into the snapshot storage module in the form of key-value pairs.
  • the third document identification sequence writing subunit includes: an expiration time configuration submodule, a duration detection submodule, and a third document identification sequence clearing submodule, wherein:
  • the expiration time configuration sub-sub-module is configured to write the third document identification sequence into the snapshot storage module and configure the expiration time of the third document identification sequence.
  • the time length detection sub-sub-module is used to detect the time length when the third document identification sequence is written into the snapshot storage module.
  • the third document identification sequence clearing sub-module is configured to clear the third document identification sequence from the snapshot storage module when the duration meets the expiration time.
  • the third document identification sequence writing subunit includes: a memory storage submodule and a disk storage submodule, wherein:
  • the memory storage sub-module is used to write the third document identification sequence into the snapshot storage module and store it in the memory of the electronic device.
  • the disk storage sub-module is used to transfer the third document identification sequence from the memory of the electronic device to the disk of the electronic device for persistent storage.
  • the disk storage sub-sub-module includes a remaining storage capacity monitoring sub-sub-unit and a disk storage sub-sub-unit, wherein:
  • the remaining storage capacity monitoring sub-unit is used to monitor the remaining storage capacity of the internal memory of the electronic device.
  • the disk storage sub-unit is configured to transfer the third document identification sequence from the memory of the electronic device to the disk of the electronic device for persistent storage when the remaining storage amount is less than the designated storage amount.
  • the first document identification sequence obtaining unit includes: a data storage module searching subunit, wherein:
  • the data storage module search subunit is configured to directly search the data storage module for the data corresponding to the paging query request when the snapshot storage module does not include the document identification sequence corresponding to the query status identifier. Feedback.
  • the second document identification sequence obtaining module 330 is configured to obtain a document identification sequence from the first document identification sequence as a second document identification sequence based on the paging condition.
  • the target data obtaining module 340 is configured to obtain and feed back target data corresponding to the second document identification sequence from the data storage module.
  • the target data acquisition module 340 includes: a query statement generation sub-module and a target data acquisition sub-module, wherein:
  • the query statement generation sub-module is configured to generate a query statement matching the data storage module based on the second document identification sequence.
  • query statement generation sub-module includes: a statement format determination unit and a query statement generation unit, wherein:
  • the sentence format determining unit is used to determine the sentence format supported by the data storage module.
  • the query statement generating unit is configured to generate the query statement based on the second document identification sequence, and the format of the query statement is consistent with the statement format supported by the data storage module.
  • the target data obtaining sub-module is configured to obtain and feed back target data corresponding to the second document identification sequence from the data storage module based on the query sentence.
  • the coupling between the modules may be electrical, mechanical or other forms of coupling.
  • each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software function modules.
  • FIG. 12 shows a structural block diagram of an electronic device 100 provided by an embodiment of the present application.
  • the electronic device 100 may be an electronic device capable of running application programs, such as a smart phone, a tablet computer, or an e-book.
  • the electronic device 100 in this application may include one or more of the following components: a processor 110, a memory 120, a service system 130, and one or more application programs, of which one or more application programs may be stored in the memory 120 and be It is configured to be executed by one or more processors 110, and one or more programs are configured to execute the method described in the foregoing method embodiment.
  • the service system includes a query engine module 131, a snapshot storage module 132, and a data storage module 133.
  • the processor 110 may include one or more processing cores.
  • the processor 110 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and calling data stored in the memory 120.
  • Various functions and processing data of the electronic device 100 may adopt at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PDA Programmable Logic Array
  • the processor 110 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like.
  • the CPU mainly processes the operating system, user interface, and application programs; the GPU is used to render and draw the content to be displayed; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 110, but may be implemented by a communication chip alone.
  • the memory 120 may include random access memory (RAM) or read-only memory (Read-Only Memory).
  • the memory 120 may be used to store instructions, programs, codes, code sets or instruction sets.
  • the memory 120 may include a program storage area and a data storage area, where the program storage area may store instructions for implementing the operating system and instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.) , Instructions used to implement the following various method embodiments, etc.
  • the data storage area can also store data (such as phone book, audio and video data, chat record data) created by the terminal 100 during use.
  • FIG. 13 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • the computer-readable medium 400 stores program code, and the program code can be invoked by a processor to execute the method described in the foregoing method embodiment.
  • the computer-readable storage medium 400 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium 400 includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium 400 has a storage space for executing the program code 410 of any method step in the above-mentioned method. These program codes can be read from or written into one or more computer program products.
  • the program code 410 may be compressed in a suitable form, for example.
  • the query engine module receives the paging query request, and the paging query request includes the query conditions and the paging conditions, which are obtained from the snapshot storage module.
  • the document identification sequence corresponding to the query condition is used as the first document identification sequence
  • the document identification sequence is obtained from the first document identification sequence based on the paging condition as the second document identification sequence
  • the target corresponding to the second document identification sequence is obtained from the data storage module
  • Data and feedback are used to store the document identification sequence through the snapshot storage module, and the correct document identification sequence is determined from the document identification sequence according to the query conditions and paging conditions in the paging query request, so as to improve the accuracy and efficiency of the paging query.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A paging data query method and apparatus, an electronic device, and a storage medium. The method is applied to a service system of an electronic device, and the service system comprises a query engine module, a snapshot storage module, and a data storage module. The method comprises: the query engine module receives a paging query request, the paging query request comprising a query condition and a paging condition (S110); obtain, from the snapshot storage module, a document identifier sequence corresponding to the query condition as a first document identifier sequence (S120); on the basis of the paging condition, obtain a document identifier sequence from the first document identifier sequence as a second document identifier sequence (S130); and obtain target data corresponding to the second document identifier from the data storage module and feed the target data back (S140). By using the snapshot storage module to store document identifier sequences and according to the query condition and the paging condition in the paging query request, determining a correct document identifier sequence from the document identifier sequences, the accuracy and efficiency of paging query is improved.

Description

分页数据查询方法、装置、电子设备以及存储介质Paging data query method, device, electronic equipment and storage medium 技术领域Technical field
本申请涉及电子设备技术领域,更具体地,涉及一种分页数据查询方法、装置、电子设备以及存储介质。This application relates to the technical field of electronic equipment, and more specifically, to a method, device, electronic equipment, and storage medium for querying paging data.
背景技术Background technique
随着时间和业务的发展,电子设备的服务系统中的数据表会越来越多,且数据表中的数据也会越来越多,为了解决服务系统容量有限问题,通常可以将服务系统中的数据采用分库分表的方式来进行存储,同时,为了提升数据的查询效率,通过可以通过分页查询的方式从服务系统中获取数据。With the development of time and business, there will be more and more data tables in the service system of electronic equipment, and there will be more and more data in the data tables. In order to solve the problem of limited capacity of the service system, the service system can usually be The data is stored in a sub-database and sub-table. At the same time, in order to improve the efficiency of data query, data can be obtained from the service system through paging query.
发明内容Summary of the invention
鉴于上述问题,本申请提出了一种分页数据查询方法、装置、电子设备以及存储介质,以解决上述问题。In view of the above-mentioned problems, this application proposes a method, device, electronic equipment, and storage medium for querying paging data to solve the above-mentioned problems.
第一方面,本申请实施例提供了一种分页数据查询方法,其特征在于,应用于电子设备的服务系统,所述服务系统包括查询引擎模块、快照存储模块以及数据存储模块,所述方法包括:所述查询引擎模块接收分页查询请求,所述分页查询请求包括查询条件和分页条件;从所述快照存储模块中获取与所述查询条件对应的文档标识序列作为第一文档标识序列;基于所述分页条件从所述第一文档标识序列中获取文档标识序列作为第二文档标识序列;从所述数据存储模块中获取与所述第二文档标识序列对应的目标数据并反馈。In the first aspect, an embodiment of the present application provides a paging data query method, which is characterized in that it is applied to a service system of an electronic device. The service system includes a query engine module, a snapshot storage module, and a data storage module. The method includes : The query engine module receives a paging query request, the paging query request includes a query condition and a paging condition; obtains the document identification sequence corresponding to the query condition from the snapshot storage module as the first document identification sequence; The paging condition acquires a document identification sequence from the first document identification sequence as a second document identification sequence; acquires and feeds back target data corresponding to the second document identification sequence from the data storage module.
第二方面,本申请实施例提供了一种分页数据查询装置,应用于电子设备的服务系统,所述服务系统包括查询引擎模块、快照存储模块以及数据存储模块,所述装置包括:分页查询请求接收模块,用于所述查询引擎模块接收分页查询请求,所述分页查询请求包括查询条件和分页条件;第一文档标识序列获取模块,用于从所述快照存储模块中获取与所述查询条件对应的文档标识序列作为第一文档标识序列;第二文档标识序列获取模块,用于基于所述分页条件从所述第一文档标识序列中获取文档标识序列作为第二文档标识序列;目标数据获取模块,用于从所述数据存储模块中获取与所述第二文档标识序列对应的目标数据并反馈。In a second aspect, an embodiment of the present application provides a paging data query device, which is applied to a service system of an electronic device. The service system includes a query engine module, a snapshot storage module, and a data storage module. The device includes: a paging query request The receiving module is used for the query engine module to receive a paging query request, the paging query request includes a query condition and a paging condition; the first document identification sequence obtaining module is used for obtaining the query condition from the snapshot storage module The corresponding document identification sequence is used as the first document identification sequence; the second document identification sequence acquisition module is configured to acquire the document identification sequence from the first document identification sequence based on the paging condition as the second document identification sequence; target data acquisition A module for obtaining and feeding back target data corresponding to the second document identification sequence from the data storage module.
第三方面,本申请实施例提供了一种电子设备,包括存储器和处理器,所述存储器耦接到所述处理器,所述存储器存储指令,当所述指令由所述处理器执行时所述处理器执行上述方法。In a third aspect, an embodiment of the present application provides an electronic device including a memory and a processor, the memory is coupled to the processor, the memory stores instructions, and the instructions are executed when the instructions are executed by the processor. The processor executes the above method.
第四方面,本申请实施例提供了一种计算机可读取存储介质,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行上述方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, and the computer-readable storage medium stores program code, and the program code can be invoked by a processor to execute the foregoing method.
本申请实施例提供的分页数据查询方法、装置、电子设备以及存储介质,查询引擎模块接收分页查询请求,该分页查询请求包括查询条件和分页条件,从快照存储模块中获取与查询条件对应的文档标识序列作为第一文档标识序列,基于分页条件从第一文档标识序列中获取文档标识序列作为第二文档标识序列,从数据存储模块中获取与第二文档标识序列对应的目标数据并反馈,从而通过快照存储模块存储文档标识序列,并根据分页查询请求中的查询条件和分页条件从文档标识序列中确定正确的文档标识序列,以提升分页查询的准确性和效率。In the paging data query method, device, electronic device, and storage medium provided by the embodiments of the present application, the query engine module receives the paging query request, the paging query request includes the query condition and the paging condition, and obtains the document corresponding to the query condition from the snapshot storage module The identification sequence is used as the first document identification sequence, the document identification sequence is obtained from the first document identification sequence as the second document identification sequence based on the paging condition, and the target data corresponding to the second document identification sequence is obtained from the data storage module and fed back, thereby The document identification sequence is stored by the snapshot storage module, and the correct document identification sequence is determined from the document identification sequence according to the query conditions and paging conditions in the paging query request, so as to improve the accuracy and efficiency of the paging query.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
图1示出了可用于本申请实施例提供的分页数据查询方法的应用环境示意图;FIG. 1 shows a schematic diagram of an application environment that can be used in the paging data query method provided by the embodiments of the present application;
图2示出了本申请一个实施例提供的分页数据查询方法的流程示意图;FIG. 2 shows a schematic flowchart of a method for querying paging data provided by an embodiment of the present application;
图3示出了本申请又一个实施例提供的分页数据查询方法的流程示意图;FIG. 3 shows a schematic flowchart of a method for querying paging data according to another embodiment of the present application;
图4示出了本申请的图3所示的分页数据查询方法的步骤S230的流程示意图;FIG. 4 shows a schematic flowchart of step S230 of the paging data query method shown in FIG. 3 of the present application;
图5示出了本申请的图3所示的分页数据查询方法的步骤S250的流程示意图;FIG. 5 shows a schematic flowchart of step S250 of the paging data query method shown in FIG. 3 of the present application;
图6示出了本申请再一个实施例提供的分页数据查询方法的流程示意图;FIG. 6 shows a schematic flowchart of a method for querying paging data provided by still another embodiment of the present application;
图7示出了本申请的图6所示的分页数据查询方法的步骤S360的一个实施例的流程示意图;FIG. 7 shows a schematic flowchart of an embodiment of step S360 of the paging data query method shown in FIG. 6 of the present application;
图8示出了本申请的图6所示的分页数据查询方法的步骤S360的又一个实施例的流程示意图;FIG. 8 shows a schematic flowchart of another embodiment of step S360 of the paging data query method shown in FIG. 6 of the present application;
图9示出了本申请的图6所示的分页数据查询方法的步骤S360的再一个实施例的流程示意图;FIG. 9 shows a schematic flowchart of still another embodiment of step S360 of the paging data query method shown in FIG. 6 of the present application;
图10示出了本申请的图9所示的分页数据查询方法的步骤S362C的流程示意图;FIG. 10 shows a schematic flowchart of step S362C of the paging data query method shown in FIG. 9 of the present application;
图11示出了本申请实施例提供的分页数据查询装置的模块框图;Fig. 11 shows a block diagram of a paging data query device provided by an embodiment of the present application;
图12示出了本申请实施例用于执行根据本申请实施例的分页数据查询方法的电子设备的框图;FIG. 12 shows a block diagram of an electronic device used to execute the method for querying paging data according to an embodiment of the present application;
图13示出了本申请实施例的用于保存或者携带实现根据本申请实施例的分页数据查询方法的程序代码的存储单元。FIG. 13 shows a storage unit for storing or carrying program code for implementing the method for querying paging data according to the embodiment of the present application according to an embodiment of the present application.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present application.
目前,在通过分页查询的方式从服务系统中获取数据时,用户根据筛选条件向服务系统请求数据,服务系统根据筛选条件生成存储系统可以理解的分页查询表达式语句,如存储系统为Mysql,则查询表达式可以为SQL语句,存储系统运行SQL语句得到分页数据并返回给服务系统,最终服务系统将分页数据返回给用户,完成一次分页查询。At present, when obtaining data from the service system through paging query, users request data from the service system according to the filter conditions, and the service system generates paging query expression statements that the storage system can understand according to the filter conditions. If the storage system is Mysql, then The query expression can be a SQL statement. The storage system runs the SQL statement to obtain the paged data and returns it to the service system. Finally, the service system returns the paged data to the user to complete a paged query.
但是,用户在根据条件查询数据时,若数据内容发生改变将导致用户再次使用分页查询数据时,所获得的数据不准确。以Mysql存储为例说明不准确原因。用户一次查询条件为C 1=(c=apple),分页条件为P 1=(page=1,size=5),存储系统中满足查询条件的有文档集合U=(d 1,d 2,d 3,...,d 10)共10个文档,根据查询条件C 1与分页条件P 1服务系统生成查询条件语句为“where c=’apple’limit 0,5”,返回第一页5条文档集合为U 1=(d 1,d 2,d 3,d 4,d 5),此时用户若获取到数据之后将文档d 1属性c修改该“orange”,服符合条件C 1的集合将变为U=(d 2,d 3,...,d 10)共9个文档,此时用户进行第二翻页查询,查询条件C 1=(c=apple),分页条件为P 2=(page=2,size=5),生成查询条件语句为“where c=’apple’limit 5,5”,获取到文档集合为U 2=(d 7,d 8,d 9,d 10),观察第一次与第二次的查询结果可知由于文档d 1的修改导致两次连续的查询结果丢失了文档d 6,极大的降低了用户的使用体验。 However, when users query data based on conditions, if the content of the data changes, the data obtained will be inaccurate when the user uses paging to query the data again. Take Mysql storage as an example to illustrate the reason for inaccuracy. The user’s one-time query condition is C 1 =(c=apple), the paging condition is P 1 =(page=1, size=5), and there are document sets in the storage system that meet the query conditions U=(d 1 ,d 2 ,d 3 ,...,d 10 ) A total of 10 documents, according to the query condition C 1 and the paging condition P 1, the service system generates the query condition sentence "where c ='apple' limit 0,5", and returns to the first page with 5 items The document set is U 1 = (d 1 , d 2 , d 3 , d 4 , d 5 ). At this time, if the user changes the attribute c of the document d 1 to the "orange" after obtaining the data, the set meets the condition C 1 It will become U = (d 2 , d 3 ,..., d 10 ) with a total of 9 documents. At this time, the user performs the second page-turning query, the query condition C 1 = (c = apple), and the paging condition is P 2 =(page=2, size=5), the generated query condition sentence is "where c='apple'limit 5,5", and the document set obtained is U 2 =(d 7 ,d 8 ,d 9 ,d 10 ) observed for the first time and the second time query results due to changes in the document d 1 shows the results led to two consecutive lost document d 6, greatly reducing the user's experience.
针对上述问题,发明人经过长期的研究发现,并提出了本申请实施例提供的分页数据查询方法、装置、电子设备以及存储介质,通过快照存储模块存储文档标识序列,并根据分页查询请求中的查询条件和分页条件从文档标识序列中确定正确的文档标识序列,以提升分页查询的准确性和效率。其中,具体的分页数据查询方法在后续的实施例中进行详细的说明。In response to the above problems, the inventor has discovered through long-term research, and proposed the paging data query method, device, electronic device, and storage medium provided by the embodiments of this application. The document identification sequence is stored through the snapshot storage module, and the document identification sequence is stored according to the paging query request. The query condition and the paging condition determine the correct document identification sequence from the document identification sequence to improve the accuracy and efficiency of the paging query. Among them, the specific paging data query method will be described in detail in the subsequent embodiments.
下面将针对可用于本申请实施例提供的分页数据查询方法的环境示意图进行描述。The following describes a schematic diagram of an environment that can be used in the paging data query method provided in the embodiments of the present application.
请参阅图1,图1示出了可用于本申请实施例提供的分页数据查询方法的应用环境示意图。其包括电子设备(服务器)100和用户终端200,电子设备100和用户终端200通信连接以实现数据交互,例如,用户终端200可以发送分页查询请求至电子设备100。其中,电子设备100和用户终端200可以通过数据网络或无线网络连接,当电子设备100和用户终端200通过数据网络连接时,电子设备100和用户终端200可以通过2G网络、 3G网络、4G网络、5G网络等连接,当电子设备100和用户终端200通过无线网络连接时,电子设备100和用户终端200可以通过无线保真WiFi网络连接,在此不做限定。其中,电子设备100可以为平板电脑、台式电脑、服务器等,用户终端200可以为智能手机、平板电脑、穿戴式电子设备等,在此不做限定。Please refer to FIG. 1. FIG. 1 shows a schematic diagram of an application environment that can be used for the paging data query method provided by the embodiments of the present application. It includes an electronic device (server) 100 and a user terminal 200, and the electronic device 100 and the user terminal 200 are in communication connection to implement data interaction. For example, the user terminal 200 may send a paging query request to the electronic device 100. Wherein, the electronic device 100 and the user terminal 200 can be connected via a data network or a wireless network. When the electronic device 100 and the user terminal 200 are connected via a data network, the electronic device 100 and the user terminal 200 can be connected via a 2G network, a 3G network, a 4G network, When the electronic device 100 and the user terminal 200 are connected through a wireless network, the electronic device 100 and the user terminal 200 can be connected through a wireless fidelity WiFi network, which is not limited here. Wherein, the electronic device 100 may be a tablet computer, a desktop computer, a server, etc., and the user terminal 200 may be a smart phone, a tablet computer, a wearable electronic device, etc., which are not limited herein.
其中,电子设备100可以装载有服务系统,服务系统可以包括查询引擎模块、快照存储模块以及数据存储模块。The electronic device 100 may be loaded with a service system, and the service system may include a query engine module, a snapshot storage module, and a data storage module.
其中,查询引擎模块,可以用户负责接收用户通过用户终端发送的分页查询请求,并自适应的去数据存储模块或者快照存储模块查询文档数据并最终返回给用户终端。在一些实施方式中,查询引擎模块可以具有以下功能:(1)负责接收用户通过用户终端发送分页查询请求,并能够根据分页查询请求中的分页查询条件和用户标识生成唯一的分页查询状态;(2)能够根据分页查询状态,判断分页查询状态对应的数据是从数据存储模块直接获取,还是先从快照存储模块获取文档标识序列后再从数据存储模块获取;(3)能够根据分页查询状态生成数据存储模块可以理解的查询表达式,并从数据存储模块请求数据。Among them, the query engine module can be responsible for the user to receive the paging query request sent by the user through the user terminal, and adaptively go to the data storage module or the snapshot storage module to query the document data and finally return it to the user terminal. In some implementations, the query engine module can have the following functions: (1) Responsible for receiving a paged query request sent by a user through a user terminal, and can generate a unique paged query state according to the paged query condition and the user ID in the paged query request; 2) According to the paging query status, it can be judged whether the data corresponding to the paging query status is directly obtained from the data storage module, or the document identification sequence is obtained from the snapshot storage module and then obtained from the data storage module; (3) It can be generated according to the paging query status The data storage module can understand query expressions and request data from the data storage module.
其中,快照存储模块,用于存储每个分页查询状态所对应的文档标识序列。存储模式使用计算机内存进行存储,从而保证数据查询的效率。在一些实施方式中,快照存储模块可以具有以下功能:(1)能够以(key,value)的方式将数据存储到内存中,即根据每一个分页查询状态可以获取它所对应的文档标识序列;(2)支持根据key指定数据过期时间,在时间过期后数据将自动清除,从而避免计算机内存不足;(3)支持将内存中数据持久化存储到磁盘存储上,避免快照存储模块所在机器宕机后数据丢下.Among them, the snapshot storage module is used to store the document identification sequence corresponding to each paged query state. The storage mode uses computer memory for storage to ensure the efficiency of data query. In some embodiments, the snapshot storage module may have the following functions: (1) It can store data in the memory in the form of (key, value), that is, the corresponding document identification sequence can be obtained according to each page query state; (2) Support to specify the data expiration time according to the key, and the data will be automatically cleared after the time expires, thereby avoiding insufficient computer memory; (3) Supporting persistent storage of the data in the memory to the disk storage to avoid downtime of the machine where the snapshot storage module is located After the data is dropped.
其中,数据存储模块,用于持久化存储用户查询数据的文档内容。在一些实施方式中,数据存储模块可以具有以下功能:(1)拥有固定的查询逻辑表达式;(2)支持分页查询方式查询数据;(3)支持根据数据的某字段建立索引。Among them, the data storage module is used to persistently store the document content of the user query data. In some embodiments, the data storage module may have the following functions: (1) have a fixed query logic expression; (2) support querying data in a paging query mode; (3) support establishing an index based on a certain field of the data.
请参阅图2,图2示出了本申请一个实施例提供的分页数据查询方法的流程示意图。所述分页数据查询方法用于通过快照存储模块存储文档标识序列,并根据分页查询请求中的查询条件和分页条件从文档标识序列中确定正确的文档标识序列,以提升分页查询的准确性和效率。在具体的实施例中,所述分页数据查询方法应用于如图11所示的分页数据查询装置300以及配置有所述分页数据查询装置300的电子设备100(图12)。下面将以电子设备为例,说明本实施例的具体流程,当然,可以理解的,本实施例所应用的电子设备可以为服务器、平板电脑、台式电脑等,在此不做限定。下面将针对图2所示的流程进行详细的阐述,其中,在本实施例中,所述电子设备装载有服务系统,所示服务系统包括查询引擎模块、快照存储模块以及数据存储模块,所述分页数据查询方法具体可以包括以下步骤:Please refer to FIG. 2, which shows a schematic flowchart of a method for querying paging data provided by an embodiment of the present application. The paging data query method is used to store the document identification sequence through the snapshot storage module, and determine the correct document identification sequence from the document identification sequence according to the query conditions and the paging conditions in the paging query request, so as to improve the accuracy and efficiency of the paging query . In a specific embodiment, the paging data query method is applied to the paging data query device 300 as shown in FIG. 11 and the electronic device 100 equipped with the paging data query device 300 (FIG. 12 ). The following will take an electronic device as an example to describe the specific process of this embodiment. Of course, it is understandable that the electronic device applied in this embodiment may be a server, a tablet computer, a desktop computer, etc., which is not limited here. The process shown in Figure 2 will be described in detail below. In this embodiment, the electronic device is loaded with a service system. The service system shown includes a query engine module, a snapshot storage module, and a data storage module. The paging data query method may specifically include the following steps:
步骤S110:所述查询引擎模块接收分页查询请求,所述分页查询请求包括查询条件和分页条件。Step S110: The query engine module receives a paging query request, where the paging query request includes a query condition and a paging condition.
在一些实施方式中,查询引擎模块可以接收用户通过用户终端发送的分页查询请求,其中,接收到的分页查询请求可以携带有查询条件和分页条件。具体地,该查询条件例如可以为C=(c 1,c 2,...,c n),其中,c n表示查询条件的内容,n为自然数,该分页条件例如可以为P=(page,size),其中,page表示要获取数据的当前页数,size表示一页所请求的数据数量。 In some embodiments, the query engine module may receive a paged query request sent by a user through the user terminal, where the received paged query request may carry query conditions and paging conditions. Specifically, the query condition can be, for example, C=(c 1 , c 2 ,..., c n ), where c n represents the content of the query condition, n is a natural number, and the paging condition can be, for example, P=(page , Size), where page represents the current page number of data to be obtained, and size represents the number of data requested for a page.
在本实施例中,分页查询条件所携带的查询条件和分页条件可以由用户终端预先配置,也可以由用户手动配置。例如,分页条件中的size可以由用户终端预先配置默认值,如可以由用户终端预先配置size的默认值为5,分页条件中的size也可以由用户根据喜好或习惯进行配置,如当用户喜好一页所展示的数据数量为3个时,可以手动将分页条件中的size配置为3,在此不做限定。In this embodiment, the query condition and the paging condition carried by the paging query condition may be pre-configured by the user terminal, or manually configured by the user. For example, the size in the paging condition can be pre-configured with a default value by the user terminal. For example, the default value of the size can be pre-configured by the user terminal. The size in the paging condition can also be configured by the user according to preferences or habits, such as when the user prefers When the number of data displayed on a page is 3, you can manually configure the size in the paging condition to 3, which is not limited here.
在一些实施方式中,分页查询请求可以是用户终端在接收到指定语音输入时生成并发送至查询引擎模块,也可以是用户终端在接收到指定触摸操作时生成并发送至查询引 擎模块,在此不做限定。In some embodiments, the paging query request may be generated and sent to the query engine module when the user terminal receives a specified voice input, or may be generated and sent to the query engine module when the user terminal receives a specified touch operation, where Not limited.
步骤S120:从所述快照存储模块中获取与所述查询条件对应的文档标识序列作为第一文档标识序列。Step S120: Obtain the document identification sequence corresponding to the query condition from the snapshot storage module as the first document identification sequence.
在一些实施方式中,查询引擎模块在接收到分页查询请求后,可以对分页查询请求进行分析,基于对分页查询请求的分析从分页查询请求中提取该分页查询请求携带的查询条件,再基于该查询条件从快照存储模块中获取与该查询条件对应的文档标识序列,将获取到的与该查询条件对应的文档标识序列作为第一文档标识序列。In some embodiments, after receiving the paging query request, the query engine module may analyze the paging query request, and extract the query conditions carried in the paging query request from the paging query request based on the analysis of the paging query request, and then based on the The query condition acquires the document identification sequence corresponding to the query condition from the snapshot storage module, and uses the acquired document identification sequence corresponding to the query condition as the first document identification sequence.
作为一种方式,快照存储模块可以预先获取并记录多个查询条件和多个文档标识序列,并建立多个查询条件和多个文档标识序列之间的映射关系,其中,该映射关系可以为多个查询条件和多个文档标识序列一一对应,如表1所示。其中,查询引擎模块在获取到查询条件时,可以将获取到的查询条件和预先建立的映射关系中的多个查询条件进行对比,以获取与获取到的查询条件匹配的查询条件,再基于映射关系获取与获取到的查询条件匹配的查询条件对应的文档标识序列,在确定与获取到的查询条件匹配的查询条件对应的文档标识序列时,可以将该文档标识序列确定为第一文档标识序列。其中,该第一文档标识序列例如可以为L=(k 1,k 2,k 3,...,k n),其中,k n为第一文档标识的具体值,n为自然数。 As a way, the snapshot storage module can obtain and record multiple query conditions and multiple document identification sequences in advance, and establish a mapping relationship between multiple query conditions and multiple document identification sequences, where the mapping relationship may be multiple One query condition corresponds to multiple document identification sequences, as shown in Table 1. Among them, when the query engine module obtains the query conditions, it can compare the obtained query conditions with multiple query conditions in the pre-established mapping relationship to obtain the query conditions that match the obtained query conditions, and then based on the mapping The relationship acquires the document identification sequence corresponding to the query condition that matches the acquired query condition. When determining the document identification sequence corresponding to the query condition that matches the acquired query condition, the document identification sequence may be determined as the first document identification sequence . Wherein, the first document identification sequence may be, for example, L=(k 1 , k 2 , k 3 ,..., k n ), where k n is a specific value of the first document identification, and n is a natural number.
表1Table 1
查询条件Query conditions 文档标识序列Document identification sequence
查询条件1Query condition 1 文档标识序列1Document identification sequence 1
查询条件2Query condition 2 文档标识序列2Document identification sequence 2
查询条件3Query condition 3 文档标识序列3Document identification sequence 3
步骤S130:基于所述分页条件从所述第一文档标识序列中获取文档标识序列作为第二文档标识序列。Step S130: Obtain a document identification sequence from the first document identification sequence as a second document identification sequence based on the paging condition.
在一些实施方式中,查询引擎模块在接收到分页查询请求后,可以对分页查询请求进行分析,基于对分页查询请求的分析从分页查询请求中提取该分页查询请求携带的分页条件,再基于分页条件从第一文档标识序列中获取与该分页条件对应的文档标识序列,将获取到的与该分页条件对应的文档标识序列作为第二文档标识序列。In some embodiments, after receiving the paging query request, the query engine module may analyze the paging query request, and extract the paging condition carried by the paging query request from the paging query request based on the analysis of the paging query request, and then based on the paging The condition acquires the document identification sequence corresponding to the paging condition from the first document identification sequence, and uses the acquired document identification sequence corresponding to the paging condition as the second document identification sequence.
例如,若第一文档标识序列为L=(k 1,k 2,k 3,...,k n),其中,k n为第一文档标标识的具体值,n为自然数,分页条件为P=(page,size),那么,查询引擎模块可以根据分页条件P=(page,size)获取第一文档标识序列L中对应的文档标识序列,如分页条件P=(page=1,size=3),则可以计算分页条件所指示的起点位置为Start=size*(page-1)+1=1,并根据size=3取第一文档标识序列L=(k 1,k 2,k 3,...,k n)中的文档标识序列L 1=(k 1,k 2,k 3)作为第二文档标识序列。 For example, if the first document identification sequence is L=(k 1 , k 2 , k 3 ,..., k n ), where k n is the specific value of the first document identification, n is a natural number, and the paging condition is P=(page, size), then the query engine module can obtain the corresponding document identification sequence in the first document identification sequence L according to the paging condition P=(page, size), for example, the paging condition P=(page=1, size= 3), the starting position indicated by the paging condition can be calculated as Start=size*(page-1)+1=1, and the first document identification sequence L=(k 1 , k 2 , k 3 is taken according to size=3 ,..., k n ) in the document identification sequence L 1 =(k 1 , k 2 , k 3 ) as the second document identification sequence.
步骤S140:从所述数据存储模块中获取与所述第二文档标识序列对应的目标数据并反馈。Step S140: Obtain and feed back target data corresponding to the second document identification sequence from the data storage module.
在一些实施方式中,查询引擎模块在获取第二文档标识序列后,可以基于第二文档标识序列从数据存储模块中获取与第二文档标识序列对应的目标数据,并将所获取的目标数据反馈至用户终端,以完成一次分页数据的查询和反馈。例如,当第二文档标识序列为L 1=(k 1,k 2,k 3)时,那么,可以从数据存储模块中获取与第二文档标识序列L 1=(k 1,k 2,k 3)对应的目标数据,并将获取的目标数据反馈至用户终端。可以理解的是,在本实施例中,即时用户在进行连续分页查询并修改查询数据时,快照存储模块中存储的文档标识序列保持不变,因此,即时用户对数据进行修改,也不会出现数据漏查的情况,从而极大的提高了用户处理数据的准确性,同时快照存储的方式也能够提高用户对数据的查询效率。 In some embodiments, after acquiring the second document identification sequence, the query engine module may acquire target data corresponding to the second document identification sequence from the data storage module based on the second document identification sequence, and feed back the acquired target data To the user terminal to complete a query and feedback of paging data. For example, when the second document identification sequence is L 1 =(k 1 , k 2 , k 3 ), then the second document identification sequence L 1 =(k 1 , k 2 , k can be obtained from the data storage module 3 ) Corresponding target data, and feedback the acquired target data to the user terminal. It is understandable that, in this embodiment, even when the user performs continuous paged query and modifies the query data, the document identification sequence stored in the snapshot storage module remains unchanged. Therefore, even if the user modifies the data, it will not appear. The situation of data missing, which greatly improves the accuracy of the user's data processing, and the snapshot storage method can also improve the efficiency of the user's data query.
本申请一个实施例提供的分页数据查询方法,查询引擎模块接收分页查询请求,该分页查询请求包括查询条件和分页条件,从快照存储模块中获取与查询条件对应的文档 标识序列作为第一文档标识序列,基于分页条件从第一文档标识序列中获取文档标识序列作为第二文档标识序列,从数据存储模块中获取与第二文档标识序列对应的目标数据并反馈,从而通过快照存储模块存储文档标识序列,并根据分页查询请求中的查询条件和分页条件从文档标识序列中确定正确的文档标识序列,以提升分页查询的准确性和效率。In the paging data query method provided by one embodiment of the present application, a query engine module receives a paging query request, the paging query request includes a query condition and a paging condition, and a document identification sequence corresponding to the query condition is obtained from the snapshot storage module as the first document identification Sequence, obtain the document identification sequence from the first document identification sequence as the second document identification sequence based on the paging condition, obtain and feed back the target data corresponding to the second document identification sequence from the data storage module, thereby storing the document identification through the snapshot storage module Sequence, and determine the correct document identification sequence from the document identification sequence according to the query conditions and paging conditions in the paged query request, so as to improve the accuracy and efficiency of the paged query.
请参阅图3,图3示出了本申请又一个实施例提供的分页数据查询方法的流程示意图。该方法应用于上述电子设备,所述电子设备装载有服务系统,所示服务系统包括查询引擎模块、快照存储模块以及数据存储模块,下面将针对图3所示的流程进行详细的阐述,所述分页数据查询方法具体可以包括以下步骤:Please refer to FIG. 3, which shows a schematic flowchart of a method for querying paging data according to another embodiment of the present application. This method is applied to the above-mentioned electronic equipment, and the electronic equipment is loaded with a service system. The service system shown includes a query engine module, a snapshot storage module, and a data storage module. The following will describe the process shown in FIG. 3 in detail. The paging data query method may specifically include the following steps:
步骤S210:所述查询引擎模块接收分页查询请求,所述分页查询请求包括查询条件和分页条件。Step S210: The query engine module receives a paging query request, and the paging query request includes a query condition and a paging condition.
其中,步骤S210的具体描述请参阅步骤S110,在此不再赘述。For the specific description of step S210, please refer to step S110, which will not be repeated here.
步骤S220:基于所述查询条件生成查询状态标识。Step S220: Generate a query status identifier based on the query condition.
在本实施例中,查询引擎模块在获取到分页查询请求中携带的查询条件后,可以基于查询条件生成查询状态标识,其中,查询状态标识用于标识用户的分页查询记录,例如,该查询状态标识用于标识用户是否基于该查询条件进行过分页查询,标识用户基于查询条件进行分页查询时是从快照存储模块获取文档标识序列还是从数据存储模块直接获取数据等,在此不做限定。In this embodiment, after the query engine module obtains the query conditions carried in the paging query request, it can generate a query status identifier based on the query conditions, where the query status identifier is used to identify the paged query record of the user, for example, the query status The identifier is used to identify whether the user has performed a paged query based on the query condition, and whether the user obtains the document identification sequence from the snapshot storage module or directly obtains the data from the data storage module when the user performs a paged query based on the query condition, etc., which is not limited here.
在一些实施方式中,查询引擎模块在接收到分页查询请求后,可以对分页查询请求进行分析,基于对分页查询请求的分析从分页查询请求中提取该分页查询请求携带的用于唯一标识用户的用户标识,再基于该用户标识和查询条件生成查询状态标识,其中,生成的查询状态标识与用户标识对应的用户唯一对应。In some implementations, the query engine module can analyze the paged query request after receiving the paged query request, and extract the paged query request from the paged query request based on the analysis of the paged query request for uniquely identifying the user. The user identifier is then generated based on the user identifier and the query conditions, and the query status identifier generated uniquely corresponds to the user corresponding to the user identifier.
步骤S230:从所述快照存储模块中获取与所述查询状态标识对应的文档标识序列作为第一文档标识序列。Step S230: Obtain the document identification sequence corresponding to the query status identification from the snapshot storage module as the first document identification sequence.
作为一种方式,快照存储模块可以预先获取并记录多个查询状态标识和多个文档标识序列,并建立多个查询状态标识和多个文档标识序列之间的映射关系,其中,该映射关系可以为多个查询状态标识和多个文档标识序列一一对应,如表2所示。其中,查询引擎模块在获取到查询状态标识时,可以将获取到的查询状态标识和预先建立的映射关系中的多个查询状态标识进行对比,以获取与获取到的查询状态标识匹配的查询状态标识,再基于映射关系获取与获取到的查询状态标识匹配的查询状态标识对应的文档标识序列,在确定与获取到的查询状态标识匹配的查询状态标识对应的文档标识序列时,可以将该文档标识序列确定为第一文档标识序列。As a way, the snapshot storage module can obtain and record multiple query status identifiers and multiple document identifier sequences in advance, and establish a mapping relationship between multiple query status identifiers and multiple document identifier sequences, where the mapping relationship can be There is a one-to-one correspondence between multiple query status identifiers and multiple document identifier sequences, as shown in Table 2. Wherein, when the query engine module obtains the query status identifier, it can compare the acquired query status identifier with multiple query status identifiers in the pre-established mapping relationship to obtain a query status that matches the acquired query status identifier. Identification, and then obtain the document identification sequence corresponding to the query state identifier that matches the acquired query state identifier based on the mapping relationship. When determining the document identification sequence corresponding to the query state identifier that matches the acquired query state identifier, the document can be The identification sequence is determined as the first document identification sequence.
表2Table 2
查询状态标识Query status indicator 文档标识序列Document identification sequence
查询状态标识1Query status indicator 1 文档标识序列1Document identification sequence 1
查询状态标识2Query status indicator 2 文档标识序列2Document identification sequence 2
查询状态标识3Query status indicator 3 文档标识序列3Document identification sequence 3
请参阅图4,图4示出了本申请的图3所示的分页数据查询方法的步骤S230的流程示意图,下面将针对图4所示的流程进行详细的阐述,所述方法具体可以包括以下步骤:Please refer to FIG. 4, which shows a schematic flow chart of step S230 of the paging data query method shown in FIG. 3 of the present application. The flow shown in FIG. 4 will be described in detail below. The method may specifically include the following step:
步骤S231:基于所述查询状态标识判断所述快照存储模块是否满足指定条件。Step S231: Determine whether the snapshot storage module satisfies a specified condition based on the query status identifier.
在一些实施方式中,电子设备可以预先设置并存储有指定条件,该指定条件用于作为快照存储模块的判断依据。因此,可以将快照存储模块与指定条件进行比较,以判断快照存储模块是否满足指定条件,在本实施例中,可以将查询状态标识作为判断快照存储模块是否满足指定条件的一个参数,即可以基于查询状态标识判断快照存储模块是否满足指定条件。In some embodiments, the electronic device may preset and store a designated condition, and the designated condition is used as a judgment basis for the snapshot storage module. Therefore, the snapshot storage module can be compared with the specified condition to determine whether the snapshot storage module meets the specified condition. In this embodiment, the query status identifier can be used as a parameter for judging whether the snapshot storage module meets the specified condition, that is, it can be based on Query the status flag to determine whether the snapshot storage module meets the specified conditions.
步骤S232:当所述快照存储模块满足所述指定条件时,从所述快照存储模块中获取与 所述查询状态标识对应的文档标识序列作为第一文档标识序列。Step S232: When the snapshot storage module satisfies the specified condition, obtain the document identification sequence corresponding to the query status identification from the snapshot storage module as the first document identification sequence.
在一些实施方式中,当判断结果表征快照存储模块满足指定条件时,可以从快照存储模块中获取与查询状态标识对应的文档标识序列,并将获取的文档标识序列作为第一文档标识序列。当判断结果表征快照存储模块不满足指定条件时,可以直接从数据存储模块中查找与分页查询请求对应的数据,并将查找到的数据反馈至用户终端。In some embodiments, when the judgment result indicates that the snapshot storage module satisfies the specified condition, the document identification sequence corresponding to the query status identification can be obtained from the snapshot storage module, and the obtained document identification sequence is used as the first document identification sequence. When the judgment result indicates that the snapshot storage module does not meet the specified condition, the data corresponding to the paging query request can be directly searched from the data storage module, and the searched data is fed back to the user terminal.
步骤S240:基于所述分页条件从所述第一文档标识序列中获取文档标识序列作为第二文档标识序列。Step S240: Acquire a document identification sequence from the first document identification sequence as a second document identification sequence based on the paging condition.
其中,步骤S240的具体描述请参阅步骤S130,在此不再赘述。For the specific description of step S240, please refer to step S130, which will not be repeated here.
步骤S250:基于所述第二文档标识序列生成与所述数据存储模块匹配的查询语句。Step S250: Generate a query sentence matching the data storage module based on the second document identification sequence.
在一些实施方式中,不同的数据存储模块所能识别的查询语句不同,例如,若数据存储模块为Mysql,那么该数据存储模块所能识别的查询语句为SQL。因此,在本实施例中,在获得第二文档标识序列时,可以基于第二文档标识序列生成与数据存储模块匹配的查询语句,可以理解的是,该查询语句能够被数据存储模块识别,且该查询语句可以用于指示数据存储模块对第二文档标识序列对应的目标数据进行查询并反馈。In some embodiments, different data storage modules can recognize different query statements. For example, if the data storage module is Mysql, then the query statements that can be recognized by the data storage module are SQL. Therefore, in this embodiment, when the second document identification sequence is obtained, a query sentence matching the data storage module can be generated based on the second document identification sequence. It can be understood that the query sentence can be recognized by the data storage module, and The query sentence may be used to instruct the data storage module to query and feed back the target data corresponding to the second document identification sequence.
请参阅图5,图5示出了本申请的图3所示的分页数据查询方法的步骤S250的流程示意图,下面将针对图5所示的流程进行详细的阐述,所述方法具体可以包括以下步骤:Please refer to FIG. 5. FIG. 5 shows a schematic flow chart of step S250 of the method for querying paging data shown in FIG. 3 of the present application. The flow shown in FIG. 5 will be described in detail below. The method may specifically include the following step:
步骤S251:确定所述数据存储模块所支持的语句格式。Step S251: Determine the sentence format supported by the data storage module.
在一些实施方式中,可以先确定数据存储模块所支持的语句格式,即可以先确定数据存储模块所能理解的语句格式。作为一种方式,可以获取数据存储模块的属性信息,并基于数据存储模块的数据信息确定该数据存储模块所支持的语句格式。例如,若数据存储模块的属性信息为Mysql时,可以确定该数据存储模块所支持的语句格式为SQL。In some embodiments, the sentence format supported by the data storage module may be determined first, that is, the sentence format understood by the data storage module may be determined first. As a way, the attribute information of the data storage module can be obtained, and the sentence format supported by the data storage module can be determined based on the data information of the data storage module. For example, if the attribute information of the data storage module is Mysql, it can be determined that the statement format supported by the data storage module is SQL.
步骤S252:基于所述第二文档标识序列生成所述查询语句,所述查询语句的格式与所述数据存储模块所支持的语句格式一致。Step S252: Generate the query sentence based on the second document identification sequence, and the format of the query sentence is consistent with the sentence format supported by the data storage module.
在一些实施方式中,在确定数据存储模块所支持的语句格式后,在基于第二文档标识序列生成查询语句时,可以使生成的查询语句的格式与数据存储模块所支持的语句格式一致,以保证基于第二文档标识序列生成的查询语句能够被数据存储模块识别。In some embodiments, after the sentence format supported by the data storage module is determined, when the query sentence is generated based on the second document identification sequence, the format of the generated query sentence may be consistent with the sentence format supported by the data storage module to It is ensured that the query statement generated based on the second document identification sequence can be identified by the data storage module.
步骤S260:基于所述查询语句从所述数据存储模块中获取与所述第二文档标识序列对应的目标数据并反馈。Step S260: Obtain and feed back target data corresponding to the second document identification sequence from the data storage module based on the query sentence.
在一些实施方式中,查询引擎模块在获得查询语句后,可以将查询语句发送至数据存储模块,以基于该查询语句从数据存储模块中获取与该第二文档标识序列对应的目标数据,将目标数据反馈至用户终端。In some embodiments, after obtaining the query sentence, the query engine module can send the query sentence to the data storage module to obtain the target data corresponding to the second document identification sequence from the data storage module based on the query sentence, and the target data The data is fed back to the user terminal.
本申请又一个实施例提供的分页数据查询方法,查询引擎模块接收分页查询请求,分页查询请求包括查询条件和分页条件,基于查询条件生成查询状态标识,从快照存储模块中获取与查询状态标识对应的文档标识序列作为第一文档标识序列,基于分页条件从第一文档标识序列中获取文档标识序列作为第二文档标识序列,基于第二文档标识序列生成与数据存储模块匹配的查询语句,In the paging data query method provided in another embodiment of the present application, the query engine module receives the paging query request, the paging query request includes the query condition and the paging condition, generates the query status identifier based on the query conditions, and obtains the query status identifier corresponding to the query status identifier from the snapshot storage module The document identification sequence of is used as the first document identification sequence, the document identification sequence is obtained from the first document identification sequence based on the paging condition as the second document identification sequence, and the query sentence matching the data storage module is generated based on the second document identification sequence,
基于查询语句从数据存储模块中获取与第二文档标识序列对应的目标数据并反馈。相较于图2所示的分页数据查询方法,本实施例还基于查询条件生成查询状态标识,并基于查询状态标识从快照存储模块中获取对应的文档标识序列,以提升文档标识序列获取的准确性。The target data corresponding to the second document identification sequence is obtained from the data storage module based on the query sentence and fed back. Compared with the paging data query method shown in FIG. 2, this embodiment also generates a query status identifier based on query conditions, and obtains the corresponding document identifier sequence from the snapshot storage module based on the query status identifier, so as to improve the accuracy of obtaining the document identifier sequence. Sex.
请参阅图6,图6示出了本申请再一个实施例提供的分页数据查询方法的流程示意图。该方法应用于上述电子设备,所述电子设备装载有服务系统,所示服务系统包括查询引擎模块、快照存储模块以及数据存储模块,下面将针对图6所示的流程进行详细的阐述,所述分页数据查询方法具体可以包括以下步骤:Please refer to FIG. 6, which shows a schematic flowchart of a method for querying paging data according to another embodiment of the present application. The method is applied to the above-mentioned electronic equipment, and the electronic equipment is loaded with a service system. The service system shown includes a query engine module, a snapshot storage module, and a data storage module. The flow shown in FIG. 6 will be described in detail below. The paging data query method may specifically include the following steps:
步骤S310:所述查询引擎模块接收分页查询请求,所述分页查询请求包括查询条件和分页条件。Step S310: The query engine module receives a paging query request, and the paging query request includes a query condition and a paging condition.
步骤S320:基于所述查询条件生成查询状态标识。Step S320: Generate a query status identifier based on the query condition.
其中,步骤S310-步骤S320的具体描述请参阅步骤S210-步骤S220,在此不再赘述。For the specific description of step S310-step S320, please refer to step S210-step S220, which will not be repeated here.
步骤S330:判断所述快照存储模块中是否包括与所述查询状态标识对应的文档标识序列。Step S330: Determine whether the snapshot storage module includes a document identification sequence corresponding to the query status identification.
在本实施例中,查询引擎模块在获取查询状态标识后,可以判断快照存储模块中是否包括与查询状态标识对应的文档标识序列。在一些实施方式中,查询引擎模块在获取查询状态标识后,可以将查询状态标识和预先建立的预设关系中的多个查询状态标识进行对比,以判断预设映射关系中是否包括与获取的查询状态标识一致的查询状态标识。In this embodiment, after obtaining the query status identifier, the query engine module can determine whether the snapshot storage module includes a document identifier sequence corresponding to the query status identifier. In some implementations, after obtaining the query status identifier, the query engine module may compare the query status identifier with multiple query status identifiers in the pre-established preset relationship to determine whether the preset mapping relationship includes and acquired The query status identifier is consistent with the query status identifier.
其中,当判断结果表征在预设映射关系中不包括与获取的查询状态标识一致的查询状态标识时,可以确定快照存储模块中不包括与查询状态标识对应的文档标识序列。当判断结果表征在预设映射关系中包括与获取的查询状态标识一致的查询状态标识时,可以继续判断在映射关系中是否存在与获取的查询状态标识一致的查询状态标识对应的文档标识序列,当判断结果表征在映射关系中不存在与获取的查询状态标识一致的查询状态标识对应的文档标识序列,可以确定快照存储模块中不包括与查询状态标识对应的文档标识序列,当判断结果表征在映射关系中存在与获取的查询状态标识一致的查询状态标识对应的文档标识序列,可以确定快照存储模块中包括与查询状态标识对应的文档标识序列。Wherein, when the judgment result indicates that the preset mapping relationship does not include the query status identifier consistent with the acquired query status identifier, it can be determined that the snapshot storage module does not include the document identifier sequence corresponding to the query status identifier. When the judgment result indicates that the preset mapping relationship includes a query state identifier that is consistent with the acquired query state identifier, it can continue to determine whether there is a document identification sequence corresponding to the query state identifier that is consistent with the acquired query state identifier in the mapping relationship. When the judgment result indicates that there is no document identification sequence corresponding to the query state identifier that is consistent with the acquired query state identifier in the mapping relationship, it can be determined that the snapshot storage module does not include the document identification sequence corresponding to the query state identifier. When the judgment result is represented in the There is a document identification sequence corresponding to the query state identifier that is consistent with the acquired query state identifier in the mapping relationship, and it can be determined that the snapshot storage module includes the document identification sequence corresponding to the query state identifier.
步骤S340:当所述快照存储模块中包括与所述查询状态标识对应的文档标识序列时,从所述快照存储模块中获取与所述查询状态标识对应的文档标识序列作为第一文档标识序列。Step S340: When the snapshot storage module includes the document identification sequence corresponding to the query status identifier, obtain the document identification sequence corresponding to the query status identifier from the snapshot storage module as the first document identification sequence.
在一些实施方式中,当判断结果表征快照存储模块中包括与查询状态标识对应的文档标识序列时,表征可以从快照存储模块中获取文档标识序列,以提升所请求数据获取的准确性。因此,在本实施例中,当判断结果表征快照存储模块中包括与查询状态标识对应的文档标识序列时,可以从快照存储模块中获取与查询状态标识对应的文档标识序列,并将获取的文档标识序列作为第一文档标识序列。In some embodiments, when the judgment result characterizes that the snapshot storage module includes a document identification sequence corresponding to the query status identifier, the characterization may obtain the document identification sequence from the snapshot storage module to improve the accuracy of the requested data acquisition. Therefore, in this embodiment, when the judgment result indicates that the snapshot storage module includes a document identification sequence corresponding to the query status identifier, the document identification sequence corresponding to the query status identifier can be obtained from the snapshot storage module, and the acquired document The identification sequence serves as the first document identification sequence.
步骤S350:当所述快照存储模块中不包括与所述查询状态标识对应的文档标识序列时,基于所述查询条件获取所述查询状态标识下的文档标识序列作为第三文档标识序列;Step S350: when the snapshot storage module does not include the document identification sequence corresponding to the query status identifier, obtain the document identification sequence under the query status identifier as a third document identification sequence based on the query condition;
在一些实施方式中,当判断结果表征快照存储模块中不包括与查询状态标识对应的文档标识序列时,表征不能从快照存储模块中获取文档标识序列。因此,在本实施例中,当判断结果表征快照存储模块中不包括与查询状态标识对应的文档标识序列时,可以直接从数据存储模块中查找与分页查询请求对应的数据,并将基于分析查询请求从数据存储模块中获取的数据反馈至用户终端。In some embodiments, when the judgment result characterizes that the snapshot storage module does not include the document identification sequence corresponding to the query status identifier, the characterization cannot obtain the document identification sequence from the snapshot storage module. Therefore, in this embodiment, when the judgment result indicates that the snapshot storage module does not include the document identification sequence corresponding to the query status identifier, the data corresponding to the paging query request can be directly searched from the data storage module, and the query will be based on the analysis. Request the data obtained from the data storage module to be fed back to the user terminal.
在一些实施方式中,当判断结果表征快照存储模块中不包括与查询状态标识对应的文档标识序列时,表征快照存储模块中不包括该查询状态标识或者不包括与该查询状态标识对应的文档标识序列。因此,在本实施例中,当判断结果表征快照存储模块中不包括与查询状态标识对应的文档标识序列时,可以基于查询条件获取文档标识序列,并将获取的文档标识序列作为第三文档标识序列,可以理解的,第三文档标识序列与该查询条件对应的查询状态标识对应,进一步地,该第三文档标识序列还可以与查询条件和用户标识对应的查询状态标识对应。In some embodiments, when the judgment result characterizes that the snapshot storage module does not include the document identification sequence corresponding to the query state identifier, the characterization snapshot storage module does not include the query state identifier or does not include the document identifier corresponding to the query state identifier. sequence. Therefore, in this embodiment, when the judgment result indicates that the snapshot storage module does not include the document identification sequence corresponding to the query status identification, the document identification sequence can be obtained based on the query condition, and the obtained document identification sequence can be used as the third document identification. Sequence, it is understandable that the third document identification sequence corresponds to the query status identifier corresponding to the query condition, and further, the third document identification sequence may also correspond to the query status identifier corresponding to the query condition and the user identifier.
步骤S360:将所述第三文档标识序列写入所述快照存储模块。Step S360: Write the third document identification sequence into the snapshot storage module.
在本实施例中,在获取第三位文档标识序列后,可以将第三文档标识序列写入快照存储模块,以在快照存储模块中记录与查询条件对应的第三文档标识序列。例如,若查询条件为C=(c 1,c 2,...,c n),根据查询条件所获取的所述查询状态标识下的第三文档标识序列为L=(k 1,k 2,k 3,...,k n)时,可以将该查询状态下的第三文档标识序列L=(k 1,k 2,k 3,...,k n)写入快照存储模块。 In this embodiment, after obtaining the third document identification sequence, the third document identification sequence may be written into the snapshot storage module to record the third document identification sequence corresponding to the query condition in the snapshot storage module. For example, if the query condition is C=(c 1 , c 2 ,..., c n ), the third document identification sequence under the query state identifier obtained according to the query condition is L=(k 1 , k 2 , K 3 ,..., k n ), the third document identification sequence L=(k 1 , k 2 , k 3 ,..., k n ) in the query state can be written into the snapshot storage module.
请参阅图7,图7示出了本申请的图6所示的分页数据查询方法的步骤S360的一个实施例的流程示意图,下面将针对图8所示的流程进行详细的阐述,所述方法具体可以包括以下步骤:Please refer to FIG. 7. FIG. 7 shows a schematic flow chart of an embodiment of step S360 of the method for querying paging data shown in FIG. 6 of the present application. The flow shown in FIG. 8 will be described in detail below. Specifically, it can include the following steps:
步骤S361A:建立所述查询状态标识和所述第三文档标识序列的映射关系。Step S361A: Establish a mapping relationship between the query status identifier and the third document identifier sequence.
在一些实施方式中,查询引擎模块在获取查询状态标识下的第三文档标识序列后,可以建立查询状态标识和第三文档标识序列之间的映射关系,例如,可以建立查询状态标识和第三文档标识序列之间的键值对关系等,在此不做限定。In some embodiments, after obtaining the third document identification sequence under the query status identifier, the query engine module may establish a mapping relationship between the query status identifier and the third document identifier sequence. For example, the query status identifier and the third document identifier sequence may be established. The key-value pair relationship between document identification sequences, etc., is not limited here.
步骤S362A:将所述映射关系写入所述快照存储模块。Step S362A: Write the mapping relationship into the snapshot storage module.
在一些实施方式中,在建立查询引擎和第三文档标识序列之间的映射关系后,可以将映射关系写入快照存储模块,以便后续基于查询状态标识对文档标识序列的查询获取。其中,当映射关系为查询状态标识和第三文档标识序列之间的键值对关系时,则可以将查询状态标识和第三文档标识序列以(key,value)的方式写入快照存储模块。例如,若查询条件为C=(c 1,c 2,...,c n),查询状态标识为T,根据查询条件所获取的所述查询状态标识下的第三文档标识序列为L=(k 1,k 2,k 3,...,k n),那么,可以将查询状态标识T和第三文档标识序列L=(k 1,k 2,k 3,...,k n)以(key,value)的方式写入快照存储模块。 In some embodiments, after the mapping relationship between the query engine and the third document identification sequence is established, the mapping relationship may be written into the snapshot storage module, so as to subsequently query and obtain the document identification sequence based on the query status identification. Wherein, when the mapping relationship is a key-value pair relationship between the query status identifier and the third document identifier sequence, the query status identifier and the third document identifier sequence may be written into the snapshot storage module in a (key, value) manner. For example, if the query condition is C=(c 1 , c 2 ,..., c n ), the query status identifier is T, and the third document identifier sequence under the query status identifier obtained according to the query condition is L= (k 1 , k 2 , k 3 ,..., k n ), then the query state identifier T and the third document identifier sequence L=(k 1 , k 2 , k 3 ,..., k n ) Write the snapshot storage module in (key, value) mode.
请参阅图8,图8示出了本申请的图6所示的分页数据查询方法的步骤S360的又一个实施例的流程示意图,下面将针对图8所示的流程进行详细的阐述,所述方法具体可以包括以下步骤:Please refer to FIG. 8. FIG. 8 shows a schematic flow chart of another embodiment of step S360 of the method for querying paging data shown in FIG. 6 of the present application. The flow shown in FIG. 8 will be described in detail below. The method can specifically include the following steps:
步骤S361B:将所述第三文档标识序列写入所述快照存储模块并配置所述第三文档标识序列的过期时间。Step S361B: Write the third document identification sequence into the snapshot storage module and configure the expiration time of the third document identification sequence.
在一些实施方式中,查询引起模块在将第三文档标识序列写入快照存储模块的同时,可以配置该第三文档标识序列的过期时间。其中,该过期时间可以是电子设备默认的时间值,也可以是用户手动配置的时间值,在此不做限定。In some embodiments, the query causing module may configure the expiration time of the third document identification sequence while writing the third document identification sequence to the snapshot storage module. Wherein, the expiration time may be the default time value of the electronic device, or may be a time value manually configured by the user, which is not limited here.
步骤S362B:检测所述第三文档标识序列写入所述快照存储模块的时长。Step S362B: Detect the length of time the third document identification sequence is written into the snapshot storage module.
在一些实施方式中,在将第三文档标识序列写入快照存储模块之后,可以对第三文档标识序列写入快照存储模块的时长进行检测。例如,在将第三文档标识序列写入快照存储模块后,可以启动计时器,以通过计时器对第三文档标识序列写入快照存储模块的时长进行检测。In some embodiments, after the third document identification sequence is written into the snapshot storage module, the length of time the third document identification sequence is written into the snapshot storage module may be detected. For example, after the third document identification sequence is written into the snapshot storage module, a timer can be started to detect the length of time the third document identification sequence is written into the snapshot storage module through the timer.
步骤S363B:当所述时长满足所述过期时间时,从所述快照存储模块中清除所述第三文档标识序列。Step S363B: When the duration meets the expiration time, clear the third document identification sequence from the snapshot storage module.
其中,当检测到第三文档标识序列写入快照存储模块的时长满足过期时间时,可以自动从快照存储模块中清除该第三文档标识序列,从而避免电子设备的内存不足的问题。Wherein, when it is detected that the duration of writing the third document identification sequence into the snapshot storage module meets the expiration time, the third document identification sequence can be automatically cleared from the snapshot storage module, thereby avoiding the problem of insufficient memory of the electronic device.
请参阅图9,图9示出了本申请的图6所示的分页数据查询方法的步骤S360的再一个实施例的流程示意图,下面将针对图9所示的流程进行详细的阐述,所述方法具体可以包括以下步骤:Please refer to FIG. 9. FIG. 9 shows a schematic flowchart of another embodiment of step S360 of the paging data query method shown in FIG. 6 of the present application. The following will describe the flow shown in FIG. 9 in detail. The method can specifically include the following steps:
步骤S361C:将所述第三文档标识序列写入所述快照存储模块并通过所述电子设备的内存进行存储。Step S361C: Write the third document identification sequence into the snapshot storage module and store it in the memory of the electronic device.
在一些实施方式中,快照存储模块中数据可以使用电子设备的内存进行存储,从而保证数据查询的效率。因此,在本实施例中,可以将第三文档标识序列写入快照存储模块并通过电子设备的内存进行存储。当然,在本实施例中,还可以将第三文档标识序列和查询状态标识的映射关系通过电子设备的内存进行存储,在此不做限定。In some embodiments, the data in the snapshot storage module can be stored using the memory of the electronic device, thereby ensuring the efficiency of data query. Therefore, in this embodiment, the third document identification sequence can be written into the snapshot storage module and stored in the memory of the electronic device. Of course, in this embodiment, the mapping relationship between the third document identification sequence and the query status identification can also be stored in the memory of the electronic device, which is not limited here.
步骤S362C:将所述第三文档标识序列从所述电子设备的内存转移到所述电子设备的磁盘进行持久化存储。Step S362C: Transfer the third document identification sequence from the internal memory of the electronic device to the magnetic disk of the electronic device for persistent storage.
进一步地,为了避免快照存储模块在电子设备宕机后数据丢失的问题,还可以将存储在电子设备的内存中的第三文档标识序列从电子设备的内存转移到电子设备的磁盘进行持久化存储。Further, in order to avoid the problem of data loss of the snapshot storage module after the electronic device is down, the third document identification sequence stored in the memory of the electronic device can also be transferred from the memory of the electronic device to the disk of the electronic device for persistent storage. .
请参阅图10,图10示出了本申请的图9所示的分页数据查询方法的步骤S362C的流程示意图,下面将针对图10所示的流程进行详细的阐述,所述方法具体可以包括以下步骤:Please refer to FIG. 10. FIG. 10 shows a schematic flow chart of step S362C of the method for querying paging data shown in FIG. 9 of the present application. The flow shown in FIG. 10 will be described in detail below. The method may specifically include the following step:
步骤S362C1:监测所述电子设备的内存的剩余存储量。Step S362C1: Monitoring the remaining storage capacity of the internal memory of the electronic device.
在一些实施方式中,在将第三文档标识序列写入所述快照存储模块并通过所述电子设备的内存进行存储后,可以监测该电子设备的内存的剩余存储量。其中,可以通过检测电子设备的内存使用情况,并基于内存使用情况和电子设备的内存的总存储量,获取电子设备的内存的剩余存储量。In some embodiments, after the third document identification sequence is written into the snapshot storage module and stored in the memory of the electronic device, the remaining storage capacity of the memory of the electronic device can be monitored. Among them, the remaining storage amount of the memory of the electronic device can be obtained by detecting the memory usage of the electronic device, and based on the memory usage and the total storage amount of the memory of the electronic device.
步骤S362C2:当所述剩余存储量小于指定存储量时,将所述第三文档标识序列从所述电子设备的内存转移到所述电子设备的磁盘进行持久化存储。Step S362C2: When the remaining storage capacity is less than the designated storage capacity, transfer the third document identification sequence from the internal memory of the electronic device to the magnetic disk of the electronic device for persistent storage.
其中,电子设备可以预先设置并存储有指定存储量,该指定存储量用于作为电子设备的内存的剩余存储量的判断依据。因此,在本实施例中,在监测到电子设备的内存的剩余存储量时,可以将剩余存储量和指定存储量进行对比,以判断剩余存储量是否小于指定存储量,其中,当剩余存储量小于指定存储量时,表征电子设备的内存不足,可以将第三文档标识序列从电子设备的内存转移到电子设备的磁盘进行持久化存储,并清除在电子设备的内存存储的第三文档标识序列,以释放电子设备的内存以及避免快照存储模块在电子设备宕机时造成第三文档标识序列丢失。当剩余存储量不小于指定存储量时,表征电子设备的内存充足,可以继续将第三文档标识序列通过电子设备的内存进行存储,以保证数据查询的效率。Wherein, the electronic device may be preset and stored with a designated storage amount, and the designated storage amount is used as a judgment basis for the remaining storage amount of the internal memory of the electronic device. Therefore, in this embodiment, when the remaining storage capacity of the internal memory of the electronic device is monitored, the remaining storage capacity can be compared with the specified storage capacity to determine whether the remaining storage capacity is less than the specified storage capacity, where, when the remaining storage capacity is When it is less than the designated storage capacity, it indicates that the memory of the electronic device is insufficient, and the third document identification sequence can be transferred from the memory of the electronic device to the disk of the electronic device for persistent storage, and the third document identification sequence stored in the memory of the electronic device can be cleared , In order to release the memory of the electronic device and avoid the loss of the third document identification sequence caused by the snapshot storage module when the electronic device is down. When the remaining storage capacity is not less than the designated storage capacity, it indicates that the memory of the electronic device is sufficient, and the third document identification sequence can be stored in the memory of the electronic device to ensure the efficiency of data query.
步骤S370:基于所述分页条件从所述第一文档标识序列中获取文档标识序列作为第二文档标识序列。Step S370: Obtain a document identification sequence from the first document identification sequence as a second document identification sequence based on the paging condition.
步骤S380:基于所述第二文档标识序列生成与所述数据存储模块匹配的查询语句。Step S380: Generate a query sentence matching the data storage module based on the second document identification sequence.
步骤S390:基于所述查询语句从所述数据存储模块中获取与所述第二文档标识序列对应的目标数据并反馈。Step S390: Obtain and feed back target data corresponding to the second document identification sequence from the data storage module based on the query sentence.
其中,步骤S370-步骤S390的具体描述请参阅步骤S240-步骤S260,在此不再赘述。For the specific description of step S370-step S390, please refer to step S240-step S260, which will not be repeated here.
本申请再一个实施例提供的分页数据查询方法,查询引擎模块接收分页查询请求,分页查询请求包括查询条件和分页条件,基于查询条件生成查询状态标识,判断快照存储模块中是否包括与查询状态标识对应的文档标识序列,当包括时,从快照存储模块中获取与查询状态标识对应的文档标识序列作为第一文档标识序列,基于分页条件从第一文档标识序列中获取文档标识序列作为第二文档标识序列,基于第二文档标识序列生成与数据存储模块匹配的查询语句,基于查询语句从数据存储模块中获取与第二文档标识序列对应的目标数据并反馈,当不包括时,基于查询条件获取查询状态标识下的文档标识序列作为第三文档标识序列,将第三文档标识序列写入快照存储模块。相较于图2所示的分页数据查询方法,本实施例还基于查询条件生成查询状态标识,并针对快照存储模块包括与查询状态标识对应的文档标识序列和不包括与查询状态标识对应的文档标识序列的情况,进行不同的处理,以提升文档标识序列获取的准确性和效率。In the paging data query method provided by another embodiment of the present application, the query engine module receives the paging query request, the paging query request includes the query condition and the paging condition, generates the query status identifier based on the query conditions, and determines whether the snapshot storage module includes the query status identifier When the corresponding document identification sequence is included, the document identification sequence corresponding to the query status identification is obtained from the snapshot storage module as the first document identification sequence, and the document identification sequence is obtained from the first document identification sequence based on the paging condition as the second document Identification sequence, based on the second document identification sequence to generate a query statement matching the data storage module, and based on the query statement to obtain the target data corresponding to the second document identification sequence from the data storage module and feedback, when not included, obtain based on the query conditions The document identification sequence under the query status identification is used as the third document identification sequence, and the third document identification sequence is written into the snapshot storage module. Compared with the paging data query method shown in FIG. 2, this embodiment also generates a query status identifier based on query conditions, and includes a document identifier sequence corresponding to the query status identifier and does not include a document corresponding to the query status identifier for the snapshot storage module. In the case of the identification sequence, different processing is performed to improve the accuracy and efficiency of obtaining the document identification sequence.
请参阅图11,图11示出了本申请实施例提供的分页数据查询装置300的模块框图。该分页数据查询装置300应用于上述电子设备,所述电子设备装载有服务系统,所示服务系统包括查询引擎模块、快照存储模块以及数据存储模块,下面将针对图11所示的框图进行阐述,所述分页数据查询装置300包括:分页查询请求接收模块310、第一文档标识序列获取模块320、第二文档标识序列获取模块330以及目标数据获取模块340,其中:Please refer to FIG. 11. FIG. 11 shows a block diagram of a paging data query device 300 provided by an embodiment of the present application. The paging data query device 300 is applied to the above-mentioned electronic equipment, and the electronic equipment is loaded with a service system. The service system shown includes a query engine module, a snapshot storage module, and a data storage module. The following will describe the block diagram shown in FIG. 11. The paging data query device 300 includes: a paging query request receiving module 310, a first document identification sequence acquisition module 320, a second document identification sequence acquisition module 330, and a target data acquisition module 340, wherein:
分页查询请求接收模块310,用于所述查询引擎模块接收分页查询请求,所述分页查询请求包括查询条件和分页条件。The paging query request receiving module 310 is configured to receive the paging query request by the query engine module, where the paging query request includes a query condition and a paging condition.
第一文档标识序列获取模块320,用于从所述快照存储模块中获取与所述查询条件对应的文档标识序列作为第一文档标识序列。The first document identification sequence acquisition module 320 is configured to acquire the document identification sequence corresponding to the query condition from the snapshot storage module as the first document identification sequence.
进一步地,所述第一文档标识序列获取模块320包括:查询状态标识生成子模块和第一文档标识序列获取子模块,其中:Further, the first document identification sequence acquisition module 320 includes: a query status identification generation sub-module and a first document identification sequence acquisition sub-module, wherein:
查询状态标识生成子模块,用于基于所述查询条件生成查询状态标识。The query status identifier generation sub-module is used to generate the query status identifier based on the query conditions.
进一步地,所述分页查询请求还包括用户标识,所述查询状态标识生成子模块包括:查询状态标识生成单元,其中:Further, the paging query request further includes a user identifier, and the query status identifier generating sub-module includes: a query status identifier generating unit, wherein:
查询状态标识生成单元,用于基于所述用户标识和所述查询条件生成所述查询状态标识。The query status identifier generating unit is configured to generate the query status identifier based on the user identifier and the query condition.
第一文档标识序列获取子模块,用于从所述快照存储模块中获取与所述查询状态标识对应的文档标识序列作为第一文档标识序列。The first document identification sequence acquisition sub-module is configured to acquire the document identification sequence corresponding to the query status identification from the snapshot storage module as the first document identification sequence.
进一步地,所述第一文档标识序列获取子模块包括:第一文档标识序列获取单元,其中:Further, the first document identification sequence obtaining sub-module includes: a first document identification sequence obtaining unit, wherein:
第一文档标识序列获取单元,用于基于预设映射关系从所述快照存储模块中获取与所述查询状态标识对应的文档标识序列作为第一文档标识序列,所述预设映射关系包括多个查询状态标识和多个文档标识序列的对应关系。The first document identification sequence acquiring unit is configured to acquire a document identification sequence corresponding to the query status identification from the snapshot storage module based on a preset mapping relationship as a first document identification sequence, and the preset mapping relationship includes a plurality of Query the corresponding relationship between the status identifier and the sequence of multiple document identifiers.
进一步地,所述第一文档标识序列获取子模块包括:快照存储模块判断单元和第一文档标识序列获取单元,其中:Further, the first document identification sequence acquisition sub-module includes: a snapshot storage module judgment unit and a first document identification sequence acquisition unit, wherein:
快照存储模块判断单元,用于基于所述查询状态标识判断所述快照存储模块是否满足指定条件。The snapshot storage module judging unit is configured to judge whether the snapshot storage module satisfies a specified condition based on the query status identifier.
进一步地,所述快照存储模块判断单元包括:Further, the snapshot storage module judgment unit includes:
快照存储模块判断子单元,用于判断所述快照存储模块中是否包括与所述查询状态标识对应的文档标识序列。The snapshot storage module judging subunit is used to judge whether the snapshot storage module includes a document identification sequence corresponding to the query status identification.
第一文档标识序列获取单元,用于当所述快照存储模块满足所述指定条件时,从所述快照存储模块中获取与所述查询状态标识对应的文档标识序列作为第一文档标识序列。The first document identification sequence acquiring unit is configured to acquire the document identification sequence corresponding to the query status identification from the snapshot storage module as the first document identification sequence when the snapshot storage module satisfies the specified condition.
进一步地,所述第一文档标识序列获取单元包括:第一文档标识序列获取子单元、第三文档标识序列获取子单元以及第三文档标识序列写入子单元,其中:Further, the first document identification sequence obtaining unit includes: a first document identification sequence obtaining subunit, a third document identification sequence obtaining subunit, and a third document identification sequence writing subunit, wherein:
第一文档标识序列获取子单元,用于当所述快照存储模块中包括与所述查询状态标识对应的文档标识序列时,从所述快照存储模块中获取与所述查询状态标识对应的文档标识序列作为第一文档标识序列。The first document identification sequence obtaining subunit is configured to obtain the document identification corresponding to the query state identification from the snapshot storage module when the snapshot storage module includes the document identification sequence corresponding to the query state identification The sequence serves as the first document identification sequence.
第三文档标识序列获取子单元,用于当所述快照存储模块中不包括与所述查询状态标识对应的文档标识序列时,基于所述查询条件获取所述查询状态标识下的文档标识序列作为第三文档标识序列;The third document identification sequence obtaining subunit is configured to obtain the document identification sequence under the query state identification based on the query condition when the document identification sequence corresponding to the query state identification is not included in the snapshot storage module as The third document identification sequence;
第三文档标识序列写入子单元,用于将所述第三文档标识序列写入所述快照存储模块。The third document identification sequence writing subunit is used to write the third document identification sequence into the snapshot storage module.
进一步地,所述第三文档标识序列写入子单元包括:映射关系建立子子模块和映射关系写入子子模块,其中:Further, the third document identification sequence writing sub-unit includes: a mapping relationship establishment sub-submodule and a mapping relationship writing sub-submodule, wherein:
映射关系建立子子模块,用于建立所述查询状态标识和所述第三文档标识序列的映射关系。The mapping relationship establishment sub-sub-module is used to establish the mapping relationship between the query status identifier and the third document identifier sequence.
映射关系写入子子模块,用于将所述映射关系写入所述快照存储模块。The mapping relationship writing sub-sub-module is used to write the mapping relationship into the snapshot storage module.
进一步地,所述映射关系写入子子模块包括:映射关系写入子子单元,其中:Further, the mapping relationship writing sub-submodule includes: a mapping relationship writing sub-subunit, wherein:
映射关系写入子子单元,用于将所述查询状态标识和所述第三文档标识序列以键值对的方式写入所述快照存储模块。The mapping relationship writing sub-unit is used to write the query status identifier and the third document identifier sequence into the snapshot storage module in the form of key-value pairs.
进一步地,所述第三文档标识序列写入子单元包括:过期时间配置子子模块、时长检测子子模块以及第三文档标识序列清除子子模块,其中:Further, the third document identification sequence writing subunit includes: an expiration time configuration submodule, a duration detection submodule, and a third document identification sequence clearing submodule, wherein:
过期时间配置子子模块,用于将所述第三文档标识序列写入所述快照存储模块并配置所述第三文档标识序列的过期时间。The expiration time configuration sub-sub-module is configured to write the third document identification sequence into the snapshot storage module and configure the expiration time of the third document identification sequence.
时长检测子子模块,用于检测所述第三文档标识序列写入所述快照存储模块的时长。The time length detection sub-sub-module is used to detect the time length when the third document identification sequence is written into the snapshot storage module.
第三文档标识序列清除子子模块,用于当所述时长满足所述过期时间时,从所述快照存储模块中清除所述第三文档标识序列。The third document identification sequence clearing sub-module is configured to clear the third document identification sequence from the snapshot storage module when the duration meets the expiration time.
进一步地,所述第三文档标识序列写入子单元包括:内存存储子子模块和磁盘存储子子模块,其中:Further, the third document identification sequence writing subunit includes: a memory storage submodule and a disk storage submodule, wherein:
内存存储子子模块,用于将所述第三文档标识序列写入所述快照存储模块并通过所述电子设备的内存进行存储。The memory storage sub-module is used to write the third document identification sequence into the snapshot storage module and store it in the memory of the electronic device.
磁盘存储子子模块,用于将所述第三文档标识序列从所述电子设备的内存转移到所述电子设备的磁盘进行持久化存储。The disk storage sub-module is used to transfer the third document identification sequence from the memory of the electronic device to the disk of the electronic device for persistent storage.
进一步地,所述磁盘存储子子模块包括:剩余存储量监测子子单元和磁盘存储子子单元,其中:Further, the disk storage sub-sub-module includes a remaining storage capacity monitoring sub-sub-unit and a disk storage sub-sub-unit, wherein:
剩余存储量监测子子单元,用于监测所述电子设备的内存的剩余存储量。The remaining storage capacity monitoring sub-unit is used to monitor the remaining storage capacity of the internal memory of the electronic device.
磁盘存储子子单元,用于当所述剩余存储量小于指定存储量时,将所述第三文档标识序列从所述电子设备的内存转移到所述电子设备的磁盘进行持久化存储。The disk storage sub-unit is configured to transfer the third document identification sequence from the memory of the electronic device to the disk of the electronic device for persistent storage when the remaining storage amount is less than the designated storage amount.
进一步地,所述第一文档标识序列获取单元包括:数据存储模块查找子单元,其中:Further, the first document identification sequence obtaining unit includes: a data storage module searching subunit, wherein:
数据存储模块查找子单元,用于当所述快照存储模块中不包括与所述查询状态标识对应的文档标识序列时,直接从所述数据存储模块中查找与所述分页查询请求对应的数据并反馈。The data storage module search subunit is configured to directly search the data storage module for the data corresponding to the paging query request when the snapshot storage module does not include the document identification sequence corresponding to the query status identifier. Feedback.
第二文档标识序列获取模块330,用于基于所述分页条件从所述第一文档标识序列中获取文档标识序列作为第二文档标识序列。The second document identification sequence obtaining module 330 is configured to obtain a document identification sequence from the first document identification sequence as a second document identification sequence based on the paging condition.
目标数据获取模块340,用于从所述数据存储模块中获取与所述第二文档标识序列对应的目标数据并反馈。The target data obtaining module 340 is configured to obtain and feed back target data corresponding to the second document identification sequence from the data storage module.
进一步地,所述目标数据获取模块340包括:查询语句生成子模块和目标数据获取子模块,其中:Further, the target data acquisition module 340 includes: a query statement generation sub-module and a target data acquisition sub-module, wherein:
查询语句生成子模块,用于基于所述第二文档标识序列生成与所述数据存储模块匹配的查询语句。The query statement generation sub-module is configured to generate a query statement matching the data storage module based on the second document identification sequence.
进一步地,所述查询语句生成子模块包括:语句格式确定单元和查询语句生成单元,其中:Further, the query statement generation sub-module includes: a statement format determination unit and a query statement generation unit, wherein:
语句格式确定单元,用于确定所述数据存储模块所支持的语句格式。The sentence format determining unit is used to determine the sentence format supported by the data storage module.
查询语句生成单元,用于基于所述第二文档标识序列生成所述查询语句,所述查询语句的格式与所述数据存储模块所支持的语句格式一致。The query statement generating unit is configured to generate the query statement based on the second document identification sequence, and the format of the query statement is consistent with the statement format supported by the data storage module.
目标数据获取子模块,用于基于所述查询语句从所述数据存储模块中获取与所述第二文档标识序列对应的目标数据并反馈。The target data obtaining sub-module is configured to obtain and feed back target data corresponding to the second document identification sequence from the data storage module based on the query sentence.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process of the device and module described above can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,模块相互之间的耦合可以是电性,机械或其它形式的耦合。In the several embodiments provided in this application, the coupling between the modules may be electrical, mechanical or other forms of coupling.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or software function modules.
请参阅图12,其示出了本申请实施例提供的一种电子设备100的结构框图。该电子设备100可以是智能手机、平板电脑、电子书等能够运行应用程序的电子设备。本申请中的电子设备100可以包括一个或多个如下部件:处理器110、存储器120、服务系统130以及一个或多个应用程序,其中一个或多个应用程序可以被存储在存储器120中并被配置为由一个或多个处理器110执行,一个或多个程序配置用于执行如前述方法实施例所描述的方法。所述服务系统包括查询引擎模块131、快照存储模块132以及数据存储模块133。Please refer to FIG. 12, which shows a structural block diagram of an electronic device 100 provided by an embodiment of the present application. The electronic device 100 may be an electronic device capable of running application programs, such as a smart phone, a tablet computer, or an e-book. The electronic device 100 in this application may include one or more of the following components: a processor 110, a memory 120, a service system 130, and one or more application programs, of which one or more application programs may be stored in the memory 120 and be It is configured to be executed by one or more processors 110, and one or more programs are configured to execute the method described in the foregoing method embodiment. The service system includes a query engine module 131, a snapshot storage module 132, and a data storage module 133.
其中,处理器110可以包括一个或者多个处理核。处理器110利用各种接口和线路连接整个电子设备100内的各个部分,通过运行或执行存储在存储器120内的指令、程序、代码集或指令集,以及调用存储在存储器120内的数据,执行电子设备100的各种功能和处理数据。可选地,处理器110可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器110可集成中央处理器(Central Processing Unit,CPU)、图形处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责待显示内容的渲染和绘制;调制解调器用于处理无线通 信。可以理解的是,上述调制解调器也可以不集成到处理器110中,单独通过一块通信芯片进行实现。The processor 110 may include one or more processing cores. The processor 110 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and calling data stored in the memory 120. Various functions and processing data of the electronic device 100. Optionally, the processor 110 may adopt at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). A kind of hardware form to realize. The processor 110 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is used to render and draw the content to be displayed; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 110, but may be implemented by a communication chip alone.
存储器120可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器120可用于存储指令、程序、代码、代码集或指令集。存储器120可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储终端100在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。The memory 120 may include random access memory (RAM) or read-only memory (Read-Only Memory). The memory 120 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 120 may include a program storage area and a data storage area, where the program storage area may store instructions for implementing the operating system and instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.) , Instructions used to implement the following various method embodiments, etc. The data storage area can also store data (such as phone book, audio and video data, chat record data) created by the terminal 100 during use.
请参阅图13,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读介质400中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。Please refer to FIG. 13, which shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. The computer-readable medium 400 stores program code, and the program code can be invoked by a processor to execute the method described in the foregoing method embodiment.
计算机可读存储介质400可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质400包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质400具有执行上述方法中的任何方法步骤的程序代码410的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码410可以例如以适当形式进行压缩。The computer-readable storage medium 400 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 400 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 400 has a storage space for executing the program code 410 of any method step in the above-mentioned method. These program codes can be read from or written into one or more computer program products. The program code 410 may be compressed in a suitable form, for example.
综上所述,本申请实施例提供的分页数据查询方法、装置、电子设备以及存储介质,查询引擎模块接收分页查询请求,该分页查询请求包括查询条件和分页条件,从快照存储模块中获取与查询条件对应的文档标识序列作为第一文档标识序列,基于分页条件从第一文档标识序列中获取文档标识序列作为第二文档标识序列,从数据存储模块中获取与第二文档标识序列对应的目标数据并反馈,从而通过快照存储模块存储文档标识序列,并根据分页查询请求中的查询条件和分页条件从文档标识序列中确定正确的文档标识序列,以提升分页查询的准确性和效率。In summary, in the paging data query method, device, electronic device, and storage medium provided by the embodiments of the present application, the query engine module receives the paging query request, and the paging query request includes the query conditions and the paging conditions, which are obtained from the snapshot storage module. The document identification sequence corresponding to the query condition is used as the first document identification sequence, the document identification sequence is obtained from the first document identification sequence based on the paging condition as the second document identification sequence, and the target corresponding to the second document identification sequence is obtained from the data storage module Data and feedback are used to store the document identification sequence through the snapshot storage module, and the correct document identification sequence is determined from the document identification sequence according to the query conditions and paging conditions in the paging query request, so as to improve the accuracy and efficiency of the paging query.
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the application, not to limit them; although the application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions recorded in the foregoing embodiments are modified, or some of the technical features thereof are equivalently replaced; these modifications or replacements do not drive the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (20)

  1. 一种分页数据查询方法,其特征在于,应用于电子设备的服务系统,所述服务系统包括查询引擎模块、快照存储模块以及数据存储模块,所述方法包括:A method for querying paging data, characterized in that it is applied to a service system of an electronic device, the service system includes a query engine module, a snapshot storage module, and a data storage module, and the method includes:
    所述查询引擎模块接收分页查询请求,所述分页查询请求包括查询条件和分页条件;The query engine module receives a paging query request, where the paging query request includes a query condition and a paging condition;
    从所述快照存储模块中获取与所述查询条件对应的文档标识序列作为第一文档标识序列;Acquiring the document identification sequence corresponding to the query condition from the snapshot storage module as the first document identification sequence;
    基于所述分页条件从所述第一文档标识序列中获取文档标识序列作为第二文档标识序列;Acquiring a document identification sequence from the first document identification sequence as a second document identification sequence based on the paging condition;
    从所述数据存储模块中获取与所述第二文档标识序列对应的目标数据并反馈。Obtain and feed back target data corresponding to the second document identification sequence from the data storage module.
  2. 根据权利要求1所述的方法,其特征在于,所述从所述快照存储模块中获取与所述查询条件对应的文档标识序列作为第一文档标识序列,包括:The method according to claim 1, wherein the obtaining the document identification sequence corresponding to the query condition from the snapshot storage module as the first document identification sequence comprises:
    基于所述查询条件生成查询状态标识;Generating a query status identifier based on the query condition;
    从所述快照存储模块中获取与所述查询状态标识对应的文档标识序列作为第一文档标识序列。Obtain the document identification sequence corresponding to the query status identification from the snapshot storage module as the first document identification sequence.
  3. 根据权利要求2所述的方法,其特征在于,所述分页查询请求还包括用户标识,所述基于所述查询条件生成查询状态标识,包括:The method according to claim 2, wherein the paging query request further includes a user identification, and the generating a query status identification based on the query condition includes:
    基于所述用户标识和所述查询条件生成所述查询状态标识。The query status identifier is generated based on the user identifier and the query condition.
  4. 根据权利要求2或3所述的方法,其特征在于,所述从所述快照存储模块中获取与所述查询状态标识对应的文档标识序列作为第一文档标识序列,包括:The method according to claim 2 or 3, wherein the acquiring the document identification sequence corresponding to the query status identification from the snapshot storage module as the first document identification sequence comprises:
    基于预设映射关系从所述快照存储模块中获取与所述查询状态标识对应的文档标识序列作为第一文档标识序列,所述预设映射关系包括多个查询状态标识和多个文档标识序列的对应关系。The document identification sequence corresponding to the query state identifier is acquired from the snapshot storage module based on a preset mapping relationship as the first document identification sequence, and the preset mapping relationship includes a plurality of query state identifiers and multiple document identification sequences. Correspondence.
  5. 根据权利要求2-4任一项所述的方法,其特征在于,所述从所述快照存储模块中获取与所述查询状态标识对应的文档标识序列作为第一文档标识序列,包括:The method according to any one of claims 2 to 4, wherein the obtaining the document identification sequence corresponding to the query status identification from the snapshot storage module as the first document identification sequence comprises:
    基于所述查询状态标识判断所述快照存储模块是否满足指定条件;Judging whether the snapshot storage module satisfies a specified condition based on the query status identifier;
    当所述快照存储模块满足所述指定条件时,从所述快照存储模块中获取与所述查询状态标识对应的文档标识序列作为第一文档标识序列。When the snapshot storage module satisfies the specified condition, obtain the document identification sequence corresponding to the query status identifier from the snapshot storage module as the first document identification sequence.
  6. 根据权利要求5所述的方法,其特征在于,所述基于所述查询状态标识判断所述快照存储模块是否满足指定条件,包括:The method according to claim 5, wherein the judging whether the snapshot storage module satisfies a specified condition based on the query status identifier comprises:
    判断所述快照存储模块中是否包括与所述查询状态标识对应的文档标识序列;Judging whether the snapshot storage module includes a document identification sequence corresponding to the query status identification;
    所述当所述快照存储模块满足所述指定条件时,从所述快照存储模块中获取与所述查询状态标识对应的文档标识序列作为第一文档标识序列,包括:When the snapshot storage module satisfies the specified condition, acquiring the document identification sequence corresponding to the query status identifier from the snapshot storage module as the first document identification sequence includes:
    当所述快照存储模块中包括与所述查询状态标识对应的文档标识序列时,从所述快照存储模块中获取与所述查询状态标识对应的文档标识序列作为第一文档标识序列。When the snapshot storage module includes the document identification sequence corresponding to the query status identifier, the document identification sequence corresponding to the query status identifier is obtained from the snapshot storage module as the first document identification sequence.
  7. 根据权利要求6所述的方法,其特征在于,所述方法还包括:The method according to claim 6, wherein the method further comprises:
    当所述快照存储模块中不包括与所述查询状态标识对应的文档标识序列时,基于所述查询条件获取所述查询状态标识下的文档标识序列作为第三文档标识序列;When the snapshot storage module does not include the document identification sequence corresponding to the query status identifier, acquiring the document identification sequence under the query status identifier as a third document identification sequence based on the query condition;
    将所述第三文档标识序列写入所述快照存储模块。The third document identification sequence is written into the snapshot storage module.
  8. 根据权利要求7所述的方法,其特征在于,所述将所述第三文档标识序列写入所述快照存储模块,包括:The method according to claim 7, wherein the writing the third document identification sequence to the snapshot storage module comprises:
    建立所述查询状态标识和所述第三文档标识序列的映射关系;Establishing a mapping relationship between the query status identifier and the third document identifier sequence;
    将所述映射关系写入所述快照存储模块。Write the mapping relationship into the snapshot storage module.
  9. 根据权利要求8所述的方法,其特征在于,所述将所述映射关系写入所述快照存储模块,包括:The method according to claim 8, wherein the writing the mapping relationship into the snapshot storage module comprises:
    将所述查询状态标识和所述第三文档标识序列以键值对的方式写入所述快照存储模 块。The query status identifier and the third document identifier sequence are written into the snapshot storage module in the form of key-value pairs.
  10. 根据权利要求7-9任一项所述的方法,其特征在于,所述将所述第三文档标识序列写入所述快照存储模块,包括:The method according to any one of claims 7-9, wherein the writing the third document identification sequence into the snapshot storage module comprises:
    将所述第三文档标识序列写入所述快照存储模块并配置所述第三文档标识序列的过期时间。Write the third document identification sequence into the snapshot storage module and configure the expiration time of the third document identification sequence.
  11. 根据权利要求10所述的方法,其特征在于,所述将所述第三文档标识序列写入所述快照存储模块并配置所述第三文档序列的过期时间后,包括:The method according to claim 10, wherein after the writing the third document identification sequence into the snapshot storage module and configuring the expiration time of the third document sequence comprises:
    检测所述第三文档标识序列写入所述快照存储模块的时长;Detecting the length of time the third document identification sequence is written into the snapshot storage module;
    当所述时长满足所述过期时间时,从所述快照存储模块中清除所述第三文档标识序列。When the duration meets the expiration time, the third document identification sequence is cleared from the snapshot storage module.
  12. 根据权利要求7-9任一项所述的方法,其特征在于,所述将所述第三文档标识序列写入所述快照存储模块,包括:The method according to any one of claims 7-9, wherein the writing the third document identification sequence into the snapshot storage module comprises:
    将所述第三文档标识序列写入所述快照存储模块并通过所述电子设备的内存进行存储;Writing the third document identification sequence into the snapshot storage module and storing it in the memory of the electronic device;
    将所述第三文档标识序列从所述电子设备的内存转移到所述电子设备的磁盘进行持久化存储。The third document identification sequence is transferred from the internal memory of the electronic device to the magnetic disk of the electronic device for persistent storage.
  13. 根据权利要求12所述的方法,其特征在于,所述将所述第三文档标识序列从所述电子设备的内存转移到所述电子设备的磁盘进行持久化存储,包括:The method according to claim 12, wherein the transferring the third document identification sequence from the memory of the electronic device to the disk of the electronic device for persistent storage comprises:
    监测所述电子设备的内存的剩余存储量;Monitoring the remaining storage capacity of the internal memory of the electronic device;
    当所述剩余存储量小于指定存储量时,将所述第三文档标识序列从所述电子设备的内存转移到所述电子设备的磁盘进行持久化存储。When the remaining storage capacity is less than the designated storage capacity, the third document identification sequence is transferred from the internal memory of the electronic device to the magnetic disk of the electronic device for persistent storage.
  14. 根据权利要求6-13任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 6-13, wherein the method further comprises:
    当所述快照存储模块中不包括与所述查询状态标识对应的文档标识序列时,直接从所述数据存储模块中查找与所述分页查询请求对应的数据并反馈。When the snapshot storage module does not include the document identification sequence corresponding to the query status identifier, the data corresponding to the paged query request is directly searched from the data storage module and fed back.
  15. 根据权利要求1-14任一项所述的方法,其特征在于,所述从所述数据存储模块模块中获取与所述第二文档标识序列对应的目标数据并反馈,包括:The method according to any one of claims 1-14, wherein the obtaining and feeding back target data corresponding to the second document identification sequence from the data storage module module comprises:
    基于所述第二文档标识序列生成与所述数据存储模块匹配的查询语句;Generating a query sentence matching the data storage module based on the second document identification sequence;
    基于所述查询语句从所述数据存储模块中获取与所述第二文档标识序列对应的目标数据并反馈。Obtain and feed back target data corresponding to the second document identification sequence from the data storage module based on the query sentence.
  16. 根据权利要求15所述的方法,其特征在于,所述基于所述第二文档标识序列生成与所述数据存储模块匹配的查询语句,包括:The method according to claim 15, wherein the generating a query sentence matching the data storage module based on the second document identification sequence comprises:
    确定所述数据存储模块所支持的语句格式;Determine the sentence format supported by the data storage module;
    基于所述第二文档标识序列生成所述查询语句,所述查询语句的格式与所述数据存储模块所支持的语句格式一致。The query statement is generated based on the second document identification sequence, and the format of the query statement is consistent with the statement format supported by the data storage module.
  17. 一种分页数据查询装置,其特征在于,应用于电子设备的服务系统,所述服务系统包括查询引擎模块、快照存储模块以及数据存储模块,所述装置包括:A paging data query device, characterized in that it is applied to a service system of electronic equipment, the service system includes a query engine module, a snapshot storage module, and a data storage module, and the device includes:
    分页查询请求接收模块,用于所述查询引擎模块接收分页查询请求,所述分页查询请求包括查询条件和分页条件;The paging query request receiving module is used for the query engine module to receive a paging query request, where the paging query request includes a query condition and a paging condition;
    第一文档标识序列获取模块,用于从所述快照存储模块中获取与所述查询条件对应的文档标识序列作为第一文档标识序列;The first document identification sequence acquisition module is configured to acquire the document identification sequence corresponding to the query condition from the snapshot storage module as the first document identification sequence;
    第二文档标识序列获取模块,用于基于所述分页条件从所述第一文档标识序列中获取文档标识序列作为第二文档标识序列;A second document identification sequence obtaining module, configured to obtain a document identification sequence from the first document identification sequence as a second document identification sequence based on the paging condition;
    目标数据获取模块,用于从所述数据存储模块中获取与所述第二文档标识序列对应的目标数据并反馈。The target data acquisition module is configured to acquire and feed back target data corresponding to the second document identification sequence from the data storage module.
  18. 根据权利要求17所述的装置,所述第一文档标识序列获取模块包括:The apparatus according to claim 17, wherein the first document identification sequence obtaining module comprises:
    查询状态标识生成子模块,用于基于所述查询条件生成查询状态标识;The query status identifier generation sub-module is used to generate the query status identifier based on the query conditions;
    第一文档标识序列获取子模块,用于从所述快照存储模块中获取与所述查询状态标识 对应的文档标识序列作为第一文档标识序列。The first document identification sequence acquisition sub-module is configured to acquire the document identification sequence corresponding to the query status identification from the snapshot storage module as the first document identification sequence.
  19. 一种电子设备,其特征在于,包括存储器和处理器,所述存储器耦接到所述处理器,所述存储器存储指令,当所述指令由所述处理器执行时所述处理器执行如权利要求1-16任一项所述的方法。An electronic device, comprising a memory and a processor, the memory is coupled to the processor, the memory stores instructions, and the processor executes the instructions when the instructions are executed by the processor. The method described in any one of 1-16 is required.
  20. 一种计算机可读取存储介质,其特征在于,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行如权利要求1-16任一项所述的方法。A computer-readable storage medium, wherein the computer-readable storage medium stores program code, and the program code can be called by a processor to execute the method according to any one of claims 1-16 .
PCT/CN2019/115397 2019-11-04 2019-11-04 Paging data query method and apparatus, electronic device, and storage medium WO2021087679A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/115397 WO2021087679A1 (en) 2019-11-04 2019-11-04 Paging data query method and apparatus, electronic device, and storage medium
CN201980099816.5A CN114286995A (en) 2019-11-04 2019-11-04 Paging data query method, paging data query device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/115397 WO2021087679A1 (en) 2019-11-04 2019-11-04 Paging data query method and apparatus, electronic device, and storage medium

Publications (1)

Publication Number Publication Date
WO2021087679A1 true WO2021087679A1 (en) 2021-05-14

Family

ID=75848713

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/115397 WO2021087679A1 (en) 2019-11-04 2019-11-04 Paging data query method and apparatus, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN114286995A (en)
WO (1) WO2021087679A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113254271A (en) * 2021-06-09 2021-08-13 上海达梦数据库有限公司 Data sequence recovery method, device, equipment and storage medium
CN113254271B (en) * 2021-06-09 2024-05-31 上海达梦数据库有限公司 Data sequence recovery method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105653537A (en) * 2014-11-13 2016-06-08 阿里巴巴集团控股有限公司 Paging query method and device for database application system
CN105843958A (en) * 2016-04-15 2016-08-10 北京思特奇信息技术股份有限公司 Cache-based server paging method and system
CN105843956A (en) * 2016-04-14 2016-08-10 北京搜狐新媒体信息技术有限公司 Paging query method and system
CN106446080A (en) * 2016-09-09 2017-02-22 华为技术有限公司 Data query method, query service device, client device and data system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105653537A (en) * 2014-11-13 2016-06-08 阿里巴巴集团控股有限公司 Paging query method and device for database application system
CN105843956A (en) * 2016-04-14 2016-08-10 北京搜狐新媒体信息技术有限公司 Paging query method and system
CN105843958A (en) * 2016-04-15 2016-08-10 北京思特奇信息技术股份有限公司 Cache-based server paging method and system
CN106446080A (en) * 2016-09-09 2017-02-22 华为技术有限公司 Data query method, query service device, client device and data system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113254271A (en) * 2021-06-09 2021-08-13 上海达梦数据库有限公司 Data sequence recovery method, device, equipment and storage medium
CN113254271B (en) * 2021-06-09 2024-05-31 上海达梦数据库有限公司 Data sequence recovery method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN114286995A (en) 2022-04-05

Similar Documents

Publication Publication Date Title
KR101932395B1 (en) Activity continuation between electronic devices
US20170310740A1 (en) Method, Apparatus, and System for Distributing Information in Graphic Code
WO2016155379A1 (en) Method, device and system for dynamically acquiring app interface control data
CN107247722B (en) File scanning method and device and intelligent terminal
CN111124173B (en) Working state switching method and device of touch screen, mobile terminal and storage medium
WO2019128357A1 (en) Picture requesting method, method for responding to picture request, and client
US20160110376A1 (en) Method and Apparatus for Generating Multimedia File
WO2018107575A1 (en) Modification reminder method, device, and terminal, and storage medium
JP6932360B2 (en) Object search method, device and server
WO2021057164A1 (en) Query method and device for blockchain ledger, and apparatus
US9706006B2 (en) System and method of context aware adaption of content for a mobile device
WO2021081920A1 (en) Information pushing method and apparatus, server, and storage medium
WO2023020247A1 (en) Method and apparatus for precision reduction of time series index data, and computer device
WO2021189195A1 (en) Data querying method and apparatus, server, and storage medium
CN105988941B (en) Cache data processing method and device
WO2018223936A1 (en) Method and system for interaction between ap and modem, and storage medium
WO2021077375A1 (en) Communication frequency adjustment method and apparatus, and electronic device and storage medium
US20160315997A1 (en) File transfer method, device, and system
WO2021087679A1 (en) Paging data query method and apparatus, electronic device, and storage medium
CN110865985A (en) Data synchronization method and device, electronic equipment and storage medium
CN105577878A (en) Short message classification and arrangement device, method and mobile terminal
WO2021077740A1 (en) Method for querying cpld version information, device, and medium
US11137964B2 (en) Information processing apparatus and non-transitory computer readable medium
KR101521780B1 (en) Continuous data delivery with energy conservation
WO2017016335A1 (en) Method, system, and server for eliminating message prompt

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19951827

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19951827

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 281022)

122 Ep: pct application non-entry in european phase

Ref document number: 19951827

Country of ref document: EP

Kind code of ref document: A1