A data query method and device, electronic equipment, medium and product

By setting sorting factors for the data, data queries can be performed directly based on the sorting results of the sorting factors, which solves the problem of low efficiency when sorting multi-dimensional data and achieves efficient data lookup.

CN114064728BActive Publication Date: 2025-12-19BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111388754.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-22
Publication Date
2025-12-19
Estimated Expiration
2041-11-22

AI Technical Summary

Technical Problem

Existing technologies involve large computational loads and low table lookup efficiency when sorting multi-dimensional data, making it impossible to perform data queries efficiently.

Method used

By setting a sorting factor for each data point, sorting and selection are performed directly based on the sorting factor, avoiding sorting operations based on specific numerical values ​​of each dimension, and using the sorting result based on the sorting factor as the search result.

Benefits of technology

It improves the efficiency of data lookup, reduces the amount of calculation, and increases response speed and lookup speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114064728B_ABST
    Figure CN114064728B_ABST
Patent Text Reader

Abstract

The present disclosure provides a data query method and device, electronic equipment, medium and product, relates to the technical field of data processing, in particular to the technical field of intelligent search, and can improve the table lookup efficiency. The specific implementation scheme comprises the following steps: receiving a data query instruction, wherein the data query instruction is used to indicate that a preset number of data is searched from a list. Then, in response to the data query instruction, the sorting factor of each data in the list is obtained, wherein the sorting factor of each data is used to reflect the arrangement order of the data in at least one specified dimension. Then, the sorting factors of the data are sorted, and the preset number of data is selected as the search result according to the sorting result of the sorting factors.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of data processing, and particularly relates to the technical field of intelligent search. BACKGROUND

[0002] When displaying data in a list, there is usually a need to display in a certain order. For example, the data in the list is sorted according to the value of a certain dimension or certain dimensions, and the sorted result is displayed. SUMMARY

[0003] The present disclosure provides a data query method and device, an electronic device, a medium and a product.

[0004] According to a first aspect of the present disclosure, a data query method is provided, comprising:

[0005] receiving a data query instruction, the data query instruction being used to indicate finding a preset number of data from a list;

[0006] in response to the data query instruction, obtaining a sorting factor of each piece of data in the list, the sorting factor of each piece of data being used to reflect the arrangement order of the data in at least one specified dimension;

[0007] sorting the sorting factors of the pieces of data, and selecting a preset number of data as a finding result according to the sorting result of the sorting factors.

[0008] According to a second aspect of the present disclosure, a data query device is provided, comprising:

[0009] a receiving module, configured to receive a data query instruction, the data query instruction being used to indicate finding a preset number of data from a list;

[0010] a obtaining module, configured to, in response to the data query instruction received by the receiving module, obtain a sorting factor of each piece of data in the list, the sorting factor of each piece of data being used to reflect the arrangement order of the data in at least one specified dimension;

[0011] a sorting module, configured to sort the sorting factors of the pieces of data obtained by the obtaining module, and select a preset number of data as a finding result according to the sorting result of the sorting factors.

[0012] According to a third aspect of the present disclosure, an electronic device is provided, comprising:

[0013] at least one processor; and

[0014] a memory connected with the at least one processor in communication; wherein

[0015] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the data query method according to any one of the preceding embodiments.

[0016] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, where the computer instructions are used to enable the computer to perform the data query method according to any one of the preceding embodiments.

[0017] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the data query method according to any one of the preceding embodiments.

[0018] The data query method, apparatus, electronic device, medium and product provided by the embodiments of the present disclosure can directly sort the sorting factors of data when performing data query, and select a preset number of data as the search result according to the sorting result of the sorting factors. That is, the embodiments of the present disclosure can directly obtain the sorting result of data from the sorting result of the sorting factors when performing data query, and do not need to sort data based on the specific numerical values of each dimension included in the data, thereby improving the table lookup efficiency.

[0019] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0020] The accompanying drawings are used to better understand the present scheme, and do not constitute a limitation on the present disclosure. Among them:

[0021] Figure 1 is a flowchart of a data query method according to an embodiment of the present disclosure;

[0022] Figure 2 is a flowchart of a method for generating sorting factors according to an embodiment of the present disclosure;

[0023] Figure 3 is an exemplary schematic diagram of sorting factors according to an embodiment of the present disclosure;

[0024] Figure 4 is a flowchart of a method for updating sorting factors according to an embodiment of the present disclosure;

[0025] Figure 5 is a flowchart of another method for updating sorting factors according to an embodiment of the present disclosure;

[0026] Figure 6is a structural schematic diagram of a data query device according to an embodiment of the present disclosure;

