Ranking list generation method, device, server and storage medium
By constructing an enhanced data structure in the Redis database and combining the values of multiple sorting dimensions into one score, the problem of inefficient multi-dimensional sorting in the existing technology is solved, efficient ranking generation is achieved, and cost is reduced.
Patent Information
- Application Number
- CN202110535261.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-17
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2041-05-17
AI Technical Summary
When the prior art performs multi-dimensional sorting of elements in the Redis database, it is impossible to effectively deal with the situation where more than two sorting dimensions are exceeded, resulting in waste of resources and reduced performance, and requires the use of relational databases, which increases the implementation cost.
By constructing an enhanced data structure, assign binary digits to each dimension in the Redis database, and represent the values of multiple dimensions in a score, sort and generate rankings, avoiding dependence on relational databases.
It realizes efficient multi-dimensional sorting of database elements, reduces cost investment, maintains the performance advantages of Redis, and improves the efficiency of ranking generation.
Smart Images

Figure CN113239084B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a ranking list generation method, device, server and storage medium. Background Art
[0002] Rankings are to arrange some data or elements according to certain standards so that researchers can find some obvious characteristics or trends by browsing the sorting results to solve corresponding problems. In addition, rankings can also help to count data and facilitate reclassification or grouping. Taking live broadcast rewards as an example, the host or the audience can view the number and ranking information of virtual gifts rewarded by the audience through the gift rankings.
[0003] In the related art, when ranking the gift rankings, they are usually ranked according to the number of virtual gifts given to the anchor, and the corresponding audience account information and ranking are displayed. When the number of virtual gifts given is the same, they are sorted according to the corresponding account level. Summary of the invention
[0004] The embodiment of the present application provides a ranking list generation method, device, server and storage medium. The technical solution is as follows:
[0005] On the one hand, an embodiment of the present application provides a ranking list generation method, the method comprising:
[0006] Reading from a database an element score corresponding to each element, wherein the element score is composed of sorting dimension values corresponding to at least two sorting dimensions, and an order of the sorting dimension values in the element score is determined based on a priority of the sorting dimension in the sorting rule;
[0007] sorting the elements in the database based on the element scores, wherein the sorted elements comply with the sorting rule;
[0008] In response to a ranking list generation request, a ranking list is generated based on the sorted elements, and feedback is provided.
[0009] On the other hand, an embodiment of the present application provides a ranking generation device, the device comprising:
[0010] A reading module, used for reading the element scores corresponding to each element from the database, wherein the element scores are composed of sorting dimension values corresponding to at least two sorting dimensions, and the order of the sorting dimension values in the element scores is determined based on the priority of the sorting dimensions in the sorting rules;
[0011] A sorting module, used to sort the elements in the database based on the element scores, wherein the sorted elements comply with the sorting rules;
[0012] The feedback module is used to respond to the ranking generation request, generate a ranking based on the sorted elements, and provide feedback.
[0013] On the other hand, an embodiment of the present application provides a server, the live broadcast server includes a processor and a memory, the memory stores at least one program, and the at least one program is loaded and executed by the processor to implement the ranking generation method described in the above aspect.
[0014] On the other hand, an embodiment of the present application provides a computer-readable storage medium, wherein the storage medium stores at least one instruction, and the at least one instruction is used to be executed by a processor to implement the ranking list generating method as described in the above aspects.
[0015] On the other hand, an embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the ranking generation method provided in the above aspect.
[0016] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0017] When sorting elements, the database determines the corresponding sorting dimension values based on at least two sorting dimensions of each element, and composes the element scores of the elements with the sorting dimension values according to the priorities of the sorting dimensions, and then sorts the elements in the database based on the numerical values of the element scores and according to the sorting rules, so as to generate a ranking list of elements when a ranking list generation request is received; by adopting the solution provided in the embodiment of the present application, elements can be sorted directly based on the sorting dimension values of at least two sorting dimensions without the aid of other relational databases, thereby improving the efficiency of element sorting and reducing cost investment. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A schematic diagram of a scenario showing a ranking list generation method provided by an exemplary embodiment of the present application;
[0019] Figure 2 is a flowchart of a ranking list generating method provided by an exemplary embodiment of the present application;
[0020] Figure 3 A schematic diagram of the score sorting dimension division provided by an exemplary embodiment of the present application is shown;
[0021] Figure 4 is a flowchart of a ranking list generating method provided by another exemplary embodiment of the present application;
[0022] Figure 5 It is a schematic diagram of dividing the bits of each sorting dimension in the score provided by an exemplary embodiment of the present application;
[0023] Figure 6 is a flowchart of a ranking list generating method provided by another exemplary embodiment of the present application;
[0024] Figure 7 A schematic diagram of calculating a second target sorting dimension value based on update data and a first target sorting dimension value is shown in an exemplary embodiment of the present application;
[0025] Figure 8 An algorithm flow chart of an element score updating process provided by an exemplary embodiment of the present application is shown;
[0026] Fig. 9 A schematic diagram of reading a target sorting dimension value from an element score provided by an exemplary embodiment of the present application is shown;
[0027] Fig.10 is a flowchart of a ranking list generating method provided by another exemplary embodiment of the present application;
[0028] Fig.11 is a flowchart of a ranking list generating method provided by another exemplary embodiment of the present application;
[0029] Fig.12 It is a structural block diagram of a ranking list generating device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to make the objectives, technical solutions and advantages of the present application more clear, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0031] The term "multiple" as used herein refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.
[0032] Remote Dictionary Server: Remote Dictionary Server (Redis) is an open source, high-performance, memory-based key-value database developed in C language. Similar to the distributed cache system Memcached, it supports relatively more value types for storage, including string, list, set, zset, and hash. These data types support push / pop, add / remove, intersection, union, difference, and richer operations, and these operations are atomic. On this basis, Redis supports various different sorting methods. Like memcached, in order to ensure efficiency, data is cached in memory. The difference is that Redis will periodically write updated data to disk or write modification operations to additional record files, and on this basis, master-slave synchronization is implemented.
[0033] Ordered set: Ordered set ZSet is a set data structure in Redis that supports sorting. This data structure contains two attributes: score and value. This data structure ensures that the set elements are always sorted by score. Like a set, an ordered set is also a set of string type elements, and duplicate members are not allowed. Redis uses scores to sort the members in the set from small to large. The members of an ordered set are unique, but the scores can be repeated. It is widely used in various business scenarios such as rankings.
[0034] Compare and Swap: Compare and Swap / Set (CAS) is an optimistic lock implementation mechanism used in concurrent programming. The CAS algorithm contains three parameters CAS (V, E, N). V represents the variable to be updated (memory value), E represents the expected value (old value), and N represents the new value. The value of V will be set to N only when the value of V is equal to the value of E. If the value of V is different from the value of E, it means that other threads have already made updates, and the current thread does nothing. Finally, CAS returns the true value of the current V. The CAS operation is performed with an optimistic attitude (optimistic lock), and it always believes that it can successfully complete the operation. When multiple threads use CAS to operate a variable at the same time, only one will win and successfully update, and the rest will fail. The failed thread will not be suspended, but will only be informed of the failure and allowed to try again. Of course, the failed thread is also allowed to give up the operation. Based on this principle, even if the CAS operation does not have a lock, it can detect the interference of other threads on the current thread and handle it appropriately.
[0035] Lua: It is a lightweight and compact scripting language, written in standard C language and open in source code form. It is designed to be embedded in applications to provide flexible expansion and customization capabilities for applications. Lua scripts can be easily called by C / C++ code, and can also call C / C++ functions in turn, which makes Lua widely used in applications. Lua is not only used as an extension script, but also as a common configuration file, replacing file formats such as extensible markup language XML and initialization file ini, and is easier to understand and maintain. Reids 2.6 version adds support for Lua. By embedding support for the Lua environment, Redis solves the long-standing shortcoming of not being able to efficiently process CAS commands, and can combine multiple commands, which are executed atomically, to easily implement functions that were previously difficult to implement or could not be implemented efficiently.
[0036] In the related technology, when it is necessary to sort and update elements in the Redis database, it is necessary to obtain the score and value of each element in the ZSet data structure, where the score is used to represent the sorting score of the element, and the value is used to represent the identification information of the element. Taking the application of the Redis database to the live broadcast platform as an example, the anchor receives virtual gifts from the audience in real time during the live broadcast, and displays the audience's ranking on the list and the score of the virtual gifts given through the reward list. Usually, when processing various elements through the Redis database, the integer part and decimal part of the score can be used to save the number of virtual gifts given by the audience to the anchor and the audience account level value, and the score value is calculated based on this. The value is used to save the audience account, and the Redis database is used to sort and update the ranking of the list displayed on the anchor terminal in real time.
[0037] Although the ranking of the number of virtual gifts and account levels through ZSet's score can achieve ranking in two dimensions, it cannot achieve sorting of elements in more dimensions. For example, when two viewers with the same account level give the same virtual gifts to the anchor, the scores calculated by ZSet's score are the same, that is, the rankings obtained are also the same. In order to rank the audience accounts more accurately, they can also be sorted according to the time of giving virtual gifts, that is, for accounts with the same score and the same level, the account that gave virtual gifts first will be ranked higher. However, since the integer part and decimal part of the score can only represent two sorting dimensions, when it is necessary to sort elements with more than two sorting dimensions, it is necessary to use a relational database to achieve it. However, this method wastes a lot of resources, and at the same time sacrifices the performance advantages of Redis itself and the traversal commands provided by ZSet, and the implementation cost is too high.
[0038] In order to achieve the sorting of multi-dimensional elements, in the embodiment of the present application, when sorting the elements through the Redis database, a new enhanced data structure is constructed on the basis of the original ZSet data structure. The data type stored in the enhanced data structure is the same as that of ZSet, that is, a certain number of binary bits are allocated to each dimension according to the byte type of the score (the score of ZSet is a double type, and the binary bit length is 64 bits), and the values of multiple dimensions are represented by a score, and the integrated score is written into ZSet, and then sorted based on the size of the score value to generate a ranking list about value. This method can be applied to devices with strong data processing capabilities such as servers or computer equipment with data processing. The embodiment of the present application does not limit the specific device type, and for the convenience of description, the following embodiments are explained by taking the application of the model training method to the server as an example.
[0039] Please refer to Figure 1 , which shows a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application. The implementation environment may include: a terminal 110 and a server 120.
[0040] The terminal 110 is installed with an application for displaying rankings, and the terminal 110 can be an electronic device such as a mobile phone, a desktop computer, a tablet computer, a multimedia player, and a laptop computer. The ranking application can be a live broadcast application, a music application, a news application, etc., through which the corresponding ranking information can be displayed, such as the live broadcast application displays the gift ranking, the music application displays the music playback ranking, and the news application displays the click ranking. In this embodiment, taking the live broadcast application as an example, when the user uses the terminal 110 to watch the live broadcast, he can click on the gift ranking to send a ranking generation request to the server 120 to obtain the gift quantity and ranking information. In addition, the terminal 110 can also transfer virtual resources to the corresponding anchor account and reward the anchor with virtual gifts.
[0041] The terminal 110 is connected to the server 120 via a wireless network or a wired network.
[0042] The server 120 includes at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. The server 120 provides background services for the application in the terminal 110. For example, the server 120 may be the background server of the application mentioned above. In an embodiment of the present application, the server 120 runs a database 121, such as a Redis database, and the database 121 stores various elements, such as account information of the anchor account and the audience account, the number of virtual gifts given to the anchor by the audience account, etc. The server 120 is also used to receive a ranking generation request from the terminal 110, and to feed back real-time ranking information to the terminal 110. In addition, the server 120 can also receive a virtual resource transfer instruction sent by the terminal 110 to transfer virtual resources to the anchor.
[0043] Those skilled in the art will appreciate that the number of the above terminals may be more or less. For example, the above terminal may be only one, or the above terminals may be dozens or hundreds, or more. The embodiment of the present application does not limit the number of terminals and device types.
[0044] Please refer to Figure 2 , which shows a flowchart of a ranking list generation method provided by an exemplary embodiment of the present application. This embodiment is described by taking an application server of the method as an example. The method may include the following steps.
[0045] Step 201, read the element score corresponding to each element from the database, the element score is composed of sorting dimension values corresponding to at least two sorting dimensions, and the order of the sorting dimension values in the element score is determined based on the priority of the sorting dimension in the sorting rule.
[0046] The Redis database stores each element received by the server and the element score corresponding to the element. The element is identification information used to identify each data stored in the database, such as account information. The element score is a set of numerical values composed of the sorting dimension values of the element under at least two sorting dimensions, and the sorting dimension values compose the element score in a certain priority order. When sorting elements, they are sorted according to the element score.
[0047] When the server obtains the element score, it determines the byte length of the element score according to the data type of the element score specified by the database, that is, the number of bits that can be expressed as a binary number. Different bits of the binary value are divided into representation areas of different sorting dimensions. Taking the Redis database as an example, the ordered set ZSet contains two attributes, score and value. Usually, value is used to save elements, and score is used to save element scores. Elements and element scores are stored in association in the database. Score is a double-precision floating-point data with a binary length of 64 bits. The positions of sorting dimension values of different sorting dimensions in the element score are not the same. The higher the priority of the sorting dimension, the closer its corresponding sorting dimension value is in the 64 bits.
[0048] In principle, for the gift rankings during the live broadcast, the sorting dimensions that need to be obtained include the score dimension, the account level dimension and the timestamp dimension. The score dimension represents the number of virtual gifts given to the anchor, and is used to represent the score of the viewer's account in the rankings. The account level dimension represents the level of the viewer's account. The timestamp dimension represents the total second value from a fixed time (1970) to the corresponding time of the virtual gift reward.
[0049] like Figure 3 As shown, the 64-bit element score saved in score is divided into three dimensional areas, among which the score dimension has the highest priority, and the corresponding score dimension value is at the front position, followed by the level dimension and the timestamp dimension. Since the highest bit of the binary number of the score represents the sign bit, the above chart shows the 0th to 63rd bits of the score, and the 64th sign bit is not shown.
[0050] It should be noted that when initializing the Redis database, the sorting dimensions of the element scores can be set according to actual needs. For example, if you need to sort according to the score, level and timestamp of the virtual gifts rewarded by the audience account, you can set the score dimension, level dimension and timestamp dimension respectively, and determine the corresponding sorting dimension values based on various sorting dimensions; if you also need to rank according to whether the audience account is a fan of the anchor, that is, under the same score and level conditions, the fan account ranks first, then when initializing the database, set 4 sorting dimensions, set the sorting priority for each sorting dimension, and then calculate the corresponding element score.
[0051] Step 202: sort the elements in the database based on the element scores, and the sorted elements comply with the sorting rules.
[0052] After the server obtains the element score of the element, it determines the value of the 64-bit binary number and sorts the elements according to the size of the element value, such as sorting in descending order or ascending order according to the value of the element score.
[0053] Step 203: In response to the ranking list generation request, a ranking list is generated based on the sorted elements, and feedback is provided.
[0054] When the server receives the ranking generation request sent by the terminal, it obtains the sorted elements from the database, obtains the corresponding identification information based on the sorted elements, ranks the corresponding identification information according to the sorting rules of the element scores, generates the element ranking list, and further feeds the element ranking list back to the terminal.
[0055] In a possible implementation, when the user does not need to obtain the ranking of all elements in the library based on the set sorting rules, the user can also filter out the elements that meet the conditions by setting the threshold of the sorting dimension. For example, when the user only wants to rank the elements with a score value of more than 100 points, after obtaining the elements and the corresponding element scores, the server filters out the elements with a score dimension value of more than 100 points, and generates a ranking list of the filtered element scores according to the sorting rules, and sends it to the terminal.
[0056] To sum up, in the embodiment of the present application, when the database sorts the elements, it determines the corresponding sorting dimension values based on at least two sorting dimensions of each element, and composes the element scores of the elements with the sorting dimension values according to the priorities of the sorting dimensions, and then sorts the elements in the database based on the numerical values of the element scores and according to the sorting rules, so as to generate a ranking list of the elements when a ranking list generation request is received; by adopting the solution provided in the embodiment of the present application, the elements can be sorted directly based on the sorting dimension values of at least two sorting dimensions without the aid of other relational databases, which improves the efficiency of element sorting and reduces cost investment.
[0057] In one possible implementation, the host broadcasts live on the Internet through a terminal, and the audience rewards the host with virtual gifts. When the server receives the virtual resource transfer instruction sent by the audience account, it needs to determine the number of virtual gifts to be rewarded to the host based on the virtual resource instruction. The sorting order stored in the corresponding database will also change accordingly. When the server receives a score update request, it needs to re-sort the various elements based on the updated data.
[0058] Please refer to Figure 4 , which shows a flowchart of a ranking list generating method provided by another exemplary embodiment of the present application. This embodiment is described by taking the application server of the method as an example. The method may include the following steps.
[0059] Step 401, read the element score corresponding to each element from the database, the element score is composed of sorting dimension values corresponding to at least two sorting dimensions, and the order of the sorting dimension values in the element score is determined based on the priority of the sorting dimension in the sorting rule.
[0060] After the server obtains the element scores corresponding to each element from the Redis database, it needs to determine the various sorting dimensions of the element scores. Since the element scores are represented by 64-bit binary numbers, different bits can be used to represent different sorting dimensions. When the element scores are determined based on the score sorting dimension, the rank sorting dimension, and the timestamp sorting dimension, the Redis database can use the sorting rules set in advance to determine the different bits of the element scores to represent the corresponding sorting dimensions, and compose the element scores from the various sorting dimension values according to the priority of the sorting dimension.
[0061] Since score can represent a 64-bit binary number, except for the highest sign bit, the 0th to 62nd bits of the binary number can be divided into multiple sorting dimensions, and the priority of the nth sorting dimension is set higher than the priority of the n+1th sorting dimension, and the bits corresponding to the nth sorting dimension are higher than the bits corresponding to the n+1th sorting dimension. That is, the higher the priority of the sorting dimension, the higher the bit of the element score occupied by the corresponding sorting dimension value. Therefore, the element score is the sorting dimension value corresponding to the first sorting dimension, the sorting dimension corresponding to the second sorting dimension, and the sorting dimension value corresponding to the third sorting dimension from left to right in the order of bit height. As long as the sum of the number of binary bits required for all sorting dimensions does not exceed the maximum number of binary numbers that can be represented by score, the sorting values of multiple sorting dimensions can be combined to form the element score of the element.
[0062] Normally, when sorting the audience accounts in the ranking list, they are sorted according to the number of virtual gifts rewarded by the audience accounts, that is, the more virtual gifts rewarded, the higher the score obtained and the higher the corresponding ranking; when the number of virtual gifts rewarded by different accounts is the same, they are sorted according to the account level. For accounts with the same score, the higher the account level, the higher the ranking; when the account levels are also the same, they are ranked according to the timestamp of the reward of the virtual gifts, that is, the earlier the time of the reward of the virtual gifts, the higher the corresponding ranking.
[0063] like Figure 5As shown in the figure, when the Redis database sorts the audience accounts during the live broadcast, the 39 bits between the 0th bit and the 38th bit of the score are set as the representation range of the timestamp dimension; the 4 bits between the 39th bit and the 42nd bit are set as the representation range of the level dimension; and the 20 bits between the 43rd bit and the 62nd bit are set as the representation range of the score dimension. Among them, the 63rd bit represents the sign bit, and the sorting dimension is not divided.
[0064] When initializing the Redis database, the data interface of the constructed enhanced data structure configures each sorting dimension, the number of bits of the binary number corresponding to the sorting dimension, and the sorting method of each sorting dimension through the constructor. The function is called to perform configuration verification, and the sorting rules of each sorting dimension to be used later are initialized.
[0065] In an exemplary example, the implementation code for initializing the Redis database can be expressed as follows:
[0066]
[0067]
[0068] After the Redis database is initialized, the various sorting dimension values corresponding to the various elements stored in the database can be combined into element scores and sorted.
[0069] It should be noted that when the number and bits of the sorting dimension of the elements in the database need to be changed, it is only necessary to re-divide the bits of the binary number of the score through the constructor, which has good portability and adaptability, and does not require re-modification of the database program content, reducing the maintenance cost of the application.
[0070] Step 402: Responding to the score update request, obtaining update data.
[0071] The Redis database sorts all elements in the database in real time, and when an element in the database is increased, decreased, or updated, the element ranking needs to be updated again. When the server receives a score update request, it obtains the corresponding update data, recalculates the element score based on the update data, and sorts it according to the sorting rules.
[0072] In an illustrative manner, when a viewer gives a virtual gift to a host while watching a live broadcast, the server will recalculate the score corresponding to the current viewer account based on the number of virtual gifts, account level and timestamp, and update the ranking of the leaderboard based on the score.
[0073] Step 403: determine the target sorting dimension corresponding to the updated data and the target bit position corresponding to the target sorting dimension.
[0074] The updated data obtained by the server contains at least two sorting dimension data, and different sorting dimensions correspond to their own sorting dimension values. After receiving the updated data, the target sorting dimension corresponding to the updated data is determined, and the corresponding sorting dimension value is determined based on the target sorting dimension.
[0075] Since the target bits represented by different sorting dimensions in the element scores have been set when the database is initialized, when the database determines the target sorting dimension corresponding to the updated data, it determines the corresponding target bit based on the priority and sorting rule of the target sorting dimension.
[0076] Illustratively, when a viewer gives a virtual gift to a host, the server determines the score value corresponding to the score dimension based on the updated data, and the target bits corresponding to the score dimension are the 20 bits between the 43rd and 62nd bits of the score; and determines the account level corresponding to the level dimension through the viewer account, and the target bits corresponding to the level dimension are the 4 bits between the 39th and 42nd bits of the score; accordingly, the timestamp corresponding to the timestamp dimension can be determined based on the time when the updated data is obtained, and the target bits corresponding to the timestamp dimension are the 39 bits between the 0th and 38th bits of the score.
[0077] Step 404: Update the target sorting dimension value in the target bit position based on the updated data.
[0078] Once the Redis database determines the target sorting dimension values and target bits for the updated data, the element scores of the target elements can be updated.
[0079] The Redis database stores a large number of elements and their corresponding element scores. In one possible case, the database may receive multiple update requests for the same element at the same time, that is, the database will initiate multiple update threads for all update requests. However, since different threads have different calculation times for the updated data, this will cause multiple threads to repeatedly write the updated element scores based on their respective calculation results, and the accuracy of the update cannot be guaranteed.
[0080] In an illustrative manner, the server receives at the same time that account A and account B send 10 and 20 virtual gifts to the anchor account respectively, and the corresponding score values are 10 and 20. Assuming that the database records the score corresponding to the anchor's current virtual gifts as 100, the server will simultaneously start two threads based on the two accounts and calculate the scores of the virtual gifts respectively. The first thread and the second thread read the score value 100 from the database before calculating the virtual gift value. The first thread calculates the updated score to 110 based on the score of the virtual gifts sent by account A, and the corresponding second thread calculates the updated score to 110 based on the score of the virtual gifts sent by account B. The updated score is calculated to be 120. Since the calculation time of the first thread and the second thread may not be the same, the order of writing the updated score after calculation is also different. When the second thread calculates the updated score first, the score in the database is updated to 120. Then the first thread calculates the score to be 110, and then updates the score from 120 to 110 again. At this time, the score of the virtual gift corresponding to the anchor account is 110, that is, the update result depends on the thread that last calculates the updated score, but in fact the updated score should be the sum of the virtual gifts given by the two accounts, and the corresponding score is 130.
[0081] Therefore, in order to prevent data errors caused by concurrent updates of multiple threads, when updating the element score of an element in the database, it is necessary to determine whether the element score has been updated by other threads to avoid erroneous updates. Figure 6 As shown, step 404 also includes the following steps.
[0082] Step 404A, read the first target sorting dimension value from the target bit.
[0083] After the server determines the target sorting dimension, it determines the element score of the corresponding element in the database according to the identification information contained in the update data. When updating the element score, in order to avoid multi-threaded write update errors, it is necessary to first obtain the element score and read the first target sorting dimension value from the target bit according to different sorting dimensions, such as reading the sorting dimension value of the score dimension from the 42nd bit to the 62nd bit.
[0084] Step 404B, calculating a second target sorting dimension value based on the updated data and the first target sorting dimension value.
[0085] Since the element score is composed of multiple sorting dimension values, including the actual score and virtual score of the element, the actual score is the key value used to display the element ranking, corresponding to the first sorting dimension value in the element score, while the virtual score is a non-key value set for the convenience of sorting, corresponding to the nth sorting dimension value in the element score, where n is a positive integer greater than or equal to 2. For example, during the live broadcast, the score of the virtual gift is the key value, while the account level and timestamp are non-key values.
[0086] When updating the element scores, the update methods for different sorting dimensions are also different. The actual score update adopts the cumulative method, while the virtual score update adopts the replacement method. For example, in the gift ranking list during the live broadcast, the first sorting dimension value is the score of the audience account reward, and the user level and timestamp are the nth sorting dimension values. When updating the corresponding element scores, the scores are accumulated on the original basis, indicating the scores of the virtual gifts rewarded by the audience account, and the level dimension value and timestamp dimension value are determined according to the account level and time of each virtual gift reward. The original sorting dimension value needs to be replaced every time it is updated.
[0087] After the first target sorting dimension value is determined, the sorting dimension value corresponding to the updated data is added or replaced with the first target sorting dimension value, and the second target sorting dimension value is calculated to obtain the calculated element score.
[0088] Indicatively, Figure 7 As shown, the target bits corresponding to the score dimension are the 20 bits between the 43rd and 62nd bits of the score, and the corresponding first target sorting dimension value (score sorting dimension value) is 1. When the bonus value corresponding to the updated data is 1, the corresponding second target sorting dimension value is calculated to be 2; the 39th to 42nd bits represent the level dimension, and the corresponding first target sorting dimension value (level dimension value) is 2. The level dimension value corresponding to the updated data is 8, and the corresponding second target sorting dimension value is replaced with 8 after calculation; accordingly, the timestamp dimension value represented by the 0th to 38th bits is also replaced accordingly, and finally the calculated element score is obtained.
[0089] Step 404C, read the third target sorting dimension value from the target bit again.
[0090] In order to avoid errors when updating element scores, after calculating the second target sorting dimension value, it is necessary to obtain the element score again, and read the third target sorting dimension value from the corresponding target bit according to the sorting dimension, and compare whether the first target sorting dimension value and the third target sorting dimension value of the corresponding target bit read twice are the same.
[0091] Step 404D, in response to the third target sorting dimension value being the same as the first target sorting dimension value, updating the second target sorting dimension value to the target bit position.
[0092] When the third target sorting dimension value read twice is the same as the first target sorting dimension value, it means that during the process of calculating the element score, the corresponding element score in the database has not been updated by other threads. At this time, the second sorting dimension value can be updated to the target bit corresponding to the element score.
[0093] If the third target sorting dimension value read twice is different from the first target sorting dimension value, it means that during the calculation of the element score, the corresponding element score in the database has been updated by other threads, and the second target sorting dimension cannot be updated to the target bit corresponding to the element score, otherwise it will cause an update error. At this time, you can read the element score again, and recalculate and update it according to the latest element score.
[0094] In an exemplary example, the implementation code for updating the element score can be expressed as follows:
[0095]
[0096]
[0097]
[0098] The Redis database reads the element scores through ZSet and rewrites the updated element scores into ZSet. By setting a CAS loop and using a Lua script to implement the CAS operation, it ensures that the element scores can be written correctly. Figure 8 The flowchart of the algorithm for updating the element score through CAS operation is shown.
[0099] When the server receives a score update request, the Redis database reads the value of value stored in ZSet based on the updated data obtained. When the value of value matches the updated data, it reads the corresponding element score in score.
[0100] After reading the element score from the Redis database, the target bit in the element score corresponding to the sorting dimension value is determined according to each sorting dimension in the updated data, and the sorting dimension value is converted into a binary number and added or replaced with the target bit of the element score to calculate the actual element score.
[0101] In order to avoid update errors caused by multi-threaded data updates in the database, after calculating the actual element score, it is necessary to read the score value saved in the ZSet from the database again through the CAS operation. If the score value read is the same as the value read for the first time, it means that the score value has not been updated by other threads during the time of calculating the actual element score. The calculated actual element score is the updated element score, and the CAS process can be terminated. If the score value read again is different from the value read for the first time, it means that the score value has been updated by other threads during the time of calculating the actual element score. At this time, the calculated actual element score is wrong. Re-read the element score in ZSet and re-perform the CAS operation until the update is completed.
[0102] Step 405: sort the elements in the database based on the element scores, wherein the sorted elements comply with the sorting rules.
[0103] After the server updates the element scores corresponding to the elements in the database based on the updated data, the elements are re-sorted based on the preset sorting rules.
[0104] Step 406: In response to the ranking list generation request, a ranking list is generated based on the sorted elements, and feedback is provided.
[0105] When the server receives a request to generate a ranking list, it obtains the elements and corresponding element scores in the database, and determines the ranking of the elements based on the element scores. However, when a terminal or computer needs to display a ranking list, it may need to display element information of a specified sorting dimension, or element information within a specified ranking. For example, the gift ranking list during a live broadcast needs to display information such as the scores and account levels of the top 100 viewer accounts. Therefore, when the server provides feedback to the terminal or computer, it needs to read a specified number of target sorting dimension values from the target element scores, and generate a ranking list based on the target sorting dimension values. Therefore, if Figure 6 As shown, step 406 also includes the following steps.
[0106] Step 406A: In response to the ranking list generation request, determine a target element from the sorted elements.
[0107] When the server receives the ranking list generation request, it determines various sorting information that needs to be displayed according to the ranking list generation request, and determines the target element from the sorted elements.
[0108] Illustratively, during a live broadcast, when the host or audience needs to view ranking information, a ranking generation request is sent to the server to display the reward status of the top 100 audience accounts. The server then needs to filter out the target elements ranked in the top 100 from the database.
[0109] Step 406B: read the target sorting dimension value of the target sorting dimension from the target element score corresponding to the target element.
[0110] After the database filters out the corresponding target elements, since the element score is composed of the sorting dimension values corresponding to different sorting dimensions, when displaying the ranking list, it is also necessary to read the target sorting dimension values corresponding to each target sorting dimension from the element score.
[0111] Step 406C: Generate a ranking list based on the target element and the target sorting dimension value, and provide feedback.
[0112] After the server reads the corresponding target sorting dimension value from the target bit according to the target sorting dimension, it generates a ranking list based on the ranking of each element and the corresponding target sorting dimension value, and provides feedback.
[0113] However, since the elements in the database may contain multiple sorting dimensions, the sorting rules used by different sorting dimensions are not the same. For example, in the gift ranking list, the score of the virtual gift rewarded to the anchor is sorted in positive order, and the level is also sorted in positive order, but the timestamp represents the total number of seconds from 1970 to the receipt of the updated data. Therefore, the value of the timestamp number of the virtual gift rewarded first is relatively small, and the timestamp dimension needs to be sorted in reverse order. When displaying the element ranking list, the score corresponding to the time dimension is the information that the audience or anchor focuses on. Therefore, the score situation is the actual data that the target element needs to display, and the level information and timestamp information are optional display information. Therefore, when displaying the ranking list, it is also necessary to read the values of each sorting dimension according to the sorting dimension, and step 406C also includes the following steps.
[0114] Step 406C1 , in response to the target sorting dimension being sorted in positive order, determining actual data of the target sorting dimension based on the target sorting dimension value.
[0115] When the target sorting dimension is in positive order, read the corresponding target sorting dimension value from the binary representation of the element score, such as Fig. 9 As shown, the fractional dimension value occupies the 43rd to 62nd bits of the element score, while the other dimension values excluding the fractional dimension occupy the 0th to 42nd bits of the element score. Therefore, the read binary number is shifted right by 43 bits, and the 20 bits corresponding to the fractional dimension are shifted to the 0th to 19th bits, and the high bits are filled with zeros. The obtained value is the actual data of the target dimension, that is, the score corresponding to the viewer account. Similarly, for the level dimension value, the level of the corresponding viewer account can be read by AND operation or shift.
[0116] Step 406C2, in response to the target sorting dimension being sorted in descending order, calculate the actual data of the target sorting dimension based on the target sorting dimension value and the maximum sorting dimension value of the target sorting dimension.
[0117] In one possible implementation, when the ranking list needs to be calculated based on a time rule, the target sorting dimension value needs to be set to reverse order. For example, in a question-answering activity, it is necessary to count the answering time of each answering account and sort them in chronological order. The actual data of the corresponding target sorting dimension is the time information.
[0118] In order to ensure that the scores of elements with earlier times are larger and to facilitate the correct sorting of elements, the maximum sorting dimension value can be set and the corresponding sorting dimension value can be represented by difference. For example, if the timestamp corresponding to the updated data is 1234678, the corresponding binary representation is 000000000000000101111000110000101001110. In order to sort the timestamp in the element scores according to the numerical value, the maximum sorting dimension value that can be represented by 39 bits is subtracted from the timestamp and the obtained value is used as the timestamp. The calculation process of the dimension value can be expressed as: 1 ...
[0119] In an illustrative example, the implementation code for obtaining the corresponding target sorting dimension value through the element score can be expressed as follows:
[0120]
[0121]
[0122] When the program code is executed, it is read from back to front in the order in which the computer reads binary numbers, and then the corresponding value is obtained through bit operations.
[0123] Step 406C3, generating a ranking list based on the target element and the target sorting dimension value, and providing feedback.
[0124] After the target element and the corresponding target sorting dimension value are determined, ranking information about the target element and the target sorting dimension value is generated, and the ranking information is sent to the corresponding terminal.
[0125] Optionally, the server can display the target sorting dimension value or the sorting dimension values of all sorting dimensions in the ranking list based on the ranking list generation request. For example, the user can specify to display the audience account, the score corresponding to the audience account, and the account level information in the ranking list. In addition, the time when the audience account last rewarded a virtual gift can also be displayed.
[0126] In an embodiment of the present application, when the server receives a score update request, it determines the target sorting dimensions and corresponding target bits of the updated data, and then reads the first target sorting value from the target bits of the element score, so as to calculate the second target sorting dimension value based on the updated data and the first target sorting dimension.
[0127] Before writing the calculated second target sorting dimension value, the third target sorting dimension value in the target bit is read again and compared with the calculated second target sorting dimension value, so that the second target sorting dimension value is updated to the target bit, thereby completing the update of the element score and improving the accuracy of the element score update.
[0128] In addition, when the server receives a request to generate a ranking list, it can directly read the target elements that have been sorted according to the sorting rules from the database, and read the actual data of the target sorting dimension in the element score, generate a ranking list of the target elements and the target sorting dimension values, and provide feedback, thereby realizing multi-dimensional sorting of elements.
[0129] From the above implementation, it can be seen that the update data matches the elements based on the value stored in the score. When the identification information of the update data is the same as the value read by the ZSet, it indicates that the update data is updating the target element in the corresponding database. However, in a possible implementation, the database may not contain the element corresponding to the update data, that is, the update data needs to add a new element to the database, and all elements after the new element is added are sorted.
[0130] Please refer to Fig.10 , which shows a flowchart of a ranking list generating method provided by another exemplary embodiment of the present application. This embodiment is described by taking the application server of the method as an example. The method may include the following steps.
[0131] Step 1001, read the element score corresponding to each element from the database, the element score is composed of sorting dimension values corresponding to at least two sorting dimensions, and the order of the sorting dimension values in the element score is determined based on the priority of the sorting dimension in the sorting rule.
[0132] The implementation of this step may refer to step 401, and this embodiment will not be described in detail here.
[0133] Step 1002: In response to the element adding instruction, obtain initial data of each sorting dimension.
[0134] When the server receives a data adding instruction, indicating that a new element needs to be added to the database and sorted, the server obtains the initial data of each sorting dimension of the element to be added based on the element adding instruction, that is, each sorting dimension value.
[0135] Illustratively, during a live broadcast, when a new viewer account gives a virtual gift to the anchor for the first time, the server needs to add the account and the corresponding number of gifts to the database, and determine the account level and corresponding timestamp information based on the account information, and sort the corresponding scores to facilitate the generation of a gift-giving ranking list.
[0136] Step 1003: Based on the initial data, write the initial sorting dimension value into the bit corresponding to each sorting dimension.
[0137] After the server obtains the initial data, it determines the bit position of each sorting dimension value in the element score represented by the binary number based on the sorting dimension corresponding to each initial data, converts the initial sorting dimension value into the corresponding binary number, and writes it into the corresponding bit position.
[0138] Since an element may contain multiple sorting dimensions, and the sorting methods of different sorting dimensions may be different, for example, scores and levels are often sorted in ascending order, while timestamps are sorted in descending order, the corresponding initial data needs to be converted into the corresponding initial sorting dimension value before writing into the database, and then the bit corresponding to the element score can be written. Fig.11 As shown, step 1003 also includes the following steps.
[0139] Step 1003A, in response to the sorting dimension corresponding to the initial data being sorted in positive order, the initial data after binary processing is determined as the initial sorting dimension value.
[0140] When it is determined that the sorting dimension corresponding to the initial data is in positive order, the initial data is directly converted into a binary number and determined as the initial sorting dimension value, and the number of bits of the converted binary number corresponds to the bits of the sorting dimension set in the score.
[0141] For example, for the score dimension and the rank dimension, the score value of the initial data is converted into a 20-bit binary number, and the rank value is converted into a 4-bit binary number. The position of each sorting dimension in the element score is determined in order of priority, and the values of each initial sorting dimension are combined into the element score.
[0142] Step 1003B, in response to the fact that the sorting dimension corresponding to the initial data is sorted in reverse order, the initial sorting dimension value is calculated based on the maximum binary number corresponding to the sorting dimension and the initial data after binary processing.
[0143] When it is determined that the sorting dimension corresponding to the initial data is in reverse order, the larger the corresponding value, the later its ranking should be. If the initial data sorted in ascending order and descending order are directly composed of element scores, sorting errors will result. In order to correctly represent the ranking of the elements, the maximum binary number can be subtracted from the initial element score and represented by the calculated difference. For example, when the initial data is a timestamp, the larger its value is, the later it was added to the database. Therefore, the corresponding initial sorting dimension value after subtraction is also smaller. At this time, the determined initial sorting dimension values can be composed of element scores.
[0144] It should be noted that, for the initial data sorted in reverse order, in addition to setting the maximum binary number, the initial sorting dimension value can also be determined by setting a fixed binary value and subtracting it from the initial data. For example, if the initial data of a certain sorting dimension is 0101 with 4 bits, and the fixed binary number of the sorting dimension is preset to 1000, the calculated value of the sorting dimension is 0011.
[0145] Step 1004, write the initial sorting dimension value into the bit corresponding to the sorting dimension.
[0146] After the database determines the initial sorting dimension values, it writes the initial sorting dimension values into the corresponding bits according to the sorting rules.
[0147] In an illustrative example, the code for writing initial data into a database can be expressed as follows:
[0148]
[0149]
[0150] As can be seen from the above code, score contains three sorting dimensions. When writing each initial sorting dimension value, the data on each bit is read in sequence from back to front and written into the corresponding bit in score until all three initial sorting dimension values are written into score. At the same time, for newly added elements, the element's identification information also needs to be written into the value associated with score.
[0151] Step 1005: sort the elements in the database based on the element scores, wherein the sorted elements comply with the sorting rules.
[0152] The implementation of this step may refer to step 405, and this embodiment will not be described in detail here.
[0153] Step 1006: In response to the ranking list generation request, a ranking list is generated based on the sorted elements, and feedback is provided.
[0154] The implementation of this step may refer to step 406, and this embodiment will not be described in detail here.
[0155] In an embodiment of the present application, when the server receives an element addition instruction and needs to add an element to the database and sort it, it obtains the initial data of each sorting dimension and processes the initial data according to the sorting method of the sorting dimension to determine the corresponding initial sorting dimension value, and then writes the initial sorting dimension value into the bit corresponding to the sorting dimension, obtains the element score of the element and stores it in the database for sorting. Furthermore, when a ranking generation request is received, a ranking is generated based on the sorted elements and feedback is provided.
[0156] refer to Fig.12 , which shows a structural block diagram of a ranking generation device provided by an embodiment of the present application. The device includes:
[0157] A reading module 1201 is used to read the element scores corresponding to each element from the database, where the element scores are composed of sorting dimension values corresponding to at least two sorting dimensions, and the order of the sorting dimension values in the element scores is determined based on the priority of the sorting dimension in the sorting rule;
[0158] A sorting module 1202, configured to sort the elements in the database based on the element scores, wherein the sorted elements comply with the sorting rule;
[0159] The feedback module 1203 is used to respond to the ranking list generation request, generate a ranking list based on the sorted elements, and provide feedback.
[0160] Optionally, the element score is a binary number, and the priority of the nth sorting dimension in the sorting rule is higher than the priority of the n+1th sorting dimension in the sorting rule;
[0161] Optionally, the bit corresponding to the nth sorting dimension is higher than the bit corresponding to the (n+1)th sorting dimension, and n is a positive integer.
[0162] Optionally, the device further comprises:
[0163] A first acquisition module, configured to acquire update data in response to a score update request;
[0164] A determination module, used to determine a target sorting dimension corresponding to the update data, and a target bit position corresponding to the target sorting dimension;
[0165] An updating module is used to update the target sorting dimension value in the target bit position based on the update data.
[0166] Optionally, the update module includes:
[0167] A first reading unit, configured to read a first target sorting dimension value from the target bit position;
[0168] a calculation unit, configured to calculate a second target sorting dimension value based on the updated data and the first target sorting dimension value;
[0169] A second reading unit, used for reading a third target sorting dimension value from the target bit position again;
[0170] An updating unit is used to update the second target sorting dimension value to the target bit position in response to the third target sorting dimension value being the same as the first target sorting dimension value.
[0171] Optionally, the device further comprises:
[0172] A second acquisition module, configured to acquire initial data of each sorting dimension in response to an element adding instruction;
[0173] A writing module is used to write initial sorting dimension values into bits corresponding to each sorting dimension based on the initial data.
[0174] Optionally, the writing module includes:
[0175] A first determining unit, configured to determine the initial data after binary processing as the initial sorting dimension value in response to the sorting dimension corresponding to the initial data being sorted in positive order;
[0176] A first writing unit, used for writing the initial sorting dimension value into a bit corresponding to the sorting dimension;
[0177] A second confirmation unit is configured to calculate the initial sorting dimension value based on the maximum binary number corresponding to the sorting dimension and the initial data after binary processing in response to the sorting dimension corresponding to the initial data being sorted in reverse order;
[0178] The second writing unit is used to write the initial sorting dimension value into the bit corresponding to the sorting dimension.
[0179] Optionally, the feedback module 1203 includes:
[0180] A third determining unit, configured to determine a target element from the sorted elements in response to a ranking list generation request;
[0181] A third reading unit, configured to read a target sorting dimension value of a target sorting dimension from a target element score corresponding to the target element;
[0182] A feedback unit is used to generate the ranking list based on the target element and the target sorting dimension value, and provide feedback.
[0183] Optionally, the feedback unit is further used for:
[0184] In response to the target sorting dimension being sorted in positive order, determining actual data of the target sorting dimension based on the target sorting dimension value; generating the ranking list based on the target element and the actual data, and providing feedback;
[0185] In response to the target sorting dimension being sorted in descending order, actual data of the target sorting dimension is calculated based on the target sorting dimension value and the maximum sorting dimension value of the target sorting dimension; the ranking list is generated based on the target element and the actual data, and feedback is provided.
[0186] In an exemplary embodiment, a server is also provided, the live broadcast server comprising a processor and a memory, the memory storing at least one program, the at least one program being loaded and executed by the processor to implement the ranking generation method described in the above aspects.
[0187] In an exemplary embodiment, a computer-readable storage medium is also provided, in which at least one program is stored, and the at least one program is loaded and executed by the processor to implement the live interactive method provided in the above embodiment.
[0188] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the ranking generation method provided by the above aspect.
[0189] A person of ordinary skill in the art will appreciate that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk, or an optical disk, etc.
[0190] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A ranking list generation method, characterized in that: The method comprises: In response to the element adding instruction, obtaining initial data of each sorting dimension; In response to the sorting dimension corresponding to the initial data being sorted in positive order, determining the initial data after binary processing as an initial sorting dimension value; and writing the initial sorting dimension value into a bit corresponding to the sorting dimension; In response to the fact that the sorting dimension corresponding to the initial data is sorted in reverse order, based on the maximum binary number corresponding to the sorting dimension and the initial data after binary processing, the initial sorting dimension value is calculated by subtracting the initial data after binary processing from the maximum binary number; the initial sorting dimension value is written into the bit corresponding to the sorting dimension; the element score corresponding to each element is read from the database, the element score is composed of the sorting dimension values corresponding to at least two sorting dimensions, and the order of the sorting dimension values in the element score is determined based on the priority of the sorting dimension in the sorting rule, the element score is a binary number, the priority of the nth sorting dimension in the sorting rule is higher than the priority of the n+1th sorting dimension in the sorting rule, the bit corresponding to the nth sorting dimension is higher than the bit corresponding to the n+1th sorting dimension, and n is a positive integer; sorting the elements in the database based on the element scores, wherein the sorted elements comply with the sorting rule; In response to a ranking list generation request, a ranking list is generated based on the sorted elements, and feedback is provided.
2. The method according to claim 1, characterized in that The method further comprises: In response to the score update request, obtaining update data; Determine a target sorting dimension corresponding to the update data, and a target bit position corresponding to the target sorting dimension; The target sorting dimension value in the target bit position is updated based on the update data.
3. The method according to claim 2, characterized in that The updating of the target sorting dimension value in the target bit position based on the update data includes: Reading a first target sorting dimension value from the target bit position; Calculate a second target sorting dimension value based on the updated data and the first target sorting dimension value; Reading a third target sorting dimension value from the target bit position again; In response to the third target sorting dimension value being the same as the first target sorting dimension value, the second target sorting dimension value is updated to the target bit position.
4. The method according to any one of claims 1 to 3, characterized in that: The step of generating a ranking list based on the sorted elements in response to the ranking list generation request and providing feedback includes: In response to the ranking list generation request, determining a target element from the sorted elements; Reading a target sorting dimension value of a target sorting dimension from a target element score corresponding to the target element; The ranking list is generated based on the target element and the target sorting dimension value, and feedback is provided.
5. The method according to claim 4, characterized in that The generating the ranking list based on the target element and the target sorting dimension value includes: In response to the target sorting dimension being sorted in positive order, determining actual data of the target sorting dimension based on the target sorting dimension value; generating the ranking list based on the target element and the actual data, and providing feedback; In response to the target sorting dimension being sorted in descending order, the actual data of the target sorting dimension is calculated based on the target sorting dimension value and the maximum sorting dimension value of the target sorting dimension; the ranking list is generated based on the target element and the actual data, and feedback is provided.
6. A ranking list generating device, characterized in that: The device comprises: A second acquisition module, configured to acquire initial data of each sorting dimension in response to an element adding instruction; The writing module includes a first determining unit, configured to determine the initial data after binary processing as an initial sorting dimension value in response to the sorting dimension corresponding to the initial data being sorted in positive order; A first writing unit, used for writing the initial sorting dimension value into a bit corresponding to the sorting dimension; a second confirmation unit, configured to calculate, in response to the sorting dimension corresponding to the initial data being sorted in reverse order, a value of the initial sorting dimension by subtracting the initial data after binary processing from the maximum binary number based on a maximum binary number corresponding to the sorting dimension and the initial data after binary processing; A second writing unit, used for writing the initial sorting dimension value into a bit corresponding to the sorting dimension; A reading module, used for reading an element score corresponding to each element from a database, wherein the element score is composed of sorting dimension values corresponding to at least two sorting dimensions, and the order of the sorting dimension values in the element score is determined based on the priority of the sorting dimension in the sorting rule, the element score is a binary number, the priority of the nth sorting dimension in the sorting rule is higher than the priority of the n+1th sorting dimension in the sorting rule, the bit corresponding to the nth sorting dimension is higher than the bit corresponding to the n+1th sorting dimension, and n is a positive integer; A sorting module, used to sort the elements in the database based on the element scores, wherein the sorted elements comply with the sorting rules; The feedback module is used to respond to the ranking generation request, generate a ranking based on the sorted elements, and provide feedback.
7. A server, characterized in that: The server includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the ranking generation method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The readable storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the ranking generation method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Data updating system, data updating method and server
CN111905378A