Paging query method, electronic device and computer-readable storage medium
By building new query conditions in the MongoDB database and combining the find-limit method, the problem of inefficient pagination query of massive remote sensing data is solved, efficient pagination query is realized, and the characteristics of remote sensing data are suitable for the characteristics and query efficiency is improved.
Patent Information
- Application Number
- CN201911397975.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-30
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2039-12-30
AI Technical Summary
When processing massive remote sensing data, the pagination query efficiency is inefficient, especially the characteristics of remote sensing data (images with the same shooting date and descending date sorting) make the skip-limit method unapplicable, resulting in difficulty in selecting keywords and unable to be effectively carried out. Pagination search.
When querying on non-home page, new query conditions are constructed based on query conditions and the last data of the current page. Use the find-limit method to query data, return a limited number of data, and use the countDocuments method to calculate the total number of data for paging when querying on home page. Query.
By building new query conditions, the need to traverse all data is avoided, the efficiency of paging query is improved, and the search time is reduced. It is suitable for paging query of massive remote sensing data, and there is no need for where function filtering queries, and the time to store keywords is zero.
Smart Images

Figure CN113127500B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of paging query, and in particular, to a paging query method electronic device and a computer-readable storage medium. Background Art
[0002] With the rapid development of cloud computing, the Internet and other technologies, more and more data of different contents and forms have emerged. The use of semi-structured data and unstructured data has made current system applications more and more colorful. In the face of the storage of massive data, the original relational database has become incapable. The emergence of big data and the prevalence of cloud computing have made unstructured databases such as NoSQL more and more valued. NoSQL databases have attracted more and more attention with their rich query technology. Among them, MongoDB is a typical representative of NoSQL databases. MongoDB database is a distributed, document-oriented storage database. Written in C++. It aims to provide scalable and high-performance data storage solutions for WEB applications. It is a product between relational databases and non-relational databases. It is the most feature-rich and relational database-like non-relational database.
[0003] Specifically, the MongoDB database uses the skip-limit method to paginate data. This pagination method is more efficient when the amount of data is small and the amount of concurrent access is small, but when the amount of data reaches millions or tens of millions, the paging retrieval efficiency is very low. However, the amount of remote sensing data is often at least millions of levels. Given the massive nature of remote sensing data, the skip-limit method of MongoDB is no longer applicable. The specific operations of the skip-limit method are as follows:
[0004] (1) Set the query conditions and use the find method on a collection in the current database;
[0005] (2) Set the number of skipped records and use the skip method on the returned result set to find the first record position of the page you want to display;
[0006] (3) Use the limit method to limit the number of records returned. The general formula can be expressed as: db.collection.find({M}).skip((n-1)*N).limit(N), where M represents the query condition, n represents the number of pages, and N represents the amount of data on a page.
[0007] In order to solve the problem of low efficiency of paging retrieval of massive data in skip-limit, a new page query method is introduced in the existing solution. The main idea of this query method is to directly locate the keyword of the previous data of the query page through the index, and then use the where function and limit function to find and locate the data. It does not need to traverse all the data, and quickly obtain the data accessed by the user. It is a data paging optimization method based on MongoDB. The above where-limit method obtains keywords according to the query conditions and stores them in an array; then the where function is used to filter the results obtained according to the query conditions again. By analyzing the entire process of the where-limit method, it is found that the selection of keywords is particularly important. In most Web information systems, the search is carried out in ascending or descending order of date, so the date is generally used as the keyword. If the data itself does not have a keyword, the ObjectID provided by MongoDB can be used for query.
[0008] The above two methods are very useful in most cases, but they are not suitable in other cases, such as remote sensing data retrieval, because of the characteristics of remote sensing data itself:
[0009] (1) The retrieval order of remote sensing data is in descending order of shooting date. There may be multiple images with the same shooting date. If the date is simply used as a keyword, there may be a situation where multiple images will not be searched.
[0010] (2) The retrieval of remote sensing data needs to be displayed in descending order of date, and ObjectID is no longer suitable as a keyword.
[0011] Due to the problems of low efficiency and inability to select keywords, the where-limit method is no longer suitable for paginated retrieval of remote sensing data.
[0012] Therefore, how to design a page query method that is more suitable for massive remote sensing data has become an urgent problem to be solved. Summary of the invention
[0013] The present invention aims to solve at least one of the technical problems existing in the prior art or related art.
[0014] To this end, in a first aspect of the present invention, a paging query method is proposed. Specifically, the method comprises:
[0015] When searching on a non-homepage page, a new query condition is constructed based on the query condition and the last piece of data on the current page;
[0016] According to the new query condition, the find-limit method is used to perform data query and return a limited number of data, wherein returning a limited number of data means returning data of a specified page.
[0017] Based on the above solution, the paging query method also includes:
[0018] When searching on the home page, the countDocuments method is used according to the query conditions to calculate the total number of data that meet the query conditions, and the find-limit method is used according to the query conditions to query data and return a limited number of data.
[0019] Based on the above solution, the paging query method also includes: storing the last piece of data of the current page through the Web front end before constructing a new query condition.
[0020] In any of the above solutions, preferably, the paging query method is a paging query method for remote sensing data.
[0021] In any of the above solutions, preferably, the step of constructing a new query condition according to the query condition and the last piece of data on the current page includes:
[0022] According to the content of the first keyword corresponding to the last data of the current page, the condition range corresponding to the first keyword in the query condition is narrowed down, and other conditions in the query condition are retained.
[0023] In any of the above solutions, preferably, the step of constructing a new query condition according to the query condition and the last piece of data on the current page further includes:
[0024] When it is determined that the number of data items including the first keyword on the current page is greater than 1, an exclusion item is added to the new query condition if the content of the last data item on the current page is not simultaneously valid.
[0025] In any of the above solutions, preferably, the first keyword is a keyword that can be displayed by a numerical range, such as date, angle, resolution, cloud cover, sun altitude angle, surname strokes, etc. Or the first keyword is a keyword that can represent a certain range, such as region. The region can be a Chinese region or a foreign region.
[0026] Further preferably, when performing a paginated query on remote sensing data, the first keyword is date, and the remaining keywords include: one or more of region, resolution, cloud cover, solar altitude angle and satellite model.
[0027] In any of the above solutions, preferably, the step of using the find-limit method to query data and return a limited number of data specifically includes:
[0028] Arrange the query result data in ascending or descending order according to the first keyword, and sort multiple data with the same keyword again according to the next keyword in the order;
[0029] A limited number of data are returned based on the total number of data that meet the query conditions and the limited number of data per page.
[0030] In any of the above solutions, preferably, the step of narrowing down the scope of conditions corresponding to the first keyword in the query conditions according to the content of the first keyword corresponding to the last data of the current page specifically includes:
[0031] Determine the first keyword based on which the query result data is sorted;
[0032] Determine the content corresponding to the first keyword in the last piece of data on the current page, and then narrow the condition range of the first keyword in the query condition according to the content corresponding to the first keyword in the last piece of data.
[0033] Specifically, when the data is arranged in descending order, the content corresponding to the first keyword in the last data is used as the right limit range of the first keyword in the new query condition. For example, in the query condition, the condition range of the first keyword is AB, and the content corresponding to the first keyword is C, then the condition range of the first keyword in the new query condition is AC. When the data is arranged in ascending order, the condition range of the first keyword in the new query condition is CB.
[0034] The paging query method provided by the technical solution of the present invention is preferably used in remote sensing image data, wherein remote sensing image (abbreviated as: RS, English: Remote Sensing Image) refers to a film or photo that records the size of electromagnetic waves of various ground objects, mainly divided into aerial photographs and satellite photos. When the paging query method performs a non-homepage query, a new query condition is constructed based on the query condition and the last data of the current page, and then the new query condition is used to use the find-limit method to perform data query and return a limited number of data. For most query methods, after the results are queried, they will be arranged in ascending or descending order according to pre-set keywords, such as date or angle, and when further paging query is performed for this type of data, the last data content of the current page, such as the date in the last data, and the original query condition can be recombined into a new query condition, and then the query and data display are performed according to the new query condition. Specifically, for example, in the result data displayed in ascending or descending order according to the date, the date in the last data of the current page can be used as the starting point or end point of the date range in the new query condition, so that the data greater than or less than the date node can be queried through the new query condition, and then the normal data paging query and display can be performed. After that, the operation can be repeated until the paging query of all pages is realized. This query method directly returns the last data of the previous page from the Web front end, so there is no need to store the keywords of the data, and the time required to store the keywords of the data is zero. At the same time, this query method does not require the where function to perform filtering query again. The entire paging query only needs the find method and the limit method, which minimizes the retrieval date and improves the retrieval efficiency.
[0035] The technical solution of the present invention is further explained below with reference to specific examples: The query conditions for remote sensing data are: date range: 2018-01-01 to 2019-10-01, resolution: 0 to 10, cloud cover: 0 to 20 (percentage), solar altitude angle: 45° to 80°, satellite: GF, longitude and latitude range: China area. There are 7069 data in the database that meet the conditions (these 7069 data have been sorted in descending order by date). If the user wants to query the data on page 300 (10 data on one page), the last data on page 299 is: date: 2019-01-12, resolution: 2, cloud cover: 5, solar altitude angle: 50°, satellite: GF, longitude and latitude range: Beijing area. When constructing a new query condition, since the date of 2019-01-12 has been queried, there is no need to query the data after 2019-01-12 when querying again, only the data before 2019-01-12 needs to be queried. Therefore, the date range in the query condition: 2018-01-01 to 2019-10-01 can be modified to 2018-01-01 to 019-01-12. The rest of the conditions remain unchanged, namely, resolution: 0 to 10, cloud cover: 0 to 20 (percentage), solar altitude angle: 45° to 80°, satellite: GF, longitude and latitude range: China area. At the same time, in order to prevent the last data from being displayed repeatedly, it is preferred to exclude the content of the last data, and in the specific operation, one condition can be added to the new query condition: resolution equals 2, cloud cover equals 5, solar altitude angle equals 50°, satellite equals GF, and these four conditions are not met at the same time. In this way, the new query condition can query a specified number of data starting from the last data on page 299 but not including the last data on page 299.
[0036] A second aspect of the present invention provides an electronic device, comprising a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the program, the method provided in any one of the embodiments of the first aspect can be implemented.
[0037] The electronic device provided according to the technical solution of the present invention includes a memory and a processor, and a computer program is stored in the memory. At the same time, since the processor can implement the method provided by any one of the embodiments of the first aspect when executing the program, that is, the processor can implement the above-mentioned paging query method when executing the program, therefore, the electronic device provided according to the technical solution of the present invention has the beneficial effects of the paging query method provided by any one of the embodiments of the first aspect, which will not be repeated here.
[0038] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method provided in any one of the embodiments of the aspect.
[0039] Additional aspects and advantages of the present invention will be given in part in the following description, and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0041] Figure 1 A schematic diagram showing a flow chart of a paging query method provided by an embodiment of the present invention is shown;
[0042] Figure 2 A schematic diagram showing a flow chart of a paging query method provided by another embodiment of the present invention is shown;
[0043] Figure 3 A schematic diagram showing a flow chart of a paging query method in a specific embodiment of the present invention is shown;
[0044] Figure 4 A block diagram of a paging query device in an embodiment of the present invention is shown;
[0045] Figure 5 A block diagram of an electronic device provided by an embodiment of the present invention is shown.
[0046] Specific example method
[0047] In order to more clearly understand the above-mentioned purposes, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific examples. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0048] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be exemplified in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.
[0049] Figure 1 A paging query method provided according to an embodiment of the present invention is shown. Figure 1 As shown, the method comprises the following steps:
[0050] S102, when searching on a non-homepage page, construct a new query condition based on the query condition and the last piece of data on the current page;
[0051] S104, using the find-limit method to perform data search according to the new search condition and return a limited number of data, wherein returning a limited number of data means returning data of a specified page.
[0052] The paging query method provided according to the embodiment of the present invention is preferably used in remote sensing image data, wherein remote sensing image (abbreviated as: RS, English: Remote Sensing Image) refers to a film or photo that records the size of electromagnetic waves of various ground objects, mainly divided into aerial photographs and satellite photos. When the paging query method performs a non-homepage query, a new query condition is constructed based on the query condition and the last data of the current page, and then the new query condition is used to use the find-limit method to perform data query and return a limited number of data. For most query methods, after the results are queried, they will be arranged in ascending or descending order according to pre-set keywords, such as date or angle, and when further paging query is performed for such data, the last data content of the current page, such as the date in the last data, and the original query condition can be recombined into a new query condition, and then the query and data display are performed according to the new query condition. Specifically, for example, in the result data displayed in ascending or descending order according to the date, the date in the last data of the current page can be used as the starting point or end point of the date range in the new query condition, so that the data greater than or less than the date node can be queried through the new query condition, and then the normal data paging query and display can be performed. After that, the operation can be repeated until the paging query of all pages is realized. This query method directly returns the last data of the previous page from the Web front end, so there is no need to store the keywords of the data, and the time required to store the keywords of the data is zero. At the same time, this query method does not require the where function to perform filtering query again. The entire paging query only needs the find method and the limit method, which minimizes the retrieval date and improves the retrieval efficiency.
[0053] Based on the above embodiment, the paging query method further includes: storing the last piece of data of the current page through the Web front end before constructing a new query condition.
[0054] In this embodiment, in order to form a new query condition by using the last piece of data on the current page and the original query condition, the last piece of data on the current page can be stored in the Web front end in advance, so that when constructing a new query condition, the last piece of data on the current page can be called through the Web front end. Of course, it is also possible not to store it in advance through the Web front end, but to directly obtain the last piece of data on the current page when it is needed.
[0055] Among them, preferably, the paging query method is a paging query method for remote sensing data.
[0056] In another embodiment, if Figure 2 As shown, the paging query method includes:
[0057] S202, when searching on the home page, using the countDocuments method according to the query conditions, calculate the total number of data that meet the query conditions, and then using the find-limit method according to the query conditions to query data and return a limited number of data;
[0058] S204, storing the last piece of data of the current page through the Web front end;
[0059] S206, when searching on a non-homepage page, construct a new query condition based on the query condition and the last piece of data on the current page;
[0060] S208, using the find-limit method to perform data query according to the new query condition and return a limited number of data;
[0061] S210, repeat S206 and S208 until the last page is queried.
[0062] In this embodiment, in order to facilitate the statistics of the total number of data in the query results, the countDocuments method can be used to query first, and the calculation of the total data can be obtained. After the total number is calculated, the query condition can be directly used as the query condition, and then the find-limit method can be used to query the home page, so that the query results can be displayed in pages in a manner that displays specific data per page. Of course, it is also possible to query the data first, and then use the countDocuments method to query and obtain the calculation of the total data. Thereafter, non-home page queries can be performed in sequence according to S206 and S208 until the last page is queried. The introduction and description of S206 and S208 can refer to the steps in the first embodiment and will not be introduced in detail here.
[0063] In any of the above embodiments, preferably, the step of constructing a new query condition according to the query condition and the last piece of data on the current page includes:
[0064] According to the content of the first keyword corresponding to the last data of the current page, the condition range corresponding to the first keyword in the query condition is narrowed down, and other conditions in the query condition are retained.
[0065] In this embodiment, when constructing a new query condition, the scope of the new query condition can be modified according to the content of the first keyword corresponding to the last data of the current page. Specifically, when the data is arranged in descending order, the content corresponding to the first keyword in the last data is used as the right limit range of the first keyword in the new query condition. For example, in the query condition, the condition range of the first keyword is AB, and the content corresponding to the first keyword is C. Then, in the new query condition, the condition range of the first keyword is AC. When the data is arranged in ascending order, the condition range of the first keyword in the new query condition is CB. For example, when the first keyword is a date, and the date of the original query condition is ab, the query data results are arranged in descending order, and the date of the last data of the current page is c, where date c is a date between date a and date b, then when combining the new query condition, if the data is arranged in descending order, the date range can be modified to: ac, and if the data is arranged in ascending order, the date range can be modified to: ab. At the same time, put other conditions directly into the new query conditions without any changes, so that a new query condition can be constructed based on the query condition and the last data of the current page.
[0066] In any of the above embodiments, preferably, the step of constructing a new query condition according to the query condition and the last piece of data on the current page further includes:
[0067] When it is determined that the number of data items including the first keyword on the current page is greater than 1, an exclusion item is added to the new query condition if the content of the last data item on the current page is not simultaneously valid.
[0068] In this embodiment, when it is determined that the number of data items including the first keyword on the current page is greater than 1, that is, in the sorted data, there are several data items with the same first keyword as the last data item. At this time, for remote sensing data, in this case, among the multiple data items with the same first keyword, the multiple data items will be sorted again with the second keyword, the third keyword, etc. However, among the sorted multiple data items, generally there will not be two completely identical data items. Therefore, when constructing a new query condition, the other incomplete content of the last data item can be added as an exclusion condition to the new query condition, so that the query can be started from the specified number of data items starting from the last data item of the current page but not including the last data item of the current page.
[0069] In any of the above embodiments, preferably, the first keyword is a keyword that can be displayed by a numerical range, such as date, angle, resolution, cloud cover, sun altitude angle, surname strokes, etc. Or the first keyword is a keyword that can represent a certain range, such as region. The region can be a Chinese region or a foreign region.
[0070] Further preferably, when performing a paginated query on remote sensing data, the first keyword is date, and the remaining keywords include one or more of: region, resolution, cloud cover, solar altitude angle, and satellite model.
[0071] In this embodiment, since the remote sensing data is photographed and recorded by date, the date can be preferably used as the first keyword. Of course, when the query conditions include the range of area, resolution, cloud cover, sun altitude angle, etc., the area, resolution, cloud cover, sun altitude angle, etc. can also be used as the first keyword. For remote sensing data, the remaining keywords can be one or more of area, resolution, cloud cover, sun altitude angle, and satellite model. The remaining conditions can specifically be data or data ranges that limit the area, resolution, cloud cover, sun altitude angle, satellite model, etc.
[0072] In any of the above embodiments, preferably, the steps of using the find-limit method to query data and return a limited number of data specifically include:
[0073] Arrange the query result data in ascending or descending order according to the first keyword, and sort multiple data with the same keyword again according to the next keyword in the order;
[0074] Returns a limited number of data based on the total number of data that meets the query conditions and the limited number of data per page.
[0075] In this embodiment, in order to facilitate subsequent paging queries, when using the find-limit method to query data and return a limited number of data, the query result data can be first sorted in ascending or descending order according to the first keyword, and then the data with the same keyword can be sorted again according to the keywords of the next order, such as the data with the same first keyword can be sorted again in ascending or descending order according to the second keyword, and the data with the same second keyword can be sorted again in ascending or descending order according to the third keyword, until all the query data are arranged in order. After that, the query data of the specified page can be returned according to the total number of data that meet the query conditions and the number of data displayed per page to achieve paging query.
[0076] In any of the above embodiments, preferably, the step of narrowing the scope of the condition corresponding to the first keyword in the query condition according to the content of the last data of the current page corresponding to the first keyword specifically includes:
[0077] Determine the first keyword based on which the query result data is sorted;
[0078] Determine the content corresponding to the first keyword in the last piece of data on the current page, and then narrow the condition range of the first keyword in the query condition based on the content corresponding to the first keyword in the last piece of data.
[0079] In this embodiment, when narrowing the query conditions according to the last data of the current page, the first keyword selected when sorting the data can be determined by using the find-limit method to query the data and return a specified number of data. For example, when sorting by the first keyword such as date, angle, etc., the first keyword is date and angle. Thereafter, the content corresponding to the first keyword in the last data of the current page can be determined. For example, when the first keyword is the date, and the last data of the current page is: Date: 2019-01-12, Resolution: 2, Cloud Cover: 5, Solar Altitude Angle: 50°, Satellite: GF, Longitude and Latitude Range: Beijing Area, the content corresponding to the first keyword in the last data of the current page is Date: 2019-01-12. Finally, the query condition about the date range can be narrowed according to the query condition and date: 2019-01-12. For example, when the query conditions are: date range: 2018-01-01 to 2019-10-01, resolution: 0 to 10, cloud cover: 0 to 20 (percentage), solar altitude angle: 45° to 80°, satellite: GF, longitude and latitude range: China area, the narrowed condition range of the first keyword is: date range: 2018-01-01 to 2019-01-12.
[0080] The following is a further explanation of the embodiments of the present invention in conjunction with specific examples: The query conditions for remote sensing data are shown in Table 1: Date range: 2018-01-01 to 2019-10-01, resolution: 0 to 10, cloud cover: 0 to 20 (percentage), solar altitude angle: 45° to 80°, satellite: GF, longitude and latitude range: China area. There are 7069 data in the database that meet the conditions (these 7069 data have been arranged in descending order by date). If the user wants to query the data on page 300 (10 data on one page), the last data on page 299 is: Date: 2019-01-12, Resolution: 2, Cloud cover: 5, Solar altitude angle: 50°, Satellite: GF, Longitude and latitude range: Beijing area. When constructing a new query condition, since the date of 2019-01-12 has been queried, there is no need to query the data after 2019-01-12 when querying again, only the data before 2019-01-12 needs to be queried. Therefore, the date range in the query condition: 2018-01-01 to 2019-10-01 can be modified to 2018-01-01 to 019-01-12. The rest of the conditions remain unchanged, namely, resolution: 0 to 10, cloud cover: 0 to 20 (percentage), solar altitude angle: 45° to 80°, satellite: GF, longitude and latitude range: China area. At the same time, in order to prevent the last data from being displayed repeatedly, it is preferred to exclude the content of the last data, and in the specific operation, one condition can be added to the new query condition: resolution equals 2, cloud cover equals 5, solar altitude angle equals 50°, satellite equals GF, and these four conditions are not met at the same time. In this way, the new query condition can query the specified number of data starting from the last data of page 299 but not including the last data of page 299. The comparative test data of using the skip-limit method for paging query and using the find-limit method for paging query are shown in Table 2. From Table 2, it can be seen that when the method in this application is used for paging query, the required time is 2.72ms, while when the skip-limit method is used for paging query, the required time is 56.16ms. Therefore, from the test results in Table 2, it can be seen that the method in this application greatly reduces the time of the paging query method and greatly improves the efficiency of the paging query.
[0081] Table 1 Query conditions
[0082] Date range Resolution Cloud Cover Sun Altitude Angle Satellite Type Latitude and longitude range 2018-01-01 to 2019-10-01 0-10 0-20 45-80 GF China
[0083] Table 2
[0084] Experimental methods Total data volume Amount of data that meets the conditions Average date of querying data on page 300 50 times skip-limit 500W 7069 56.16ms find-limit 500W 7069 2.72ms
[0085] In combination with the above examples, the flowchart of the paging query method of the present application is described by taking the home page query and the 300th query as examples. Figure 3 As shown, the flow chart includes the following steps:
[0086] S302, using the countDocuments method according to the query conditions, calculate the total number of data that meet the query conditions, and then use the find-limit method to query the data according to the query conditions and display 10 data; wherein the query conditions are specifically as follows: date range: 2018-01-01 to 2019-10-01, resolution: 0 to 10, cloud cover: 0 to 20 (percentage), solar altitude angle: 45° to 80°, satellite: GF, longitude and latitude range: China region.
[0087] S304, stores the last data of page 299 through the Web front end, namely: date: 2019-01-12, resolution: 2, cloud cover: 5, solar altitude angle: 50°, satellite: GF, longitude and latitude range: Beijing area.
[0088] S306, construct a new query condition based on the query condition and the last data of the current page: date: 2018-01-01 to 2019-01-12, resolution: 0 to 10, cloud cover: 0 to 20 (percentage), solar altitude angle: 45° to 80°, satellite: GF, longitude and latitude range: China area.
[0089] S308, using the find-limit method to perform data search according to the new query condition and return a limited number of data, that is, the data on page 300.
[0090] Thereafter, S306 and S308 may be repeated until the last page is searched. Meanwhile, in the above embodiment, the steps of searching pages 2 to 299 are omitted, and the steps may be specifically referred to the steps of searching page 300.
[0091] In the above embodiment, the home page is first queried according to the query conditions, and when querying the data on page 300, a new query condition is constructed based on the query data on the home page and the last data on page 299, and then the data on page 300 is queried based on the new query condition. This query method directly returns the last data of the previous page from the Web front end, so there is no need to store the keywords of the data, and the time required to store the keywords of the data is zero. At the same time, this query method does not require the where function to perform filtering queries, and the entire paging query only requires the find method and the limit method, which minimizes the search date and improves the search efficiency.
[0092] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present disclosure is not limited by the order of the actions described, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.
[0093] The above is an introduction to the method embodiment. The following is a further explanation of the scheme disclosed in the present invention through an apparatus embodiment.
[0094] Figure 4 FIG. 4 is a block diagram of a paging query device 400 according to an embodiment of the present disclosure. Figure 4 As shown, the paging query device 400 includes: a query condition construction module 410, a find-limit module 420, and a countDocuments module 430. The query condition construction module 410 is used to construct a new condition, and the find-limit module 420 is used to perform data query according to the query condition of the reason or the constructed new query condition, and return the data of the specified page. The countDocuments module 430 is used to count the total number of data that meet the query results.
[0095] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the described module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0096] A second aspect of the present invention provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor can implement the method provided in any one of the embodiments of the first aspect when executing the program.
[0097] The electronic device provided according to an embodiment of the present invention includes a memory and a processor, and a computer program is stored in the memory. At the same time, since the processor can implement the method provided by any embodiment of the first aspect when executing the program, that is, the processor can implement the above-mentioned paging query method when executing the program, therefore, the electronic device provided according to an embodiment of the present invention has the beneficial effects of the paging query method provided by any embodiment of the first aspect, which will not be repeated here.
[0098] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method provided in any one of the embodiments of the aspect.
[0099] in, Figure 5FIG. 5 is a schematic block diagram of an electronic device 500 that can be used to exemplify an embodiment of the present disclosure. Figure 5 As shown, the electronic device 500 includes a central processing unit 501, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory 502 or computer program instructions loaded from a storage unit 508 into a random access memory 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 can also be stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output interface 505 is also connected to the bus 504.
[0100] Multiple components in the electronic device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the electronic device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0101] The processing unit 501 performs the various methods and processes described above. For example, in some embodiments, the methods in the above implementation examples may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the CPU 501, one or more steps of the remote control terminal and the vehicle-mounted reading device described above can be executed. Alternatively, in other embodiments, the CPU 501 can be configured to execute the methods in the above implementation examples in any other appropriate manner.
[0102] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that may be used include, without limitation, field programmable gate arrays, application specific integrated circuits, application specific standard products, systems on chip systems, load programmable logic devices, and the like.
[0103] The program code for instantiating the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, causes the functions / operations specified in the flow chart and / or block diagram to be instantiated. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or electronic device.
[0104] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories, read-only memories, erasable programmable read-only memories, optical fibers, portable compact disk read-only memories, optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0105] In addition, although each operation is described in a specific order, this should be understood as requiring such operation to be performed in the specific order shown or in a sequential order, or requiring that all illustrated operations should be performed to obtain desired results. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single implementation in combination. On the contrary, the various features described in the context of a single implementation can also be implemented in multiple implementations individually or in any suitable sub-combination mode.
[0106] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A paging query method, characterized in that: include: When searching on a non-homepage page, a new query condition is constructed based on the query condition and the last piece of data on the current page; The step of constructing a new query condition based on the query condition and the last piece of data on the current page includes: Determine the first keyword based on which the query result data is sorted; Determine the content corresponding to the first keyword in the last piece of data on the current page, and then narrow the condition range of the first keyword in the query condition according to the content corresponding to the first keyword in the last piece of data, and retain other conditions in the query condition; According to the new query condition, the find-limit method is used to perform data query and return a limited number of data.
2. The paging query method according to claim 1, characterized in that: Also includes: When searching on the home page, the countDocuments method is used according to the query conditions to calculate the total number of data that meet the query conditions, and the find-limit method is used according to the query conditions to query data and return a limited number of data.
3. The paging query method according to claim 1, characterized in that: The paging query method further includes: storing the last piece of data of the current page through the Web front end before constructing a new query condition; and / or The paging query method is a paging query method for remote sensing data.
4. The paging query method according to claim 1, characterized in that: The step of constructing a new query condition based on the query condition and the last piece of data on the current page also includes: When it is determined that the number of data items including the first keyword on the current page is greater than 1, an exclusion item is added to the new query condition if the content of the last data item on the current page is not simultaneously valid.
5. The paging query method according to claim 4, characterized in that: When performing a paging query of remote sensing data, the first keyword is date, and the remaining keywords include one or more of region, resolution, cloud cover, solar altitude angle and satellite model.
6. The paging query method according to any one of claims 1 to 4, characterized in that: The steps of using the find-limit method to query data and return a limited number of data specifically include: Arrange the query result data in ascending or descending order according to the first keyword, and sort multiple data with the same keyword again according to the next keyword in the order; A limited number of data are returned based on the total number of data that meet the query conditions and the limited number of data per page.
7. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Data pagination query method and apparatus
CN105354256A
Distributed type storage method and parallel query method for mass remote-sensing image metadata
CN105589951A
Data paging optimizing method based on MongoDB
CN105760457A
Paging display method and device
CN108848244A
Paging download method and device based on large data
CN109344197A