[0027] Figure 7 is a block diagram of an electronic device for implementing a data query method according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] Exemplary embodiments of the present disclosure are described herein with reference to the accompanying drawings, which are provided to assist in a comprehensive understanding of the present disclosure, and should be considered as merely exemplary. Accordingly, those skilled in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, in the following description, descriptions of well-known functions and constructions are omitted for clarity and conciseness.

[0029] In order to better show a product to a user, the relevant data of the product is generally shown from multiple dimensions. For example, the relevant data of the product is shown from a time dimension, or in combination with a score dimension and a time dimension, or in combination with a heat dimension, a time dimension and a score dimension.

[0030] The relevant data of the product is generally stored in a list, and when data needs to be queried from the list, a conventional data query method is to sort the data in the list based on a specified field of the list by using an order by manner. Wherein, a piece of data is a plurality of dimension values of an object. For example, a piece of data includes the click volume, heat, publishing time and score of a movie.

[0031] When the data in the list needs to be sorted in combination with multiple dimensions, the order by manner needs to sort the data based on the dimension with the highest priority first, and then sort the data with the same sorting result based on the next dimension. As can be seen, the calculation amount of this manner is large, and the table lookup efficiency is low.

[0032] In order to improve the table lookup efficiency, an embodiment of the present disclosure provides a data query method, which can be applied to an electronic device. The electronic device can be a mobile phone, a computer or a server, etc. The electronic device has a data processing capability. As shown in the figure, Figure 1 The method comprises the following steps:

[0033] S101, receiving a data query instruction.

[0034] The data query instruction is used to indicate to find a preset number of data from a list. It can be understood that the data query instruction triggered by the user is used to instruct the electronic device to find data according to a preset table lookup manner. The table lookup manner can be preconfigured based on business requirements and corresponds to the query instruction.

[0035] For example, the user triggers the data query instruction when opening the data display page, and the data query instruction is used to indicate to find data in descending order of heat. Alternatively, the user triggers the data query instruction when clicking the data finding button, and the data query instruction is used to indicate to find data in descending order of heat and time.

[0036] In the embodiments of the present disclosure, each piece of data in the list is a numerical value of a plurality of dimensions of an object. For example, each piece of data stored in the list is the click volume, search volume, and heat of published works of an author. For another example, each piece of data stored in the list is the heat, view volume, and release time of a movie.

[0037] S102, in response to the data query instruction, obtaining the sorting factor of each piece of data in the list.

[0038] The sorting factor of each piece of data is used to reflect the arrangement order of the data in at least one specified dimension. The specified dimension can be pre-set according to business needs.

[0039] In an implementation manner, each piece of data has a sorting factor, and the sorting factor of the data can be stored in the list.

[0040] Optionally, the sorting factor of each piece of data can be one or more, and different sorting factors can reflect the arrangement order of the data in different dimensions. For example, the sorting factor 1 is determined based on heat and time, and the sorting factor 1 can reflect the sorting result of the data when sorted in descending order of heat and time. The sorting factor 2 is determined based on the evaluation score, and the sorting factor 2 can reflect the sorting result of the data when sorted in descending order of the evaluation score. When the electronic device receives the query instruction, the electronic device can obtain the sorting factor corresponding to the mark indicating the table lookup manner from the sorting factors of the data, by the mark indicating the table lookup manner carried in the query instruction.

[0041] S103, sorting the sorting factors of the data, and selecting a preset number of data as the finding result according to the sorting result of the sorting factor.

[0042] In an implementation manner, the sorting result of the sorting factor can be used as the sorting result of the data. If the data query instruction is used to indicate to find in descending order, a preset number of data are selected as the finding result of the table lookup in descending order of the sorting result of the data. If the data query instruction is used to indicate to find in ascending order, a preset number of data are selected as the finding result of the table lookup in ascending order of the sorting result of the data. The finding result can be subsequently displayed to the user.

[0043] The data query method provided by the embodiments of the present disclosure can directly sort the sorting factors of data when data query is performed, and select a preset number of data as the query result according to the sorting result of the sorting factors. That is, the embodiments of the present disclosure can directly obtain the sorting result of data from the sorting result of the sorting factors when data query is performed, and do not need to sort data based on the specific numerical value of each dimension included in the data, thereby improving the table lookup efficiency.

[0044] In one embodiment of the present disclosure, the embodiments of the present disclosure can set a sorting factor for each piece of data in the list.

[0045] When setting the sorting factor for the data in the list, referring to Figure 2 , the following steps are performed for each piece of data in the list:

[0046] S201, for each specified dimension, obtaining the numerical value of the specified dimension in the data.

