Data query method, device and server
By storing multi-dimensional information of user portrait data in the server and querying user identity using target portrait tags and scopes, the user portrait data storage and maintenance problems are solved, and efficient user portrait query services are realized.
Patent Information
- Application Number
- CN202080094719.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-08
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2040-04-08
AI Technical Summary
Existing Internet products face the problem of huge amount of data and difficulty in maintaining when storing and maintaining user profile data.
By storing the user ID, the portrait label corresponding to the first-order dimension, the second-order dimension information and the portrait values of the second-order dimension in the first-order dimension in the server, the user ID is queried using the target portrait label and the target range, and the query user ID is compared to determine the target user ID that meets the query conditions.
It reduces the number of user portrait data strips that need to be stored, reduces the difficulty of maintaining user portrait data, and at the same time realizes multi-dimensional user portrait data query service.
Smart Images

Figure CN115023697B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and more specifically, to a data query method, device and server. Background Art
[0002] With the rapid development of Internet technology, Internet products have been widely used. At present, Internet products usually provide users with accurate push services based on user portrait data. However, the existing storage method of user portrait data has a huge amount of data and is difficult to maintain. Summary of the invention
[0003] In view of the above problems, the present application proposes a data query method, device and electronic device to improve the above problems.
[0004] In a first aspect, an embodiment of the present application provides a data query method, which is applied to a server, and the server stores user portrait data, each piece of user portrait data includes a user identifier, a portrait tag corresponding to a first-order dimension, second-order dimension information of the portrait tag, and a portrait value of the portrait tag in the second-order dimension in the first-order dimension. The method includes: obtaining a query condition, the query condition including a target portrait tag, target second-order dimension information, and a target range of portrait values of the target portrait tag; querying a first user identifier according to the target portrait tag and the target range, and querying a second user identifier according to the target portrait tag and the target second-order dimension information; comparing whether the queried first user identifier and the second user identifier have the same user identifier, and if so, determining the same user identifier as the target user identifier that meets the query condition.
[0005] In the second aspect, an embodiment of the present application provides a data query device, which is applied to a server, and the server stores user portrait data, each piece of user portrait data includes a user identifier, a portrait tag corresponding to a first-order dimension, second-order dimension information of the portrait tag, and a portrait value of the portrait tag in the first-order dimension. The device includes: an acquisition module and a query module. Among them, the acquisition module is used to obtain query conditions, and the query conditions include a target portrait tag, target second-order dimension information, and a target range of portrait values of the target portrait tag; the query module is used to query a first user identifier based on the target portrait tag and the target range, and query a second user identifier based on the target portrait tag and the target second-order dimension information; compare whether the queried first user identifier and the second user identifier have the same user identifier, and if so, determine the same user identifier as the target user identifier that meets the query conditions.
[0006] In a third aspect, an embodiment of the present application provides a server, comprising: one or more processors; a memory; one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the above-mentioned method.
[0007] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having program code stored thereon, and the program code can be called by a processor to execute the above method.
[0008] Compared with the prior art, the solution provided by the present application is that each piece of user portrait data stored in the server includes a user ID, a portrait tag corresponding to the first-order dimension, the second-order dimension information of the portrait tag, and the portrait value of the second-order dimension of the portrait tag in the first-order dimension. The server obtains query conditions, which include a target portrait tag, target second-order dimension information, and a target range of portrait values of the target portrait tag; queries the first user ID according to the target portrait tag and the target range, and queries the second user ID according to the target portrait tag and the target second-order dimension information; compares whether the queried first user ID and the second user ID have the same user ID, and if so, determines the same user ID as the target user ID that meets the query conditions. In this way, the number of user portrait data that needs to be stored can be reduced while realizing the user portrait query function, thereby reducing the difficulty of maintaining user portrait data.
[0009] These and other aspects of the present application will become more clearly understood in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0011] Figure 1 A schematic diagram of an application environment suitable for an embodiment of the present application is shown.
[0012] Figure 2 A flow chart of a data query method according to an embodiment of the present application is shown.
[0013] Figure 3 A flow chart of a data query method according to another embodiment of the present application is shown.
[0014] Figure 4 Shows Figure 3 A flowchart of establishing a first inverted index in the illustrated embodiment.
[0015] Figure 5 Shows Figure 3 A schematic diagram of the structures of the first inverted index and the second inverted index in the illustrated embodiment.
[0016] Figure 6 Shows Figure 3 A flowchart of establishing a second inverted index in the illustrated embodiment.
[0017] Figure 7 A flow chart of a data query method according to yet another embodiment of the present application is shown.
[0018] Figure 8 Shows Figure 7 A schematic diagram of a sub-step of step S740 is shown.
[0019] Fig. 9 Shows Figure 7 Another schematic diagram of sub-steps of step S740 is shown.
[0020] Fig.10 Shows Figure 7 Another flow chart of the data query method of the illustrated embodiment.
[0021] Fig.11 A block diagram of a data query device provided in an embodiment of the present application is shown.
[0022] Fig.12 It is a block diagram of a server for executing a data query method according to an embodiment of the present application.
[0023] Fig.13 It is a storage unit of an embodiment of the present application for storing or carrying a program code for implementing a data query method according to an embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0025] In some scenarios, the storage format of user portrait data is: <user ID, TagKey, Value>. The user ID is information used to represent the user's identity, for example, it can be a user account, user ID, etc. TagKey, also known as the label key, is used to represent the specific meaning of the portrait data, and can be a monitoring indicator of a specific dimension, such as the payment amount in the game dimension, the activity level in the game dimension, etc. Value is the value corresponding to the TagKey. When the TagKey is a monitoring indicator of a specific dimension, the Value can be the specific monitoring value of the monitoring indicator. Using the above storage format, for each user, it is necessary to store the user portrait data of different dimensions of the user separately in order to provide the user with a multi-dimensional query service for user portrait data.
[0026] For example, in order to provide user portrait data query services in multiple dimensions such as the payment amount of different users on the game, the payment amount on a specific game type, and the payment amount on a specific game, the data that needs to be stored includes at least: <user ID, game_fee, Value>, <user ID, game_type_fee, Value>, <user ID, gameId_fee, Value>. Among them, game_fee, game_type_fee, and gameId_fee are all TagKeys, game_fee represents the payment amount of the game dimension, that is, all fees paid by the user on the game; game_type_fee represents the payment amount of a specific game type, indicating the fee paid by the user on the game of the specific game type; gameId_fee represents the payment amount of a specific game, that is, the fee paid by the user on the specific game. In addition, it is also necessary to store the corresponding relationship between games, game types, and specific game identifiers.
[0027] However, in actual applications, the number of users is huge, and correspondingly, the number of user portrait data that needs to be stored will double, the workload of management and maintenance will also increase, and the difficulty of data processing and maintenance will increase.
[0028] After long-term research, the inventor has proposed a data query method, device and server, which can reduce the difficulty of data processing and data maintenance. The content will be explained below.
[0029] Please refer to Figure 1 , Figure 1 Schematic diagram of the application environment provided by the embodiment of the present application. Among them, the server 100 can be connected to the server 200 and the electronic device 300 through the network. The server 100 can obtain the required user data from the electronic device 300 and store the obtained user data as user portrait data. Based on the stored user portrait data, the server 100 can provide user portrait query services to the outside.
[0030] In an embodiment of the present application, each piece of user portrait data stored in the server 100 includes a user identifier, a portrait tag corresponding to a first-order dimension, second-order dimension information of the portrait tag, and a portrait value of the portrait tag in the second-order dimension in the first-order dimension. Among them, the portrait tag in the user portrait data usually corresponds to the first-order dimension, and the first-order dimension can be a business dimension, such as a game dimension, a social application dimension, etc. The portrait tag can be a monitoring indicator of the business dimension. Taking the portrait tag being game activity as an example, its first-order dimension is the game dimension; taking the portrait tag being social application activity as an example, its first-order dimension is the social application dimension.
[0031] Each first-order dimension may include at least two second-order dimensions. The second-order dimension information in the user portrait data is used to indicate a specific second-order dimension, and the portrait value in the user portrait data may correspond to the second-order dimension in the first-order dimension to which it corresponds. In the case where the first-order dimension is a business dimension, the second-order dimension may be business type information or a business identifier. The portrait value of the portrait tag may be the monitoring value of the above-mentioned monitoring indicator, and the monitoring value corresponds to the business type information under the business dimension or the business indicated by the business identifier.
[0032] For example, the game dimension can be further divided into dimensions corresponding to different game types. For example, the dimension corresponding to the MOBA (Multiplayer online battle arena) type and the dimension corresponding to the tower defense type can all be regarded as second-order dimensions. Correspondingly, the second-order dimension information can be game type information.
[0033] For another example, the game dimension can be further divided into dimensions corresponding to different games, that is, a specific game can be used as a dimension, for example, the dimension corresponding to game A, the dimension corresponding to game B, etc. can all be regarded as second-order dimensions, and correspondingly, the second-order dimension information can be a game identifier or a game name, etc. This embodiment has no limitation on this.
[0034] In a specific example, a piece of user portrait data is <user ID u1, game_fee, game_type1, value1>, where game_fee is a portrait label, indicating the payment amount in the game dimension; game_type1 is second-order dimension information, used to indicate a specific game type, and value1 indicates the amount paid by the user corresponding to user ID u1 for the game of type game_type1 in the game dimension.
[0035] The server 200 is deployed with a server program that needs to use the user portrait query service. The server program can access the server 100 through the network and use the user portrait query service provided by the server 100. The electronic device 300 can be, for example, a smart phone, a tablet computer, a laptop computer, a wearable device, etc. The servers 100 and 200 can be traditional servers, cloud servers, etc., which are not limited in the embodiments of the present application.
[0036] Please refer to Figure 2 , Figure 2 A schematic diagram of a data query method provided by an embodiment of the present application is shown, which can be applied to Figure 1 The server 100 is shown. The steps included in the method are described below.
[0037] Step S110: Obtain query conditions, which include a target portrait tag, target second-order dimensional information, and a target range of portrait values of the target portrait tag.
[0038] In this embodiment, the query condition is used to indicate the user portrait features that need to be queried, and the user identification of users that meet the user portrait features can be queried based on the query condition, so that corresponding processing can be performed according to the user identification that meets the query condition. The target portrait tag refers to the portrait tag that needs to be queried, which indicates the specific meaning of the user portrait features that need to be queried. The target second-order dimension information is used to indicate the dimension corresponding to the portrait value of the target portrait tag that needs to be queried. The target range limits the range of the portrait value of the target portrait tag that needs to be queried, that is, what needs to be queried is the target portrait tag whose portrait value corresponds to the target second-order dimension and whose portrait value belongs to the target range.
[0039] Optionally, the server 100 may obtain the query condition in a variety of ways. In one implementation, the server 200 may send a user portrait query request to the server 100 according to configuration or need, and the user portrait query request may carry the query condition. After the server 100 receives the user portrait query request sent by the server 200, it may identify and extract the query condition from the user portrait query request.
[0040] In another embodiment, the server 100 can communicate with the client in the electronic device 300 as a server. In this case, the server 100 can determine the user portrait features that need to be queried based on its own needs or configuration, and then generate query conditions for indicating the user portrait features that need to be queried.
[0041] Step S120: query the first user identifier according to the target portrait tag and the target range, and query the second user identifier according to the target portrait tag and the target second-order dimensional information.
[0042] In actual applications, query requirements are constantly changing. In addition to the query conditions described in step S110, there may also be query conditions that only include the target portrait tag and the target range of the portrait value of the target portrait tag, or query conditions that include more dimensional information. In addition, in order to achieve fast query, the server 100 usually builds an index for the stored user portrait data, but different index structures are suitable for different query conditions. In this embodiment, in order to enable the server 100 to achieve fast query of various query conditions, a single index structure is used at the bottom layer. In other words, after the query conditions are split into single conditions, queries are performed based on each single condition respectively. Correspondingly, the bottom layer can establish an index for each single condition separately to support fast query for the single condition. Among them, a single condition can be a combination of two specific fields.
[0043] For example, the query condition in step S110 can be divided into two single conditions: <target portrait tag, target range>, and <target portrait tag, target second-order dimensional information>. Thus, based on <target portrait tag, target range>, the user ID that meets the single condition of <target portrait tag, target range> can be queried as the first user ID; based on <target portrait tag, target second-order dimensional information>, the user ID that meets the single condition of <target portrait tag, target second-order dimensional information> can be queried as the second user ID.
[0044] Step S130: Compare the first user identifier and the second user identifier to see whether they are identical. If yes, execute step S140; if no, execute step S150.
[0045] Step S140: Determine the same user identification as a target user identification that meets the query condition.
[0046] Step S150: Return an empty query result.
[0047] What is obtained through step S120 is the user identification that satisfies each single condition respectively. The server 100 can compare the obtained user identifications that satisfy different single conditions to determine whether there is an identical user identification. If there is, the identical user identification is the user identification that satisfies each single condition at the same time, that is, the user identification that satisfies the query condition, and thus the identical user identification can be determined as the target user identification and returned as the query result.
[0048] Correspondingly, if there is no identical user ID among the user IDs that respectively satisfy different single conditions, it means that there is no user ID that satisfies the query condition, and an empty set may be returned as the query result.
[0049] pass Figure 2 The process shown in the figure has changed the storage structure of user portrait data. Since different dimensional information is stored in one user portrait data, the number of user portrait data that needs to be stored is greatly reduced compared to storing different dimensional user portrait data of a user separately. Moreover, on this basis, the query process of user portrait data has been improved. In this way, user portrait data based on the improved storage structure can still provide multi-dimensional user portrait data query services.
[0050] Furthermore, in this embodiment, when the server 100 communicates with the client in the electronic device 300 as a server, the server 100 can determine the content to be pushed according to the user portrait characteristics defined by the query conditions, and after determining the target user identifier that meets the query conditions based on the query conditions, push the content to be pushed to the client corresponding to the target user identifier. In other words, after executing step S140, the data query method provided by this embodiment may also include the following steps: determine the content to be pushed according to the target portrait label, target second-order dimensional information and target range, and push the content to be pushed to the client corresponding to the queried target user identifier. Among them, taking the target user identifier as a target user account as an example, the client corresponding to the target user identifier can be a client currently logged in with the target user account.
[0051] Please refer to Figure 3 , Figure 3 A flowchart of a data query method provided in another embodiment of the present application, which can be applied to Figure 1 The server 100 is shown. The steps included in the method are described below.
[0052] Step S210: Obtain query conditions, which include a target portrait tag, target second-order dimensional information, and a target range of portrait values of the target portrait tag.
[0053] The detailed implementation process of step S210 is similar to that of step S110 , and please refer to the detailed description of step S110 above, which will not be repeated here.
[0054] Step S220: Obtain a first inverted index established based on the portrait label and the portrait value in the user portrait data.
[0055] In this embodiment, the first inverted index is an inverted index established based on the portrait tag and the portrait value. The server 100 can establish the first inverted index when storing the user portrait data for the first time, and in the subsequent process, after storing any user portrait data, update the established first inverted index. In detail, the process of establishing the first inverted index can be as follows: Figure 4 The detailed description is as follows.
[0056] Step S410: For each portrait tag and each portrait value corresponding to the portrait tag, determine the user identifiers corresponding to the portrait tag and the portrait value from the stored user portrait data, and establish a first association relationship between the portrait tag, the portrait value and the user identifiers.
[0057] In this embodiment, there can be multiple portrait tags, such as the game activity, game payment amount, etc., and each portrait tag can have different values. For each portrait tag that appears in the user portrait data stored by the server 100, and each value of the portrait tag (i.e., portrait value), an inverted index can be established.
[0058] In detail, based on a portrait tag and a portrait value (such as a single condition in the previous embodiment), user portrait data including the portrait tag and the portrait value can be searched from the user portrait data stored in the server 100, and user identifiers can be extracted from the found user portrait data. All extracted user identifiers form a first user identifier sequence, and the first user identifier sequence can be associated with the portrait tag and the portrait value to obtain a first association relationship. In this way, for each combination of a portrait tag and a portrait value, a first association relationship can be obtained, and each first association relationship is a data record including a portrait tag, a portrait value, and a first user identifier sequence.
[0059] Step S420: According to the portrait value in each of the first association relationships, store each of the first association relationships in sequence to obtain the first inverted index.
[0060] During implementation, the first association relationships may be stored in sequence according to the size order of the portrait values in the first association relationships, for example, from large to small or from small to large, and the first inverted index may include the first association relationships stored in sequence.
[0061] For example Figure 5 As shown, it is assumed that the structure of the user portrait data in the server 100 is<ID,TagKey,DynamicClass,Value> , ID is the user identifier, TagKey is the portrait tag, DynamicClass is the second-order dimension information, and Value is the portrait value. Then, the first inverted index A can be established based on the stored TagKey and Value.
[0062] Figure 5In the example shown, there is only one TagKey in the server 100, and three values of Value1 (portrait value 1), Value2 (portrait value 2), and Value3 (portrait value 3) appear respectively. Then, the user portrait data including TagKey and Value1 can be searched, and the user identifier can be extracted from it. The extracted user identifier can form a first user identifier sequence. In order to save storage space, the first user identifier sequence can be a BitSet (binary bit) structure. For example, TagKey and Value1 can correspond to InvertID BitSet1 (inverted user identifier binary bit structure 1). Similarly, TagKey and Value2 can correspond to InvertID BitSet2 (inverted user identifier binary bit structure 2), and TagKey and Value3 can correspond to Invert IDBitSet3 (inverted user identifier binary bit structure 3).
[0063] Step S230: According to the first inverted index, query the user identifier corresponding to the target portrait tag and whose portrait value of the target portrait tag belongs to the target range as the first user identifier.
[0064] In detail, the server 100 can directly search for a first association relationship including the target portrait tag and the portrait value belonging to the target range from the first inverted index based on the target portrait tag and the target range, and determine each user identifier in the first user identifier sequence in the found first association relationship as the first user identifier.
[0065] Step S240: Obtain a second inverted index established based on the portrait label and second-order dimension information in the user portrait data.
[0066] In this embodiment, the second inverted index is an inverted index established based on the portrait tag and the second-order dimension information. The server 100 can establish the second inverted index when storing the user portrait data for the first time, and in the subsequent process, after storing any user portrait data, update the established second inverted index.
[0067] It can be understood that in this embodiment, there is no restriction on the execution order between steps S220-step S230 and steps S240-step S250. Correspondingly, there is no restriction on the order of establishing the first inverted index and the second inverted index, as long as they are established after the user portrait data is stored for the first time. In detail, the process of establishing the second inverted index can be as follows: Figure 6 The detailed description is as follows.
[0068] Step S610, for each portrait tag and each second-order dimensional information corresponding to the portrait tag, determine the user identifiers corresponding to the portrait tag and the second-order dimensional information from the stored user portrait data, and establish a second association relationship between the portrait tag, the second-order dimensional information and the user identifiers.
[0069] In this embodiment, the portrait tag corresponds to the first-order dimension, and the first-order dimension may include at least two second-order dimensions, and each second-order dimension may be represented by the corresponding second-order dimension information. The same portrait tag may have different second-order dimension information in different user portrait data, so for each portrait tag appearing in the user portrait data stored by the server 100, and each second-order dimension information corresponding to the portrait tag, an inverted index can be established.
[0070] In detail, based on a portrait tag and a second-order dimension information, user portrait data including the portrait tag and the second-order dimension information can be searched from the user portrait data stored in the server 100, and user identifiers can be extracted from the searched user portrait data, and all extracted user identifiers can form a second user identifier sequence, and then the second user identifier sequence is associated with the portrait tag and the second-order dimension information to obtain a second association relationship. In this way, for each combination of a portrait tag and the second-order dimension information, a second association relationship can be obtained, and each second association relationship is a data record including a portrait tag, the second-order dimension information, and the second user identifier sequence.
[0071] Please refer again Figure 5 , where the second inverted index B is exemplarily shown. Assuming that only the TagKey portrait tag appears in the user portrait data stored in the server 100, and the portrait tag corresponds to DynamicClass1 (second-order dimension information 1), DynamicClass2 (second-order dimension information 2), and DynamicClass3 (second-order dimension information 3), the user portrait data including TagKey and DynamicClass1 can be searched, and the user identifier can be extracted from it to obtain the second user identifier sequence. It can be understood that in order to save storage space, the second user identifier sequence can adopt a BitSet structure. For example, Figure 5 In the scenario shown, TagKey and DynamicClass1 correspond to Invert ID BitSet1' (inverted user identification binary bit structure 1'), similarly, TagKey and DynamicClass2 correspond to Invert ID BitSet2' (inverted user identification binary bit structure 2'), and TagKey and DynamicClass3 correspond to Invert ID BitSet3' (inverted user identification binary bit structure 3').
[0072] Combination Figure 5 In the scenario shown, the data query method provided in this embodiment reduces the number of user portrait data that need to be stored without substantially changing the amount of stored data, thereby reducing the workload of data processing and data maintenance, and reducing the difficulty of data maintenance.
[0073] Step S620: store each of the second association relationships in sequence according to the second-order dimension information in each of the second association relationships to obtain the second inverted index.
[0074] Among them, the second-order dimensional information can be sorted according to certain rules, for example, sorted according to a given dictionary order. The server 100 can store each second association relationship in sequence according to the sorting of the second-order dimensional information in the second association relationship, and the second inverted index can include each second association relationship stored in sequence.
[0075] Step S250: According to the second inverted index, query the user identifier corresponding to the target portrait label having the target second-order dimensional information as the second user identifier.
[0076] In detail, the server 100 can directly search for the second association relationship including the target portrait label and the target second-order dimensional information from the second inverted index based on the target portrait label and the target second-order dimensional information, and determine each user identifier in the second user identifier sequence in the found second association relationship as the second user identifier.
[0077] Step S260: Compare the first user identifier and the second user identifier to see if they are the same. If yes, execute step S270; if no, execute step S280.
[0078] Step S270: Determine the same user identification as a target user identification that meets the query condition.
[0079] Step S280: Return an empty query result.
[0080] In this embodiment, the detailed implementation process of step S260 to step S280 is similar to that of step S130 to step S150. Please refer to the relevant description above for details, which will not be repeated here.
[0081] The data query method provided in this embodiment can reduce the number of user portrait data that need to be stored while implementing a multi-dimensional query service for user portrait data, thereby reducing the difficulty of data processing and data maintenance. In addition, by expanding the hierarchical structure of portrait tags, on the one hand, it supports the management of portrait tag data in finer dimensions. On the other hand, user portrait query services that support finer dimensions can more accurately portray user portraits. For example, label portrayals for dimensions such as a single game or a single application can more accurately identify users based on user characteristics, compared to portrayals based on the dimensions of all games or all applications, thereby achieving more accurate targeted push, thereby effectively improving user experience and enhancing user stickiness.
[0082] Please refer to Figure 7 , Figure 7 A flowchart of a data query method provided in another embodiment of the present application, which can be applied to Figure 1 The server 100 is shown. The steps included in the method are described below.
[0083] In this embodiment, each piece of user portrait data stored by the server 100 may include a user identifier, a portrait tag corresponding to a first-order dimension, second-order dimension information of the portrait tag, third-order dimension information of the portrait tag, and a portrait value of the portrait tag, wherein the portrait value corresponds to the third-order dimension in the second-order dimension in the first-order dimension. In an example, the first-order dimension may be a game dimension, the second-order dimension may be a game type, and the third-order dimension may be a specific game. Correspondingly, the second-order dimension information may be game type information, and the third-order dimension information may be a game identifier or a game name.
[0084] Step S710: Obtain query conditions, which at least include a target portrait tag, target second-order dimensional information, and a target range of portrait values of the target portrait tag.
[0085] The detailed implementation process of step S710 is similar to that of the above-mentioned step S110. Please refer to the relevant description above for details, which will not be repeated here.
[0086] Step S720: Query the first user identifier according to the target portrait tag and the target range.
[0087] The detailed implementation process of step S720 is similar to that of the above-mentioned step S120. Please refer to the relevant description above for details, which will not be repeated here.
[0088] Step S730: Identify whether the query condition includes the target third-order dimension information of the target portrait tag. If yes, execute step S740; if no, execute step S750.
[0089] Step S740: Query the second user identifier according to the target portrait label, the target second-order dimensional information and the target third-order dimensional information.
[0090] When the query condition includes the target third-order dimensional information, the second user identifier can be queried based on the target portrait label, the target second-order dimensional information and the target third-order dimensional information. In an optional manner, step S740 can be performed by Figure 8 The process shown is implemented and described in detail as follows.
[0091] Step S741: Obtain a second inverted index established based on the portrait label and second-order dimensional information in the user portrait data, and a third inverted index established based on the second-order dimensional information and third-order dimensional information in the user portrait data.
[0092] The method of establishing the second inverted index can refer to the above description of Figure 6 The description of the steps shown is not repeated here in detail. The third inverted index is established in a similar manner to the first inverted index and the second inverted index, except that the third inverted index is established based on the second-order dimensional information and the third-order dimensional information.
[0093] In detail, for each second-order dimension information and each third-order dimension information appearing in the user portrait data stored in the server 100, the user portrait data including the second-order dimension information and the third-order dimension information can be searched, and the user identifier is extracted from the searched user portrait data, and the extracted user identifier constitutes a third user identifier sequence, and an association relationship is established between the third user identifier sequence, the second-order dimension information, and the third-order dimension information, and a third association relationship can be obtained. In this way, for each combination of the second-order dimension information and the third-order dimension information, a third association relationship can be obtained.
[0094] The server 100 can sort the third-order dimensional information in each third association relationship according to a certain rule (such as the above-mentioned dictionary order), and then store each third association relationship in sequence according to the said sorting of the third-order dimensional information in the third association relationship to obtain a third inverted index.
[0095] Step S742: According to the second inverted index and the third inverted index, query each user identifier corresponding to the target portrait label having the target second-order dimensional information and the target third-order dimensional information as the second user identifier.
[0096] During implementation, a second association relationship including target second-order dimension information and target portrait label can be searched from the second inverted index, and a second user identification sequence can be obtained from the found second association relationship. A third association relationship including target second-order dimension information and target third-order dimension information can be searched from the third inverted index, and a third user identification sequence can be obtained from the found third association relationship. The second user identification sequence and the third user identification sequence are compared, and the same user identification is determined as the second user identification.
[0097] In another optional manner, step S740 may be performed by Fig. 9 The process implementation shown is described in detail as follows.
[0098] Step S743: Obtain a fourth inverted index established based on the portrait label, second-order dimensional information and third-order dimensional information in the user portrait data, wherein the fourth inverted index is a multi-column joint index.
[0099] In this embodiment, when the query condition can be split into more than three single conditions, at least two of the single conditions can be merged into one condition, and a multi-column joint index can be established for the condition. In detail, the user portrait data including the portrait label, the second-order dimension information and the third-order dimension information can be searched from the user portrait data stored in the server 100, and the user identifier can be extracted from the found user portrait data, and the extracted user identifier can constitute a fourth user identifier sequence. An association relationship between the fourth user identifier sequence and the portrait label, the second-order dimension information, and the third-order dimension information is established to obtain a fourth association relationship. For each fourth association relationship, each of the four association relationships can be first stored in sequence according to the sorting of the second-order dimension information, and then the storage order of each fourth association relationship can be adjusted according to the sorting of the third-order dimension information, thereby obtaining a fourth inverted index.
[0100] Step S744: According to the fourth inverted index, query each user identifier corresponding to the target portrait label having the target second-order dimensional information and the target third-order dimensional information as the second user identifier.
[0101] In this embodiment, a fourth association relationship including target second-order dimensional information, target third-order dimensional information and target portrait label can be searched from the fourth inverted index, and the user identifier in the fourth user identifier sequence in the found fourth association relationship can be determined as the second user identifier.
[0102] Through the fourth inverted index, the process of comparing user identification sequences is omitted, the amount of operations is reduced, and the query speed is improved.
[0103] Step S750: Query the second user identifier according to the target portrait label and the target second-order dimensional information.
[0104] Step S760: Compare the first user identifier and the second user identifier to see if they are the same. If yes, execute step S770; if no, execute step S780.
[0105] Step S770: Determine the same user identifier as a target user identifier that meets the query condition.
[0106] Step S780: Return an empty query result.
[0107] The detailed implementation process of step S750 to step S780 is similar to the above-mentioned step S120 to step S150, and will not be repeated here.
[0108] It is understood that in this embodiment, each piece of user portrait data may also include other dimensional information of the portrait tag, not limited to the above-mentioned second-order dimensional information and third-order dimensional information, and this embodiment has no limitation on this. In the case where the user portrait data contains more dimensional information, the data query processing process is similar to the above-mentioned embodiment.
[0109] The data query method provided in this embodiment can reduce the number of user portrait data storage items and reduce the difficulty of data maintenance while implementing multi-dimensional user portrait query services.
[0110] Optionally, in this embodiment, considering that a multi-column joint index needs to occupy a certain amount of space, a multi-column joint index can be established for fields that appear frequently in the query conditions. Based on this, before executing step S743, the data query method provided by this embodiment can also include: Fig.10 Steps shown.
[0111] Step S790: Count the number of target query conditions that contain target third-order dimensional information in the obtained query conditions.
[0112] Among them, the target query condition refers to a query condition that contains the target third-order dimensional information. Exemplarily, a first data variable can be set, which has an initial value. Every time the server 100 obtains a query condition, it can determine whether the currently obtained query condition contains the target third-order dimensional information. If so, the value of the first data variable is added by 1. In this way, the difference between the current value and the initial value of the first data variable can represent the number of target query conditions currently obtained. Furthermore, when the initial value is 0, the current value of the first data variable can represent the number of target query conditions currently obtained.
[0113] Step S7100: If the number of the target query conditions reaches the first threshold, a fourth inverted index is established based on the portrait label, second-order dimension information and third-order dimension information in the user portrait data.
[0114] In this embodiment, if the number of currently obtained target query conditions reaches the first threshold, a fourth inverted index can be established based on the portrait label, second-order dimension information, and third-order dimension information in the user portrait data. The detailed process of establishing the fourth inverted index can refer to the relevant description above. The first threshold can be set flexibly, for example, it can be set based on statistical data or experience. For example, it can be 500-1000.
[0115] Furthermore, in order to reduce the waste of storage space, after the fourth inverted index is established, the usage frequency of the fourth inverted index can be periodically detected, and when the usage frequency is low, the fourth inverted index can be deleted. Based on this, after the fourth inverted index is established, the data query method provided in this embodiment can also include the following process: periodically executing step S790, if the number of the target query conditions in the current period does not reach the second threshold, then deleting the fourth inverted index.
[0116] In this embodiment, the server 100 can set a second data variable, and at the beginning of each cycle, set the current value of the second data variable to the initial value. In each cycle, each time a query condition is obtained, it can be determined whether the query condition contains the target third-order dimension information. If so, the current value of the second data variable is accumulated by 1, and when the cycle ends, the value of the third data variable can be set to the current value of the second data variable.
[0117] In an optional manner, the server 100 may obtain the current value of the second data variable at the end of a cycle, and calculate the difference between the current value and the initial value, and the difference may be used as the number of the target query conditions in the current cycle. In another optional manner, the server 100 may obtain the current value of the third data variable as the number of the target query conditions in the current cycle.
[0118] In this embodiment, the cycle can also be flexibly set, for example, it can be 1 minute, 10 minutes, half an hour, one hour, one day, etc. It can be understood that the above second threshold can be flexibly set according to the length of the cycle, for example, when the cycle is half an hour, the second threshold can be 300-500.
[0119] Through the data query method provided in this embodiment, the number of user portrait data that needs to be stored can be reduced while implementing a multi-dimensional user portrait query service, thereby reducing the difficulty of data maintenance.
[0120] Please refer to Fig.10 , which shows a structural block diagram of a data query device provided in an embodiment of the present application. The device 1000 can be applied to Figure 1The server 100 shown, the device 1000 may include: an obtaining module 1010 and a query module 1020.
[0121] The acquisition module 1010 is used to obtain query conditions, which include a target portrait tag, target second-order dimensional information, and a target range of portrait values of the target portrait tag.
[0122] The query module 1020 is used to query the first user identifier based on the target portrait tag and the target range, and to query the second user identifier based on the target portrait tag and the target second-order dimensional information; compare whether the same user identifier exists in the queried first user identifier and the second user identifier, and if so, determine the same user identifier as the target user identifier that meets the query conditions.
[0123] Optionally, the device 1000 may further include a push module. The push module may be used to determine the content to be pushed according to the target portrait tag, the target second-order dimension information and the target range after the query module 1020 determines the same user identifier as the target user identifier that meets the query condition; and push the content to be pushed to the client corresponding to the target user identifier.
[0124] Optionally, the query module 1020 may query the first user identifier according to the target portrait tag and the target range by: obtaining a first inverted index established based on the portrait tag and the portrait value in the user portrait data; and according to the first inverted index, querying the user identifier corresponding to the target portrait tag and whose portrait value of the target portrait tag belongs to the target range as the first user identifier.
[0125] The query module 1020 may query the second user identifier according to the target portrait tag and the target second-order dimensional information by: obtaining a second inverted index established based on the portrait tag and the second-order dimensional information in the user portrait data; and querying the user identifier corresponding to the target portrait tag having the target second-order dimensional information as the second user identifier according to the second inverted index.
[0126] Optionally, the device 1000 may further include an index establishment module. The index establishment module may be used to establish a first inverted index in the following manner: for each portrait tag and each portrait value corresponding to the portrait tag, determine each user identifier corresponding to the portrait tag and the portrait value from the stored user portrait data, and establish a first association relationship between the portrait tag, the portrait value and the user identifiers; according to the portrait values in each of the first association relationships, store each of the first association relationships in sequence to obtain the first inverted index.
[0127] The index establishment module can also be used to establish a second inverted index in the following manner: for each portrait label and each second-order dimension information corresponding to the portrait label, determine the user identifiers corresponding to the portrait label and the second-order dimension information from the stored user portrait data, and establish a second association relationship between the portrait label, the second-order dimension information and the user identifiers; according to the second-order dimension information in each of the second association relationships, store each of the second association relationships in sequence to obtain the second inverted index.
[0128] Optionally, the apparatus 1000 may further include an index updating module. The index updating module may be configured to update the first inverted index according to the portrait tag and the portrait value in the user portrait data after storing any piece of user portrait data; and to update the second inverted index according to the portrait tag and the second-order dimension information in the user portrait data after storing any piece of user portrait data.
[0129] Optionally, each piece of user portrait data may further include third-order dimension information of a portrait tag, and the portrait value in the user portrait data corresponds to the third-order dimension in the second-order dimension indicated by the second-order dimension information in the user portrait data.
[0130] In this case, the query module 1020 can also be used for: before querying the second user identifier based on the target portrait tag and the target second-order dimensional information, identifying whether the query condition includes the target third-order dimensional information of the target portrait tag; if it is identified that the query condition does not include the target third-order dimensional information, then executing the step of querying the second user identifier based on the target portrait tag and the target second-order dimensional information; if it is identified that the query condition includes the target third-order dimensional information, then the second user identifier can be queried based on the target portrait tag, the target second-order dimensional information and the target third-order dimensional information.
[0131] Optionally, a way for the query module 1020 to query the second user identifier based on the target portrait label, the target second-order dimensional information and the target third-order dimensional information may be: obtaining a second inverted index established based on the portrait label and the second-order dimensional information in the user portrait data, and a third inverted index established based on the second-order dimensional information and the third-order dimensional information in the user portrait data; and according to the second inverted index and the third inverted index, querying each user identifier corresponding to the target portrait label having the target second-order dimensional information and the target third-order dimensional information as the second user identifier.
[0132] Another way for the query module 1020 to query the second user identifier based on the target portrait label, the target second-order dimensional information and the target third-order dimensional information may be: obtaining a fourth inverted index established based on the portrait label, second-order dimensional information and third-order dimensional information in the user portrait data, wherein the fourth inverted index is a multi-column joint index; and according to the fourth inverted index, querying each user identifier corresponding to the target portrait label having the target second-order dimensional information and the target third-order dimensional information as the second user identifier.
[0133] Optionally, the index establishment module can also be used to: before the query module 1020 obtains the fourth inverted index established based on the portrait label, second-order dimensional information and third-order dimensional information in the user portrait data, count the number of target query conditions that contain target third-order dimensional information in the obtained query conditions; if the number of target query conditions reaches a first threshold, establish a fourth inverted index based on the portrait label, second-order dimensional information and third-order dimensional information in the user portrait data.
[0134] The index updating module can also be used to: periodically count the number of target query conditions containing target third-order dimension information in the obtained query conditions; if the number of the target query conditions does not reach the second threshold in the current period, delete the fourth inverted index.
[0135] Optionally, in an embodiment of the present application, the first-order dimension may be a business dimension, the second-order dimension information may be business type information or a business identifier, and the portrait tag may be a monitoring indicator of the business dimension; correspondingly, the portrait value of the portrait tag may be a monitoring value of the monitoring indicator, and the monitoring value may correspond to the business indicated by the business type information or the business identifier under the business dimension.
[0136] Furthermore, the business dimension may be a game dimension, and the second-order dimension may be game type information or a game name.
[0137] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0138] In several embodiments provided in the present application, the coupling or direct coupling or communication connection between the modules shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or modules, which may be electrical, mechanical or other forms.
[0139] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
[0140] Please refer to Fig.12 , which shows a structural block diagram of a server 100 provided in an embodiment of the present application. The server 100 in the present application may include one or more of the following components: a processor 110, a memory 120, and one or more programs, wherein the one or more programs may be stored in the memory 120 and configured to be executed by one or more processors 110, and the one or more programs are configured to execute the method described in the aforementioned method embodiment.
[0141] The processor 110 may include one or more processing cores. The processor 110 uses various interfaces and lines to connect various parts of the entire server 100, and executes various functions and processes data of the server 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 120, and calling data stored in the memory 120. Optionally, the processor 110 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 110 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 110, but may be implemented separately through a communication chip.
[0142] The memory 120 may include a random access memory (RAM) or a read-only memory (ROM). The memory 120 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as user portrait data) created by the server 100 during use.
[0143] It can be understood that the structure of server 200 is similar to that of server 100, and will not be described in detail here.
[0144] Please refer to Fig.13 , which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable medium 1300 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.
[0145] The computer readable storage medium 1300 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 1300 includes a non-transitory computer-readable storage medium. The computer readable storage medium 1300 has storage space for program code 1310 that performs any method step of the above method. These program codes can be read from or written to one or more computer program products. The program code 1310 can be compressed, for example, in an appropriate form.
[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A data query method, characterized in that: Applied to a server, the server stores user portrait data, each piece of user portrait data is used to store information of different dimensions, including a user identifier, a portrait tag corresponding to a first-order dimension, second-order dimension information of the portrait tag, and a portrait value of the portrait tag in the second-order dimension in the first-order dimension, the method comprising: Obtaining query conditions, the query conditions including a target portrait tag, target second-order dimensional information, and a target range of a portrait value of the target portrait tag; Splitting the query condition into single conditions; Obtain a first inverted index established based on the portrait label and the portrait value in the user portrait data; Based on the target portrait label and the target range obtained by splitting, searching the first inverted index for a first association relationship including the target portrait label and the portrait value belonging to the target range, and determining each user identifier in the first user identifier sequence in the found first association relationship as the first user identifier; Obtain a second inverted index established based on the portrait label and the second-order dimension information in the user portrait data; Based on the target portrait label and the target second-order dimensional information obtained by splitting, searching the second inverted index for a second association relationship including the target portrait label and the target second-order dimensional information, and determining each user identifier in the second user identifier sequence in the found second association relationship as a second user identifier; Compare the first user identifier and the second user identifier to see whether there is an identical user identifier; if so, determine the identical user identifier as a target user identifier that meets the query condition.
2. The method according to claim 1, characterized in that After determining the same user identifier as a target user identifier that meets the query condition, the method further includes: Determine the content to be pushed according to the target portrait label, the target second-order dimensional information and the target range; The content to be pushed is pushed to a client corresponding to the target user identifier.
3. The method according to claim 1, characterized in that The first inverted index is established in the following manner: For each portrait tag and each portrait value corresponding to the portrait tag, determine each user identifier corresponding to the portrait tag and the portrait value from the stored user portrait data, and establish a first association relationship between the portrait tag, the portrait value and the user identifiers; According to the portrait value in each of the first association relationships, the first association relationships are stored in sequence to obtain the first inverted index.
4. The method according to claim 1 or 3, characterized in that: The method further comprises: After storing any piece of user portrait data, the first inverted index is updated according to the portrait label and portrait value in the piece of user portrait data.
5. The method according to claim 1, characterized in that The second inverted index is established in the following manner: For each portrait tag and each second-order dimensional information corresponding to the portrait tag, determine each user identifier corresponding to the portrait tag and the second-order dimensional information from the stored user portrait data, and establish a second association relationship between the portrait tag, the second-order dimensional information and the user identifiers; According to the second-order dimension information in each of the second association relationships, each of the second association relationships is stored in sequence to obtain the second inverted index.
6. The method according to claim 1 or 5, characterized in that: The method further comprises: After storing any piece of user portrait data, the second inverted index is updated according to the portrait label and second-order dimension information in the piece of user portrait data.
7. The method according to any one of claims 1 to 6, characterized in that: Each piece of user portrait data also includes third-order dimension information of the portrait label, and the portrait value in the user portrait data corresponds to the third-order dimension in the second-order dimension indicated by the second-order dimension information in the user portrait data.
8. The method according to claim 7, characterized in that Before querying the second user identifier according to the target portrait tag and the target second-order dimensional information, the method further includes: Identify whether the query condition includes target third-order dimension information of the target portrait tag; If it is identified that the query condition does not include the target third-order dimensional information, the step of querying the second user identifier based on the target portrait label and the target second-order dimensional information is executed.
9. The method according to claim 8, characterized in that The method further comprises: If it is identified that the query condition includes target third-order dimensional information, the second user identifier is queried according to the target portrait label, the target second-order dimensional information and the target third-order dimensional information.
10. The method according to claim 9, characterized in that The querying the second user identifier according to the target portrait tag, the target second-order dimensional information, and the target third-order dimensional information includes: Obtain a second inverted index established based on the portrait label and the second-order dimension information in the user portrait data, and a third inverted index established based on the second-order dimension information and the third-order dimension information in the user portrait data; According to the second inverted index and the third inverted index, each user identifier corresponding to the target portrait label having the target second-order dimensional information and the target third-order dimensional information is queried as the second user identifier.
11. The method according to claim 9, characterized in that The querying the second user identifier according to the target portrait tag, the target second-order dimensional information, and the target third-order dimensional information includes: Obtaining a fourth inverted index established based on the portrait label, second-order dimension information, and third-order dimension information in the user portrait data, wherein the fourth inverted index is a multi-column joint index; According to the fourth inverted index, each user identifier corresponding to the target portrait label having the target second-order dimensional information and the target third-order dimensional information is queried as the second user identifier.
12. The method according to claim 11, characterized in that Before obtaining the fourth inverted index established based on the portrait label, the second-order dimensional information and the third-order dimensional information in the user portrait data, the method further includes: Count the number of target query conditions that contain target third-order dimension information in the obtained query conditions; If the number of the target query conditions reaches a first threshold, a fourth inverted index is established based on the portrait labels, second-order dimensional information, and third-order dimensional information in the user portrait data.
13. The method according to claim 12, characterized in that After establishing the fourth inverted index, the method further includes: Periodically executing the step of counting the number of target query conditions that contain target third-order dimensional information in the query conditions obtained; If the number of the target query conditions in the current cycle does not reach the second threshold, the fourth inverted index is deleted.
14. The method according to any one of claims 1 to 6, characterized in that: The first-order dimension is the business dimension, the second-order dimension information is the business type information or the business identification, and the portrait tag is the monitoring indicator of the business dimension; the portrait value of the portrait tag is the monitoring value of the monitoring indicator, and the monitoring value corresponds to the business indicated by the business type information or the business identification under the business dimension.
15. The method according to claim 14, characterized in that The business dimension is the game dimension, and the second-order dimension is game type information or game name.
16. A data query device, characterized in that: Applied to a server, the server stores user portrait data, each piece of user portrait data is used to store information of different dimensions, including a user identifier, a portrait tag corresponding to a first-order dimension, second-order dimension information of the portrait tag, and a portrait value of the portrait tag in the second-order dimension in the first-order dimension, the device comprises: An acquisition module, used to obtain a query condition, wherein the query condition includes a target portrait tag, target second-order dimensional information, and a target range of a portrait value of the target portrait tag; A query module, used to split the query condition into a single condition; obtain a first inverted index established based on the portrait label and the portrait value in the user portrait data; based on the target portrait label and the target range obtained by the split, search from the first inverted index for a first association relationship including the target portrait label and the portrait value belonging to the target range, and determine each user identifier in the first user identifier sequence in the found first association relationship as the first user identifier; obtain a second inverted index established based on the portrait label and second-order dimensional information in the user portrait data; based on the target portrait label and the target second-order dimensional information obtained by the split, search from the second inverted index for a second association relationship including the target portrait label and the target second-order dimensional information, and determine each user identifier in the second user identifier sequence in the found second association relationship as the second user identifier; compare whether the first user identifier and the second user identifier obtained by the queried are identical, and if so, determine the identical user identifier as the target user identifier that meets the query condition.
17. A server, characterized in that: include: one or more processors; Memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1 to 15.
18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, and the program codes can be called by a processor to execute the method according to any one of claims 1 to 15.
Citation Information
Patent Citations
Method, device and system for processing user portrait based on game playing platform
CN109241408A
User similarity determination method and information recommendation method
CN110223186A
User game real-time recommendation method and system based on big data log analysis
CN110489453A