[0047] In one implementation manner, the embodiments of the present disclosure can update the sorting factor of each piece of data in real time through Figure 2 For example, when it is detected that the data in the list is updated, the sorting factor of each piece of data is updated. Wherein, the data in the list is updated, including: adding new data in the list, deleting data or updating the numerical value included in the data.

[0048] Alternatively, the embodiments of the present disclosure can periodically update the sorting factor of each piece of data through Figure 2 For example, the sorting factor of each piece of data in the list is updated once a day according to the numerical value of the specified dimension in the list.

[0049] For example, the data in the list is shown in Table 1, one row in Table 1 is one piece of data, one column is one dimension, and the specified dimension is student ID.

[0050] Table 1

[0051] ID Age Grade Student Number 1 10 5 002 2 11 6 008 3 10 6 005

[0052] For the data with ID 1, the numerical value of the specified dimension is 002.

[0053] S202, if the sorting rule corresponding to the specified dimension is the target sorting rule, the numerical value of the specified dimension in the data is taken as a sub-sorting factor.

[0054] The target sorting rule is the sorting rule with the largest quantity among the sorting rules corresponding to the specified dimensions. Optionally, when there are more than one sorting rule with the largest quantity among the sorting rules corresponding to the specified dimensions, one of the sorting rules with the largest quantity can be randomly selected as the target sorting rule. For example, the sorting rule of the specified dimension 1 is to sort in descending order, and the sorting rule of the specified dimension 2 is to sort in ascending order. The target sorting rule can be randomly selected from the two sorting rules.

[0055] In the embodiments of the present disclosure, the sorting rule corresponding to the specified dimension can be pre-set according to business requirements. For example, the electronic device can obtain the sorting rule corresponding to the specified dimension input by the user. The sorting rule can be to sort in ascending order or to sort in descending order.

[0056] For example, in combination with Table 1, if the specified dimension is the student ID and the sorting rule corresponding to the specified dimension is to sort in ascending order, and the target sorting rule is to sort in ascending order, then for the data with ID 1, 002 is used as the sub-sorting factor.

[0057] S203, if the sorting rule corresponding to the specified dimension is not the target sorting rule, determine the target value of the specified dimension, and use the difference between the target value and the value of the specified dimension in the data as the sub-sorting factor.

[0058] The target value is greater than the maximum value of the specified dimension in the list, and the target value is an integer.

[0059] For example, in combination with Table 1, if the specified dimension is the student ID, the sorting rule corresponding to the specified dimension is to sort in descending order, and the target sorting rule is to sort in ascending order, then for the data with ID 1, the target value is determined to be 009, and 009-002=007 is used as the sub-sorting factor of the specified dimension of the data. Alternatively, the sorting rule corresponding to the specified dimension is to sort in ascending order, and the target sorting rule is to sort in descending order. For the data with ID 1, the target value is determined to be 009, and 009-002=007 is used as the sub-sorting factor of the specified dimension of the data.

[0060] In order to reduce the data amount of the sub-sorting factor, the target value can be limited to be less than the maximum value of the sub-sorting factor of the specified dimension. The maximum value of the sub-sorting factor of each dimension is a n The bit number of the sub-sorting factor of the nth dimension. For example, when a n =2, the maximum value of the sub-sorting factor is 10 2 -1=99.

[0061] In the embodiment of the present disclosure, the total number of bits of the sorting factor of each data is N, and the number of bits of each sub-sorting factor is a n The number of bits of each sub-sorting factor is a n total of N. Wherein, the number of bits of each sub-sorting factor can be pre-set, for example, the number of bits of each sub-sorting factor input by the user can be obtained.

[0062] S204, splicing each sub-sorting factor of the data to obtain the sorting factor of the data.

[0063] In one embodiment, when the specified dimension is one, the sub-sorting factor corresponding to the specified dimension can be directly used as the sorting factor of the data.

[0064] When the specified dimension is multiple, as shown in Figure 3 , the sub-sorting factor 1, the sub-sorting factor 2, …, and the sub-sorting factor n corresponding to the specified dimension can be spliced in head-to-tail according to the priority of each specified dimension from high to low, thereby obtaining the sorting factor of the data. Wherein, each sub-sorting factor is an integer.

[0065] For example, combined with Table 1, if the specified dimension is the student ID and the age, the priority of the age is higher than the priority of the student ID, and the sorting rules corresponding to the student ID and the age are both sorted in ascending order, then for the data with ID 1, the sub-sorting factor 10 corresponding to the age and the sub-sorting factor 002 corresponding to the student ID are spliced to obtain 10|002. Wherein, “|” is a separator, which is used to distinguish different sub-sorting factors. Since the sorting of the sorting factor is directly based on the decimal comparison of the size of the sorting factor, the separator can also be omitted.

[0066] By using the above method, the embodiment of the present disclosure can add a sorting factor for the data in the list, and the sorting factor can reflect the arrangement order of the data in the specified dimension. Moreover, the sorting order corresponding to each specified dimension is unified to a consistent order, so that when looking up the table, the specific sorting order corresponding to each specified dimension can not be considered, and the ascending or descending order can be directly used for table lookup.

[0067] Furthermore, in the embodiment of the present disclosure, the process of setting or updating the sorting factor for the data is separated from the table lookup process, so that the setting or updating of the sorting factor for the data can be completed offline. Compared with the method of comparing the data of multiple dimensions in real time to obtain the table lookup result when looking up the table, the embodiment of the present disclosure can determine the sorting factor offline, and when looking up the table online, the sorting order of the data can be directly obtained based on the table lookup factor, so that the table lookup speed is improved.

[0068] In one embodiment of the present disclosure, the sub-sorting factors of the data can be spliced to determine the sorting factor of the data for each data by the following formula:

[0069]

[0070] wherein, sortVal represents a sorting factor, n is the number of sub-sorting factors, val n is the nth sub-sorting factor, a n is the number of bits occupied by the nth sub-sorting factor.

[0071] For example, a1=2, a2=2, a3=1, a4=3, and the four sub-sorting factors of data 1 are val1=1, val2=2, val3=3, and val4=4. The calculation results are:

[0072] subVal1=val1=1

[0073]

[0074]

[0075]

[0076] The sorting factor of data 1 is obtained as: 1|02|3|004, wherein “|” is a separator used to distinguish different sub-sorting factors.

[0077] Similarly, when the sub-sorting factors of data 2 are val1=2, val2=3, val3=5, and val4=4, the sorting factor of data 2 is calculated according to the above method as: 2|03|5|004.

[0078] Similarly, when the sub-sorting factors of data 3 are val1=2, val2=1, val3=5, and val4=4, the sorting factor of data 2 is calculated according to the above method as: 2|01|5|004.

[0079] The sorting factors of data 1, data 2, and data 3 are sorted in descending order according to the decimal, and since <2035004><2015004>1023004, the sorting result is: data 2, data 3, data 1.

[0080] In multi-field sorting, the data needs to be sorted based on the field with the highest priority first, and then the data with the same sorting result is sorted based on the next field. For example, data 1 includes 10 and 20, and data 2 includes 10 and 30, which need to be sorted by comparing 10 and 10 first, and then comparing 20 and 30, and finally obtaining the arrangement order of data 1 and data 2. It can be seen that the table lookup efficiency of multi-field sorting is low.

[0081] And the above method provided by the embodiment of the present disclosure can convert multi-field sorting into single-field sorting, that is, the embodiment of the present disclosure can obtain the sorting of data in multiple dimensions through the sorting factor, thereby improving the table lookup efficiency. For example, the sorting factor of data 1 is 1020, and the sorting factor of data 2 is 1030. When looking up the table, directly compare 1020<1030 to obtain the sorting result of data 1 and data 2. It can be seen that the table lookup speed of the embodiment of the present disclosure is faster.

[0082] In an embodiment of the present disclosure, after obtaining the sorting factor of the data in S204, the embodiment of the present disclosure can also filter the data that needs to be sorted, as shown in the following formula: Figure 4 The method comprises the following steps:

[0083] S401, sort the sorting factors of each piece of data, and select a preset number of data as query data according to the sorting result.

[0084] In the embodiment of the present disclosure, the sorting method of S401 when looking up the table is the same as the sorting method of S103, which can be ascending or descending. The sorting method can be pre-set according to business requirements.

[0085] For example, in the case of business requirements to show the top 3 advertisement data with the highest popularity to the user, the user triggers a data query instruction when opening the advertisement display page, S103 selects the top 3 advertisement data in descending order of the sorting factor, and displays them in the advertisement display page, wherein the sorting factor is based on popularity. In this case, when updating the sorting factor, S401 can sort the data in descending order of the sorting factor, and select a preset number of data as query data.

[0086] Optionally, when the sorting factors of some data are the same, and the preset number of data cannot be selected according to the sorting result of the sorting factor, a data can be randomly selected from the data with the same sorting factor, so as to select the preset number of data. For example, the following represents the sorting factor of data aa as 10 in the form of "aa:10". Assuming that in the list, aa:10, bb:20, cc:10, dd:7, and the preset number is 2, a data is randomly selected from aa and cc, and the randomly selected data is assumed to be aa. aa and bb are selected as query data.

[0087] S402, set the sorting factor of the query data in the list to the sorting factor determined this time, and set the sorting factor corresponding to other data in the list except the query data to zero.

[0088] For example, the following represents the ranking factor of data aa as 10 in the form of "aa:10". Assuming the list, aa:10, bb:20, cc:5, dd:7, and the preset number is 2, aa and bb are selected as the data to be queried, and aa:10, bb:20, cc:0, and dd:0 are set.

[0089] The embodiments of the present disclosure can update the ranking factor of each piece of data in real time when the data in the list is changed. The data in the list is updated, including adding new data, deleting data, or updating the value included in the data.

[0090] For example, the current list is aa:10, bb:20, cc:0, and dd:0. When new data ee is added to the list, the ranking factors of the data are recalculated to obtain aa:10, bb:20, cc:5, dd:7, and ee:25. When the preset number is 2, bb and ee are selected as the data to be queried, and aa:0, bb:20, cc:0, dd:0, and ee:25 are set.

[0091] For another example, the current list is aa:10, bb:20, cc:0, and dd:0. When data bb is deleted from the list, the ranking factors of the data are recalculated to obtain aa:10, cc:5, and dd:7. When the preset number is 2, aa and dd are selected as the data to be queried, and aa:10, cc:0, and dd:7 are set.

[0092] For another example, the current list is aa:10, bb:20, cc:0, and dd:0. When the value included in data cc in the list is updated, the ranking factors of the data are recalculated to obtain aa:10, bb:20, cc:25, and dd:7. When the preset number is 2, bb and cc are selected as the data to be queried, and aa:0, bb:20, cc:25, and dd:0 are set.

[0093] On the basis of Figure 4 Since the ranking factors of the data at the back of the list are set to 0, these data can be ignored when the table is queried. That is, the way of obtaining the ranking factors of each piece of data in the list in S102 can be implemented as follows: filtering the data in the list whose ranking factors are greater than zero, and obtaining the ranking factors of the filtered data.

[0094] By using the above method, the embodiments of the present disclosure can set the ranking factors of the data at the back of the list to 0 when the ranking factors of the data are set or updated, so that the data at the back of the list can not be considered when the table is queried, the amount of data based on which the table is queried is reduced, and the speed of querying the table is improved. Moreover, the embodiments of the present disclosure can update the ranking factors of the data in real time, thereby improving the timeliness of the ranking factors.

[0095] In an embodiment of the present disclosure, each piece of data in the list has a corresponding production identifier, which is used to represent the source of the data. For example, each piece of data in the list is the heat, click volume, and release time of a movie, and the production identifier of the data can be the delivery platform identifier of the movie.

[0096] The manner in which the sorting factors of each piece of data are sorted in S103 and the manner in which the preset number of data are selected as the to-be-queried data according to the sorting result can be implemented as follows: the data with the same production identifier are determined according to the production identifier corresponding to each piece of data in the list, and then for each group of data with the same production identifier, the first number of data are selected from the group of data according to the sorting result as the to-be-queried data. The total amount of data selected from each group of data is the preset number.

[0097] Optionally, the production identifier can be a user identification (uid) of the source of the data, and the production identifier of the data can be recorded in the list.

[0098] In an embodiment, the data with the same production identifier can be taken as a group, which is assumed to be X groups, and Y pieces of data are selected from each group of data according to the sorting result, and X*Y = the preset number.

[0099] Suppose that when querying the data, the top Y pieces of data of each uid in the list need to be displayed, and if the data is searched according to the value of the specified dimension of the data when searching the table, there can be a case where Y pieces of data cannot be selected when the value of the specified dimension of the data is the same.

[0100] In the embodiment of the present disclosure, when the sorting factor of the data is determined, Y pieces of data are directly selected for each uid, and the sorting factor of the other data not selected is set to 0. Therefore, when searching the table, the data with the sorting factor greater than 0 can be directly sorted, and thus the embodiment of the present disclosure can display a certain number of data with the same uid. Moreover, because the embodiment of the present disclosure has selected a certain number of data for each uid when determining the sorting factor, when searching the table, it is not necessary to select data for each uid in real time, and thus the searching efficiency and the response speed of the searching are improved.

[0101] Referring to Figure 5 , the manner in which the sorting factor is updated in the embodiment of the present disclosure will be described in combination with an application scenario as follows:

[0102] When there is a data change, 2 pieces of data with the same uid as the data and with the sorting factor not being 0 are selected from the list according to the arrangement order of the sorting factor, and the sorting factors of the 2 pieces of data are obtained, which are aa: 10 and bb: 20.

[0103] Meanwhile, the values of the specified dimensions in each data with the same data uid are obtained from the list, and the ranking factors of each data are updated, i.e. for each data, a sub-ranking factor 1 of the data is determined according to the value of the first specified dimension of the data, a sub-ranking factor 2 of the data is determined according to the value of the second specified dimension of the data, and so on, to obtain a sub-ranking factor n.

[0104] Then, the sub-ranking factors of each data are assembled, i.e. the sub-ranking factors are spliced into ranking factors. According to the arrangement order of the ranking factors, the first two data are selected.

[0105] When the selected first two data are aa:10 and bb:20, the data and the ranking factors are the same as the first two data and the ranking factors before the update, and the ranking factors of the data in the list do not need to be updated.

[0106] When the selected first two data are aa:10 and bb:25, the data is the same as the first two data before the update, but the ranking factors are different, and the ranking factor of the data bb in the list is changed to 25, and the ranking factors of the other data remain unchanged.

[0107] When the selected first two data are bb:20 and cc:15, the data is different from the first two data before the update, and the ranking factor of the data cc in the list is changed to 15, and the ranking factor of the data aa is changed to 0, and the ranking factors of the other data remain unchanged.

[0108] In practical applications, the data involved in the table lookup may be stored in multiple lists, for example, the movie ID and the release time are stored in list 1, and the movie ID and the click volume are stored in list 2.

[0109] When the data needs to be sorted by combining the release time and the click volume, if the join table query method is used, i.e. the click volume is obtained from table 2 first, and then sorted by the click volume. Then the release time is obtained from table 1, and then sorted by the release time. This method needs to combine the data in multiple tables for sorting, resulting in low table lookup efficiency.

[0110] Or, if the data in multiple lists is redundantly stored in one list, when using order by to look up the table, the data is first sorted based on the click volume, and then sorted based on the release time. This method needs to sort multiple times, and the table lookup efficiency is low. Moreover, when any data in the list needs to be updated, other data also needs to be updated, which is easy to cause data inconsistency and low update efficiency.

[0111] In the embodiment of the present disclosure, the ranking factor of each data can be determined according to the click volume and the publishing time offline, and the ranking factor of the data is recorded in the benchmark table. The benchmark table is set in advance based on the business requirement, and can be list 1 or list 2. When the data query is performed, the ranking factor of the data is obtained from the benchmark table, and the arrangement order of the data is obtained based on the ranking factor, and then the table lookup result is obtained. That is, the ranking result of the data can be obtained based on the single field ranking of the ranking factor in the embodiment of the present disclosure, and therefore the table lookup efficiency is improved. Moreover, the data of multiple lists is not redundantly arranged in one list in the embodiment of the present disclosure, and therefore the problems of data inconsistency and low update efficiency caused by the update are avoided.

[0112] In addition, the table lookup efficiency of the data query method provided by the embodiment of the present disclosure is high, and the complexity is low, and therefore the development and operation costs can be reduced, and the response speed of the data query instruction is improved.

[0113] Based on the same inventive concept, corresponding to the method embodiment, the embodiment of the present disclosure provides a data query device, as shown in the following table, the device comprises a receiving module 601, an obtaining module 602 and a sorting module 603. Figure 6 The receiving module 601 is configured to receive a data query instruction, and the data query instruction is used to indicate that a preset number of data is searched from a list.

[0114] The receiving module 601 is configured to receive a data query instruction, and the data query instruction is used to indicate that a preset number of data is searched from a list.

[0115] The obtaining module 602 is configured to obtain the ranking factor of each data in the list in response to the data query instruction received by the receiving module 601, and the ranking factor of each data is used to reflect the arrangement order of the data in at least one specified dimension.

[0116] The sorting module 603 is configured to sort the ranking factor of each data obtained by the obtaining module 602, and select a preset number of data as the search result according to the sorting result of the ranking factor.

[0117] The data query device provided by the embodiment of the present disclosure can directly sort the ranking factor of the data when the data query is performed, and select a preset number of data as the search result according to the sorting result of the ranking factor. That is, the ranking result of the data can be obtained directly from the sorting result of the ranking factor when the data query is performed in the embodiment of the present disclosure, and the data is sorted based on the specific numerical value of each dimension included in the data, and therefore the table lookup efficiency is improved.

[0118] In an embodiment of the present disclosure, the device can further comprise a setting module, and the setting module is configured to:

[0119] The following steps are performed for each data in the list:

[0120] For each specified dimension, obtain the value of the specified dimension in the data;

[0121] If the sorting rule corresponding to the specified dimension is the target sorting rule, the value of the specified dimension in the data is taken as the sub-sorting factor; wherein the target sorting rule is the sorting rule with the largest quantity among the sorting rules corresponding to the specified dimensions;

[0122] If the sorting rule corresponding to the specified dimension is not the target sorting rule, the target value of the specified dimension is determined, and the difference between the target value and the value of the specified dimension in the data is taken as the sub-sorting factor, and the target value is greater than the maximum value of the specified dimension in the list;

[0123] Splicing each sub-sorting factor of the data to obtain the sorting factor of the data.

[0124] In an embodiment of the present disclosure, the sorting module 603 is further configured to, after splicing each sub-sorting factor of the data to obtain the sorting factor of the data, sort the sorting factors of each piece of data, and select a preset number of data as the to-be-queried data according to the sorting result;

[0125] The setting module is further configured to set the sorting factor of the to-be-queried data in the list as the sorting factor determined this time, and set the sorting factors corresponding to other data in the list except the to-be-queried data as zero;

[0126] The obtaining module 602 is specifically configured to:

[0127] Filter out the data in the list whose sorting factor is greater than zero, and obtain the sorting factor of the filtered data.

[0128] In an embodiment of the present disclosure, wherein each piece of data in the list has a corresponding production identifier, the sorting module 603 is specifically configured to:

[0129] Determine the data with the same production identifier according to the production identifier corresponding to each piece of data in the list;

[0130] For each group of data with the same production identifier, select a first number of data from the group of data according to the sorting result as the to-be-queried data, and the total amount of data selected from each group of data is a preset number.

[0131] In an embodiment of the present disclosure, wherein the setting module is specifically configured to:

[0132] Determine the sorting factor of the data by the following formula:

[0133]

[0134] Wherein, sortVal represents the sorting factor, n is the number of sub-sorting factors, val n is the nth sub-sorting factor, a n is the number of bits occupied by the nth sub-sorting factor.

[0135] In the technical solutions of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of the data in the list involved all comply with the relevant legal regulations and do not violate public order and good customs.

[0136] It should be noted that the data in the present embodiment is not data for a specific user, and cannot reflect the personal information of a specific user.

[0137] It should be noted that the data in the list in the present embodiment can come from a public data set.

[0138] According to the embodiments of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium and a computer program product.

[0139] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit implementations of the present disclosure described and / or claimed in this document.

[0140] As shown in Figure 7 The electronic device 700 includes a computing unit 701 that can perform various appropriate actions and processes in accordance with a computer program stored in a read-only memory (ROM) 702 or a computer program loaded into a random access memory (RAM) 703 from a storage unit 708. Various programs and data required for the operation of the electronic device 700 can also be stored in the RAM 703. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0141] A plurality of components in the electronic device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a magnetic disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the electronic device 700 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0142] The computing unit 701 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 701 performs various methods and processes described above, such as the data query method. For example, in some embodiments, the data query method can be implemented as a computer software program, which is tangibly embodied in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded onto the RAM 703 and executed by the computing unit 701, one or more steps of the data query method described above can be performed. Alternatively, in other embodiments, the computing unit 701 can be configured to perform the data query method by any other appropriate means, such as by means of firmware.

[0143] Various implementations of the systems and techniques described above herein can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0144] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the functions / operations specified in the flowcharts and / or block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine as a standalone software package, or entirely on a remote machine or server.

[0145] In the context of the present disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0146] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0147] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0148] The computer system can include clients and servers. This relationship can be. The servers are typically remote from the clients with the interactions between them occurring over a communication network. The relationship between client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The servers can be cloud servers, servers of a distributed system, or servers incorporating blockchain.

[0149] It should be understood that the steps shown in the various forms above can be reordered, added to, or removed. For example, the steps described in the present disclosure can be performed in parallel, in series, or in a different order, as long as the desired results of the present disclosure are achieved, and the present disclosure is not limited in this regard.

[0150] The specific embodiments described above are not intended to limit the scope of the present disclosure. Those skilled in the art will understand that various modifications, combinations, sub-combinations, and alternatives can be made to the specific embodiments without departing from the spirit and principles of the present disclosure. Any further modifications, equivalents, and / or alternatives come within the scope of the present disclosure.

Claims

1. A data query method, comprising: receiving a data query instruction, the data query instruction being used to indicate finding a preset number of data from a list; in response to the data query instruction, obtaining a sorting factor of each data in the list, the sorting factor of each data being used to reflect an arrangement order of the data in at least one specified dimension; sorting the sorting factors of the data, and selecting the preset number of data as a finding result according to the sorting result of the sorting factors; the method further comprises: performing the following steps for each data in the list: obtaining a value of a specified dimension in the data for each specified dimension; if a sorting rule corresponding to the specified dimension is a target sorting rule, taking the value of the specified dimension in the data as a sub-sorting factor; wherein the target sorting rule is a sorting rule with the largest number among the sorting rules corresponding to the specified dimensions, and the sorting rule comprises sorting in descending order and sorting in ascending order; if the sorting rule corresponding to the specified dimension is not the target sorting rule, determining a target value of the specified dimension, and taking a difference between the target value and the value of the specified dimension in the data as the sub-sorting factor, the target value being greater than a maximum value of the specified dimension in the list; splicing the sub-sorting factors of the data to obtain the sorting factor of the data. 2.The method of claim 1, after the splicing the sub-sorting factors of the data to obtain the sorting factor of the data, the method further comprises: sorting the sorting factors of the data, and selecting a preset number of data as to-be-queried data according to the sorting result; setting the sorting factor of the to-be-queried data in the list as a sorting factor determined this time, and setting the sorting factors corresponding to other data in the list except the to-be-queried data as zero; the obtaining the sorting factor of each data in the list comprises: screening out data with a sorting factor greater than zero in the list, and obtaining the sorting factor of the screened data.

3. The method of claim 2, wherein, each data in the list has a corresponding production identifier, and the sorting the sorting factors of the data, and selecting a preset number of data as to-be-queried data according to the sorting result comprises: determining data with the same production identifier according to the corresponding production identifier of each data in the list; for each group of data with the same production identifier, selecting a first number of data from the group of data as to-be-queried data according to the sorting result, and the total amount of data selected from each group of data is the preset number.

4. The method according to any one of claims 1 to 3, wherein, the splicing the sub-sorting factors of the data to obtain the sorting factor of the data comprises: determining the sorting factor of the data by the following formula: wherein sortVal represents a sorting factor, n is the number of sub-sorting factors, val n is the nth sub-sorting factor, a n is the number of bits occupied by the nth sub-sorting factor. 5.A data query apparatus, comprising: a receiving module configured to receive a data query instruction, the data query instruction being used to indicate finding a preset number of data from a list; an obtaining module configured to, in response to the data query instruction received by the receiving module, obtain a sorting factor of each data in the list, the sorting factor of each data being used to reflect an arrangement order of the data in at least one specified dimension; The sorting module is configured to sort the sorting factors of the data obtained by the obtaining module, and select a preset number of data as the search results according to the sorting results of the sorting factors. The device further comprises a setting module, which is configured to: For each piece of data in the list, the following steps are performed: For each specified dimension, the value of the specified dimension in the data is obtained; If the sorting rule corresponding to the specified dimension is the target sorting rule, the value of the specified dimension in the data is taken as a sub-sorting factor; wherein the target sorting rule is the sorting rule with the largest number among the sorting rules corresponding to the specified dimensions, and the sorting rule includes sorting in descending order and sorting in ascending order; If the sorting rule corresponding to the specified dimension is not the target sorting rule, the target value of the specified dimension is determined, and the difference between the target value and the value of the specified dimension in the data is taken as a sub-sorting factor, and the target value is greater than the maximum value of the specified dimension in the list; The sub-sorting factors of the data are spliced to obtain the sorting factor of the data.

6. The device of claim 5, The sorting module is further configured to sort the sorting factors of the data after splicing the sub-sorting factors of the data to obtain the sorting factor of the data, and select a preset number of data as the to-be-queried data according to the sorting results; The setting module is further configured to set the sorting factor of the to-be-queried data in the list as the sorting factor determined this time, and set the sorting factors corresponding to the data other than the to-be-queried data in the list as zero. The obtaining module is specifically configured to: Filter out the data in the list whose sorting factor is greater than zero, and obtain the sorting factor of the filtered data.

7. The apparatus of claim 6, wherein, Each piece of data in the list has a corresponding production identifier, and the sorting module is specifically configured to: Determine the data with the same production identifier according to the production identifier corresponding to each piece of data in the list; For each group of data with the same production identifier, select a first number of data from the group of data according to the sorting results as the to-be-queried data, and the total amount of data selected from each group of data is the preset number.

8. The apparatus of any one of claims 5-7, wherein, The setting module is specifically configured to: Determine the sorting factor of the data by the following formula: wherein sortVal represents a sorting factor, n is the number of sub-sorting factors, val n is the nth sub-sorting factor, a n is the number of bits occupied by the nth sub-sorting factor.

9. An electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication; wherein The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4.

10. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to make the computer execute the method according to any one of claims 1-4.

11. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-4.

11. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-4.

Citation Information

Patent Citations

  • Data query method and business system page turning method

    CN113282617A