Content recommendation method and device, equipment, medium and product
By spatially hashing geographic location data and storing it in an in-memory database, and using spatial indexing to quickly locate candidate location data, the problems of high computational cost and large latency in existing technologies are solved, achieving efficient and low-cost content recommendation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-18
- Publication Date
- 2026-03-27
AI Technical Summary
Existing location-based content recommendation solutions suffer from a sharp increase in computational costs and a significant increase in query latency after the explosive growth in the number of users and content. They are unable to meet the real-time recommendation requirements of high concurrency and low latency, and their reliance on third-party map services results in high network overhead and service costs.
By spatially hashing the geolocation data of uploaded content and storing it in an in-memory database, spatial indexes are used to quickly locate candidate location data, avoiding the full table traversal calculations required by traditional databases, thus achieving efficient index management of geolocation.
It improved content retrieval efficiency, reduced service costs, enabled rapid recommendation of location-based content, and reduced system load and network overhead.
Smart Images

Figure CN121743558A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a content recommendation method, apparatus, device, medium, and product. Background Technology
[0002] With the widespread adoption of mobile devices and the improved ability to acquire user location data in real time, location services have become a core capability for user-generated content (UGC) platforms, local services, e-commerce, and the sharing economy. For example, in food delivery platforms, after a user opens the application (APP), the system quickly recommends nearby restaurants or special offers within a preset range based on the user's current location; in UGC platforms, when a user uploads content, the system recommends trending topics or interactive content related to the user's current location based on their geographic location.
[0003] Existing location-based content recommendation solutions typically employ traditional relational databases for latitude and longitude distance calculations or rely on third-party map service providers' Application Programming Interfaces (APIs) for distance calculations and location queries. However, with the explosive growth in the number of users and content, the computational cost of using traditional relational databases to calculate latitude and longitude has increased dramatically, leading to significantly increased query latency and making it difficult to meet the demands of high concurrency and low latency real-time recommendations. Furthermore, relying on third-party map services incurs huge network overhead and expensive service costs when making large-scale real-time API calls.
[0004] Therefore, in the context of location-based content recommendation, improving content retrieval efficiency and reducing service costs are the current challenges. Summary of the Invention
[0005] This application provides a content recommendation method, apparatus, device, medium, and product to improve content query efficiency and reduce service costs in scenarios where content recommendation is based on geographic location.
[0006] Firstly, this application provides a content recommendation method, which includes:
[0007] In response to the location information from the user terminal, multiple candidate location data that match the location information and the associated attribute identifier corresponding to each candidate location data are determined from the memory database. The memory database stores multiple geographic location data that have undergone spatial hash encoding.
[0008] Retrieve content data corresponding to multiple associated attribute identifiers;
[0009] Based on the content data, corresponding recommended content is determined and recommended to the user.
[0010] In one possible implementation, the method further includes:
[0011] In response to uploaded content, determine the geographical location corresponding to the uploaded content;
[0012] The geographical location is spatially hashed to obtain the corresponding geographical location data;
[0013] The geographic location data and the associated attribute identifiers of the uploaded content are stored in the memory database.
[0014] In one possible implementation, the in-memory database includes multiple storage areas, and the geographic location data and the associated attribute identifiers of the uploaded content are stored in the in-memory database, including:
[0015] The feature parameters of the geographic location data are determined based on the geofence corresponding to the geographic location, or based on the content category corresponding to the uploaded content.
[0016] The storage region corresponding to the feature parameter is determined from multiple storage regions, and the associated attribute identifier is stored in the corresponding storage region according to the geographical location data.
[0017] In one possible implementation, determining multiple candidate location data matching the location information and the associated attribute identifier corresponding to each candidate location data from a memory database includes:
[0018] Determine the target feature parameters of the location information;
[0019] Determine the target storage region corresponding to the target feature parameters from multiple storage regions;
[0020] From the target storage area, determine multiple candidate location data that meet preset conditions and the associated attribute identifier corresponding to each candidate location data;
[0021] The preset condition includes: the distance between the location information and the location information is less than a preset distance.
[0022] In one possible implementation, determining the corresponding recommended content based on the content data includes:
[0023] For any one of the multiple content data, determine whether the content data meets the preset conditions;
[0024] If the content data meets the preset conditions, the content data will be used as recommended content.
[0025] If the content data does not meet the preset conditions, the content data is discarded.
[0026] In one possible implementation, the preset condition includes any one of the following:
[0027] The content data refers to the uploaded content;
[0028] The content data falls within the user's selected filter range;
[0029] Content data is matched with user category preferences;
[0030] The content data is not within the scope of blocked content.
[0031] In one possible implementation, before recommending the content to the user, the method further includes:
[0032] For any one of the multiple recommended content items, a distance score is determined based on the geographical location corresponding to the recommended content and the location information of the user's terminal.
[0033] Based on the evaluation data corresponding to the recommended content, the rating value of the recommended content is determined;
[0034] Based on the interaction data corresponding to the recommended content, the interaction value of the recommended content is determined;
[0035] The distance score, rating value, and interaction value are weighted and summed to determine the comprehensive score of the recommended content, wherein the weight coefficients of the distance score, rating value, and interaction value are different;
[0036] Based on the comprehensive score, the multiple recommended items are sorted to obtain the corresponding recommendation list;
[0037] Accordingly, recommending the content to the user includes:
[0038] Recommended content is sent to the user's device according to the recommended list.
[0039] In one possible implementation, the method further includes:
[0040] Establish the association between the location information and the recommended content;
[0041] The location information and the recommended content are cached in the cache database;
[0042] Upon detecting a browsing request from the user's device, determine the location information of the user's device.
[0043] If recommended content related to the location information exists in the cache database, the recommended content related to the location information is retrieved from the cache database and recommended to the user.
[0044] In one possible implementation, the method further includes:
[0045] Upon detecting an update to the user's location information, the recommended content in the cache database that is associated with the location information is released.
[0046] Secondly, this application provides a content recommendation device, the device comprising:
[0047] The determination module is used to determine multiple candidate location data that match the location information from the user terminal and the associated attribute identifier corresponding to each candidate location data from the memory database. The memory database stores multiple geographic location data that have undergone spatial hash encoding.
[0048] The acquisition module is used to acquire content data corresponding to multiple associated attribute identifiers;
[0049] The determination module is also used to determine the corresponding recommended content based on content data;
[0050] The sending module is used to recommend content to the user.
[0051] In one possible implementation, the device further includes: a processing module;
[0052] The determination module is also used to determine the geographical location corresponding to the uploaded content in response to the uploaded content;
[0053] The processing module is used to perform spatial hash encoding on the geographic location to obtain the corresponding geographic location data; and to store the geographic location data and the associated attribute identifiers of the uploaded content into an in-memory database.
[0054] In one possible implementation, the in-memory database includes multiple storage areas, a determination module, and is also used to determine feature parameters of geographic location data, which are determined based on the geofence corresponding to the geographic location or based on the content category corresponding to the uploaded content; and to determine the storage area corresponding to the feature parameters from the multiple storage areas.
[0055] The processing module is used to store the associated attribute identifiers into the corresponding storage areas according to the geographic location data.
[0056] In one possible implementation, a determining module is used to determine the target feature parameters of the location information; determine the target storage area corresponding to the target feature parameters from multiple storage areas; and determine multiple candidate location data that meet preset conditions and the associated attribute identifier corresponding to each candidate location data from the target storage area; wherein the preset conditions include: the distance between the location information and the location information is less than a preset distance.
[0057] In one possible implementation, a determining module is used to determine whether any content data among multiple content data meets preset conditions; if the content data meets the preset conditions, the content data is used as recommended content.
[0058] The processing module is used to discard content data if the content data does not meet preset conditions.
[0059] In one possible implementation, the preset conditions include any of the following: the content data is already uploaded; the content data is within the user's selected filtering range; the content data matches the user's category preferences; and the content data is not within the range of blocked content.
[0060] In one possible implementation, the determining module is further configured to, for any one of the multiple recommended contents, determine a distance score for the recommended content based on the geographical location of the recommended content and the location information of the user's terminal; determine a rating value for the recommended content based on the evaluation data corresponding to the recommended content; and determine an interaction value for the recommended content based on the interaction data corresponding to the recommended content.
[0061] The processing module is also used to perform weighted summation of distance score, rating value, and interaction value to determine the comprehensive score of the recommended content, wherein the weight coefficients of distance score, rating value, and interaction value are different; and to sort multiple recommended content according to the comprehensive score to obtain the corresponding recommendation list.
[0062] The sending module is used to send recommended content to the user's device according to the recommended list.
[0063] In one possible implementation, the processing module is also used to establish the association between location information and recommended content; and to cache the location information and recommended content in a cache database;
[0064] The determination module is also used to determine the user's location information when a browsing request from the user is detected.
[0065] The acquisition module is also used to retrieve recommended content that is associated with location information from the cache database when such content exists in the cache database.
[0066] The sending module is used to recommend content to the user.
[0067] In one possible implementation, the processing module is also used to release recommended content in the cache database that is associated with the location information when the user's location information is detected to be updated.
[0068] Thirdly, this application provides a content recommendation device, including: a processor, and a memory communicatively connected to the processor;
[0069] The memory stores instructions that the computer executes;
[0070] The processor executes computer-executable instructions stored in memory to implement the methods shown in the first aspect above and / or various possible implementations of the first aspect.
[0071] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods shown in the first aspect and / or various possible implementations of the first aspect.
[0072] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the methods shown in the first aspect and / or various possible implementations of the first aspect.
[0073] This application provides a content recommendation method, apparatus, device, medium, and product. The method involves spatially hashing the geographic location data of uploaded content and storing the encoded geographic location data in an in-memory database. When content recommendation is needed to a user, based on the user's current geographic location, multiple candidate location data matching that location and the associated attribute identifiers corresponding to each candidate location data are determined from the in-memory database. Content data corresponding to these associated attribute identifiers is then obtained, and based on the content data, the corresponding recommended content is determined. This method achieves efficient index management of geographic location data by storing it using spatial hashing. During location queries, candidate location data is quickly located using spatial indexes, avoiding the shortcomings of traditional database full-table traversal calculations, thus improving query efficiency and enabling rapid recommendation of geographic location content. Attached Figure Description
[0074] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0075] Figure 1 A flowchart illustrating a content recommendation method provided in this application embodiment. Figure 1 ;
[0076] Figure 2 A flowchart illustrating a content recommendation method provided in this application embodiment. Figure 2 ;
[0077] Figure 3 A flowchart illustrating a content recommendation method provided in this application embodiment. Figure 3 ;
[0078] Figure 4 This is a schematic diagram of the structure of a content recommendation device provided in an embodiment of this application;
[0079] Figure 5 This is a schematic diagram of the structure of a content recommendation device provided in an embodiment of this application.
[0080] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0081] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0082] In the embodiments of this application, the terms "first" and "second" are used to distinguish identical or similar items with essentially the same function and effect, without limiting their order. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that the terms "first" and "second" do not necessarily imply that they are different.
[0083] It should be noted that, in the embodiments of this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0084] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of the relevant data all comply with the relevant laws, regulations, and standards of the relevant countries and regions, have taken necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation access points for users to choose to authorize or refuse.
[0085] Furthermore, the technical solution involved in this application, which involves big data analysis of user information (including but not limited to personal biometrics, identity data, consumption data, asset data, electronic terminal operation data, etc.) and the use of artificial intelligence technology for automated decision-making, and makes decisions that have a significant impact on personal rights based on the results of automated decision-making, provides users with corresponding operation entry points for users to choose to agree to or reject the results of automated decision-making; if the user chooses to reject, the process will proceed to the expert decision-making process.
[0086] First, let me explain the terms used in this application:
[0087] Spatial hashing is a technique that maps multidimensional spatial coordinates (such as geographic latitude and longitude or three-dimensional spatial points) to string or integer indices. It is primarily used for spatial data indexing, query optimization, and collision detection. Its core idea is to discretize continuous space through encoding rules, facilitating efficient storage and retrieval. Commonly used spatial hashing methods include:
[0088] Geohash encoding: used to encode geographic coordinates (latitude and longitude). Its implementation steps are as follows:
[0089] The latitude and longitude ranges (e.g., latitude -90° to 90°, longitude -180° to 180°) are recursively binary-coded, generating binary sequences based on the coordinate intervals. For example, the binary representation of latitude 22.5467932 might be 1010000000, and the binary representation of longitude 114.3528769 might be 1101000101. The latitude and longitude binary sequences are then merged: typically, longitude positions are placed in even-numbered positions, and latitude positions in odd-numbered positions (or vice versa), forming a single binary string. This binary string is then converted to Base32 characters in groups of 5 (using 32 characters such as 0-9 and bz), generating a compact encoded string (e.g., wx4sv61q). The encoding length determines the precision; the longer the encoding, the higher the precision.
[0090] MySQL: A relational database management system that uses a table structure to store data and supports complex queries, transaction processing, and data consistency guarantees.
[0091] Redis: An in-memory data structure storage system, typically used as a key-value database. Its data is primarily stored in memory, allowing for fast read and write operations via key-value pairs, and supports various data structures such as strings, hashes, lists, and sets.
[0092] With the widespread adoption of mobile devices and the improved ability to acquire user location data in real time, location services have become a core capability for businesses such as UGC platforms (e.g., social media, short video platforms), local life services (e.g., food delivery, in-store consumption), e-commerce (e.g., location-based promotional activities), and the sharing economy (e.g., ride-sharing, short-term rental platforms).
[0093] For example, in food delivery platforms, after a user opens the application (APP), the system quickly recommends nearby restaurants or special offers based on the user's current location; in UGC platforms, when a user uploads content, the system recommends popular topics or interactive content related to the user's current location based on their geographic location.
[0094] Existing location-based content recommendation solutions include:
[0095] 1. Latitude and longitude calculation scheme using traditional relational databases: This scheme stores location data in relational databases such as MySQL and calculates the distance between two points based on the Haversine algorithm.
[0096] However, with the explosive growth in the number of users and content, the computational cost of this solution has increased dramatically because it requires traversing the entire table when calculating distances, resulting in a significant increase in query latency and making it difficult to meet the real-time recommendation requirements of high concurrency and low latency.
[0097] 2. Relying on the API interface of third-party map service providers for distance calculation and location query: This solution obtains location information and distance calculation results by calling the API of third-party map services.
[0098] However, relying on third-party map services for large-scale real-time API calls incurs significant network overhead and high service costs. Furthermore, dependence on third-party services poses data security risks and insufficient system autonomy and controllability.
[0099] Therefore, in the context of location-based content recommendation, improving content retrieval efficiency and reducing service costs are the current challenges.
[0100] To address the aforementioned issues, this application provides a content recommendation method. This method involves spatially hashing the geographic location data of uploaded content and then storing the encoded geographic location data in an in-memory database. When content recommendation is needed to a user, based on the user's current geographic location, multiple candidate location data matching that location and the associated attribute identifiers corresponding to each candidate location data are determined from the in-memory database. Content data corresponding to these associated attribute identifiers is then retrieved, and the corresponding recommended content is determined based on the retrieved content data. This method achieves efficient index management of geographic location data by storing it using spatial hashing. During location queries, candidate location data is quickly located using spatial indexes, avoiding the shortcomings of traditional database full-table traversal calculations, thus improving query efficiency and enabling rapid recommendation of geographic location content.
[0101] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0102] Figure 1 A flowchart illustrating a content recommendation method provided in this application embodiment. Figure 1 .like Figure 1 As shown, the content recommendation method provided in this application includes:
[0103] S101. In response to the location information from the user terminal, determine multiple candidate location data that match the location information and the associated attribute identifier corresponding to each candidate location data from the memory database.
[0104] The in-memory database can be, for example, a Redis data storage system. The in-memory database can store multiple spatially hashed geographic location data, each associated with a corresponding attribute identifier.
[0105] Candidate location data can be in GEOHASH format, for example. The associated attribute identifier is used to indicate the content ID corresponding to the corresponding geographic location data. The corresponding content data can be found or obtained based on the associated attribute identifier.
[0106] Understandably, upon detecting uploaded content, the geographic location data of the uploaded content can be stored in an in-memory database using spatial hash encoding, while the attribute data of the uploaded content can be stored in a relational database.
[0107] The following explains one possible storage process for uploaded content.
[0108] In response to uploaded content, determine the geographical location corresponding to the uploaded content; perform spatial hash encoding on the geographical location to obtain the corresponding geographical location data; and store the geographical location data and the associated attribute identifier of the uploaded content in an in-memory database.
[0109] The uploaded content can be, for example, content uploaded by the aforementioned user client, or content uploaded by other user clients. This application does not impose any restrictions on this.
[0110] If uploaded content is detected, the geographical location corresponding to the upload can be determined first, such as the city, latitude and longitude.
[0111] Geographic location data can be in GEOHASH format, for example. After obtaining the GEOHASH formatted geographic location data, the geographic location data and its corresponding content ID can be stored in an in-memory database.
[0112] In one possible implementation, the in-memory database may include multiple storage areas, each storing geographic location data with different characteristic parameters. These characteristic parameters may be determined based on the geofence or region corresponding to the geographic location, or based on the content category corresponding to the uploaded content.
[0113] One possible implementation of storing geographic location data and associated attribute identifiers of uploaded content in an in-memory database is as follows:
[0114] Determine the feature parameters of the geographic location data; identify the storage area corresponding to the feature parameters from multiple storage areas, and store the associated attribute identifiers in the corresponding storage area according to the geographic location data.
[0115] Geographic location data may include, for example, the longitude and latitude of the content data when it was uploaded, as well as the content ID and business ID of the content data.
[0116] The storage space within an in-memory database can be divided according to city, region, or content category.
[0117] For example: storage area 1 is used to store geographic location data within city A, storage area 2 is used to store geographic location data within city B, storage area 3 is used to store geographic location data within area C, and storage area 4 is used to store geographic location data corresponding to content category D.
[0118] In this step, the characteristic parameters of the geographic location data can be determined based on the geofence or area corresponding to the geographic location, or the characteristic parameters of the corresponding geographic location data can be determined based on the content category corresponding to the uploaded content.
[0119] Understandably, the purpose of this step is to store the geographic location data according to the corresponding storage rules so that the query range can be further narrowed when performing range queries later.
[0120] For example, if the user's location information indicates that the user is in city A, then when performing a range query, it is only necessary to perform the range query in storage area 1 of the in-memory database, which is used to store the geographic location data within city A.
[0121] For example, after detecting user-uploaded content, the GEOADD command of Redis GEO can be used to store the location data of the uploaded content in a preset key. The key design supports slicing by business dimensions such as city and category.
[0122] When determining multiple candidate location data that match the location information and the associated attribute identifiers corresponding to each candidate location data, for example, the GEOSEARCH command (or GEORADIUS) can be used to obtain a list of associated attribute identifiers (content IDs) within the range, with the user's latitude and longitude as the center and a preset radius (such as 3 kilometers).
[0123] This step leverages Redis GEO's native spatial indexing capabilities to replace traditional database latitude and longitude calculations, reducing query latency. Simultaneously, due to the encoding characteristics of GEOHASH, range queries can quickly locate candidate location data, providing an efficient data source for subsequent content recommendations.
[0124] S102. Obtain the content data corresponding to multiple associated attribute identifiers.
[0125] The uploaded content may include, for example, corresponding geographic location data and content attribute data. The content data in this step may include, for example, the content attribute data of the uploaded content. Content attribute data may include, for example, corresponding text data, ratings, interaction levels, and listing status.
[0126] Content data can be stored, for example, in a relational database, which is different from the storage location of geographic location data; or it can be stored in the same location as geographic location data, and this application does not impose any restrictions on this.
[0127] In this step, the corresponding content data can be found based on the associated attribute identifier.
[0128] For example, the corresponding content data can be retrieved in batches using Redis Hash or MySQL.
[0129] S103. Based on the content data, determine the corresponding recommended content and recommend the recommended content to the user.
[0130] The content recommendation method provided in this application, when it is necessary to recommend content to a user, determines multiple candidate location data matching the user's current geographical location and the associated attribute identifier corresponding to each candidate location data from an in-memory database, obtains the content data corresponding to the multiple associated attribute identifiers, and then determines the corresponding recommended content based on the obtained content data. This method achieves efficient index management of geographical location by storing geographical location data in a spatial hash encoding manner. When performing location queries, candidate location data is quickly located through spatial index, avoiding the defects of full table traversal calculation in traditional databases, improving query efficiency, and thus achieving rapid recommendation of geographical location content.
[0131] Figure 2 A flowchart illustrating a content recommendation method provided in this application embodiment. Figure 2 In this embodiment, the in-memory database may include multiple storage areas, each storing geographic location data with different feature parameters. These feature parameters may be determined based on the geofence corresponding to the geographic location, or based on the content category corresponding to the uploaded content. This embodiment is... Figure 1 Based on the examples, a possible implementation of the content recommendation method is described in detail. For example... Figure 2 As shown, the content recommendation method provided in this application includes:
[0132] S201. In response to the location information from the user terminal, determine the target feature parameters of the location information.
[0133] The target feature parameters can be determined based on the user's current location or based on the recommendation rules set by the user.
[0134] Recommendation rules may include, for example, the recommendation filtering range set by the user, the category preferences set by the user, and the corresponding blacklist for the user.
[0135] S202. Determine the target storage region corresponding to the target feature parameters from multiple storage regions.
[0136] Step S202 is similar to the steps described above for storing geographic location data; please refer to the above description for details.
[0137] S203. Determine multiple candidate location data that meet preset conditions from the target storage area, as well as the associated attribute identifier corresponding to each candidate location data.
[0138] One example of a preset condition is that the distance between the location information and the location information is less than a preset distance.
[0139] For example: a circular area is formed with the user's current location as the center and a preset distance as the radius. The geographical location data within this circular area are the candidate location data.
[0140] Alternatively, the geographical location data within the area formed by extending a preset distance outward from the user's current location can be considered as candidate location data.
[0141] Alternatively, geographic location data that is in the same city or region as the user's current location and whose corresponding associated attribute identifiers match the user's can be used as candidate location data. This application does not impose any restrictions on this. The actual requirements shall prevail.
[0142] For example, with the user's current latitude and longitude as the center and the radius set to 3 kilometers, multiple geographical locations within 3 kilometers of the user are used as candidate location data.
[0143] S204. Obtain the content data corresponding to multiple associated attribute identifiers.
[0144] Step S204 is similar to step S102 above, and will not be described again here.
[0145] S205. For any one of the multiple content data, determine whether the content data meets the preset conditions; if yes, proceed to step S207; if no, proceed to step S206.
[0146] After obtaining the content data, it can be filtered to reduce system load and ensure that the recommended content complies with business rules.
[0147] Preset conditions may include any of the following: the content data is already uploaded; the content data is within the user's selected filter range; the content data matches the user's category preferences; or the content data is not within the blocked content range.
[0148] S206, Discard content data.
[0149] S207. Use content data as recommended content.
[0150] S208. Recommend the content to the user.
[0151] The content recommendation method provided in this application stores geographic location data with different feature parameters in different storage areas of an in-memory database. When a location query is required, it is only necessary to search for the location in the target storage area corresponding to the target feature parameter among multiple storage areas. This achieves the effect of narrowing the data range of a single range query, reducing unnecessary data scanning, and reducing system load. At the same time, this method quickly locates candidate location data through spatial indexing, avoiding the defects of full table traversal calculation in traditional databases, improving query efficiency, and thus realizing rapid recommendation of geographic location content.
[0152] Figure 3 A flowchart illustrating a content recommendation method provided in this application embodiment. Figure 3 The embodiments of this application are... Figure 1 Implementation examples or Figure 2 Based on the embodiments, a possible implementation method for recommending content to the user is described in detail. For example... Figure 3 As shown, the content recommendation method provided in this application includes:
[0153] S301. Based on the geographical location of the recommended content and the user's location information, determine the distance score of the recommended content.
[0154] This can be achieved by first determining the distance between the geographical location of the recommended content and the user's location information, and then determining the corresponding distance score based on that distance.
[0155] Understandably, the closer the distance, the higher the score.
[0156] S302. Determine the rating value of the recommended content based on the evaluation data corresponding to the recommended content.
[0157] The evaluation data includes, for example, other user reviews of the recommended content, the quality of those reviews, and the number of clicks from other users.
[0158] Understandably, the more reviews a recommended piece of content receives, the higher its review score will be.
[0159] S303. Determine the interaction value of the recommended content based on the interaction data corresponding to the recommended content.
[0160] Interaction data can include, for example, the number of comments, likes, and shares of recommended content, among other interaction-related data.
[0161] Understandably, the number of comments, likes, and shares are positively correlated with the interaction value.
[0162] S304. Perform a weighted summation of the distance score, rating value, and interaction value to determine the comprehensive rating for each recommended content.
[0163] In this step, the overall score can be determined using, for example, the following formula:
[0164] Overall score = (Wd·α) + (Wr·β) + (Wa·γ)
[0165] Where Wd is the distance score, α is the weight coefficient corresponding to the distance score, Wr is the evaluation value, β is the weight coefficient corresponding to the evaluation value, Wa is the interaction value, and γ is the weight coefficient corresponding to the interaction value.
[0166] Understandably, α, β, and γ can be dynamically adjusted based on the current browsing scenario or user preferences, such as emphasizing distance in food delivery scenarios and emphasizing interactivity in UGC platforms.
[0167] The weighting coefficients for distance score, rating value, and interaction value can be the same or different. This application does not impose any restrictions on this.
[0168] S305. Sort the multiple recommended items according to the comprehensive score to obtain the corresponding recommendation list, and send the recommended items to the user terminal according to the recommendation list.
[0169] After obtaining a comprehensive score for multiple recommended items, the recommended items can be sorted from highest to lowest based on the comprehensive score to obtain a corresponding recommendation list. Then, the recommended items can be sent to the user's device according to the recommendation list.
[0170] The content recommendation method provided in this application calculates a comprehensive score for the recommended content from multiple dimensions, such as distance, rating, and interaction, after obtaining multiple recommended content. Then, the order of recommendations is determined according to the comprehensive score, so that the recommendation results are more in line with the user's real-time preferences and improve user satisfaction. At the same time, the method can dynamically adjust the recommendation weight coefficients of multiple dimensions when facing different scenarios. For example, distance is emphasized in the food delivery scenario, and interaction is emphasized in the UGC platform, thereby improving the personalization of recommendations.
[0171] In one possible implementation, as described above Figures 1-3 Building upon the previous example, the identified recommended content can also be cached to reduce the resource overhead of subsequent repeated queries and calculations. Specifically:
[0172] After obtaining the recommended content, a relationship can be established between the location information and the recommended content; then the location information and the recommended content can be cached in the cache database.
[0173] Upon detecting a browsing request from the user's client, determine the user's location information.
[0174] If recommended content related to location information exists in the cache database, then the recommended content related to location information is retrieved from the cache database and directly recommended to the user.
[0175] Understandably, this step significantly reduces the resource overhead of repeated queries and computations by using user location hash caching; requests from the same location can directly hit the cache, avoiding repeated execution of range queries and weight sorting.
[0176] In one possible implementation, upon detecting an update to the user's location information, the recommended content in the cache database that is associated with the location information is released.
[0177] In one possible implementation, cached content can also be updated in real time through a message subscription mechanism.
[0178] In this step, subscription messages (Pub / Sub) can be used to update the ratings, activity levels, and other content data of the recommended content in the cache database in real time.
[0179] For example, when the location of uploaded content changes or its rating is updated, the message subscription mechanism notifies the system via Pub / Sub to update the cached content of the corresponding location hash. For instance, when a merchant's location changes, the system publishes a location update message, refreshing the recommendation list corresponding to that location hash.
[0180] The message subscription mechanism in this step ensures that cached content is synchronized with real-time data, avoids recommendation bias caused by data changes, solves the problem that traditional caching cannot adapt to dynamic location scenarios, and improves the system's response efficiency and data consistency.
[0181] Figure 4 This is a schematic diagram of a content recommendation device provided in an embodiment of this application. Figure 4 As shown, the content recommendation device 400 provided in this application embodiment includes:
[0182] The determination module 401 is used to determine, in response to the location information of the user terminal, multiple candidate location data that match the location information and the associated attribute identifier corresponding to each candidate location data from the memory database. The memory database stores multiple geographic location data that have undergone spatial hash encoding.
[0183] Module 402 is used to obtain content data corresponding to multiple associated attribute identifiers;
[0184] The determination module 401 is also used to determine the corresponding recommended content based on the content data;
[0185] The sending module 403 is used to recommend content to the user.
[0186] In one possible implementation, the device further includes: a processing module 404;
[0187] The determination module 401 is also used to determine the geographical location corresponding to the uploaded content in response to the uploaded content;
[0188] The processing module 404 is used to perform spatial hash encoding on the geographic location to obtain the corresponding geographic location data; and to store the geographic location data and the associated attribute identifier of the uploaded content into an in-memory database.
[0189] In one possible implementation, the in-memory database includes multiple storage areas. The determination module 401 is also used to determine feature parameters of the geographic location data, which are determined based on the geofence corresponding to the geographic location or based on the content category corresponding to the uploaded content; and to determine the storage area corresponding to the feature parameters from the multiple storage areas.
[0190] Processing module 404 is used to store the associated attribute identifiers into the corresponding storage area according to the geographical location data.
[0191] In one possible implementation, the determining module 401 is used to determine the target feature parameters of the location information; determine the target storage area corresponding to the target feature parameters from multiple storage areas; and determine multiple candidate location data that meet preset conditions and the associated attribute identifier corresponding to each candidate location data from the target storage area; wherein the preset conditions include: the distance between the location information and the location information is less than a preset distance.
[0192] In one possible implementation, the determining module 401 is used to determine whether any content data among multiple content data meets preset conditions; if the content data meets the preset conditions, the content data is used as recommended content.
[0193] Processing module 404 is used to discard content data if the content data does not meet preset conditions.
[0194] In one possible implementation, the preset conditions include any of the following: the content data is already uploaded; the content data is within the user's selected filtering range; the content data matches the user's category preferences; and the content data is not within the range of blocked content.
[0195] In one possible implementation, the determining module 401 is further configured to, for any one of the multiple recommended contents, determine the distance score of the recommended content based on the geographical location of the recommended content and the location information of the user's terminal; determine the rating value of the recommended content based on the evaluation data of the recommended content; and determine the interaction value of the recommended content based on the interaction data of the recommended content.
[0196] The processing module 404 is also used to perform weighted summation of distance score, rating value and interaction value to determine the comprehensive score of the recommended content, wherein the weight coefficients of distance score, rating value and interaction value are different; and to sort multiple recommended content according to the comprehensive score to obtain the corresponding recommendation list.
[0197] The sending module 403 is used to send recommended content to the user terminal according to the recommended list.
[0198] In one possible implementation, the processing module 404 is further configured to establish the association between location information and recommended content; and to cache the location information and recommended content in a cache database;
[0199] The determination module 401 is also used to determine the location information of the user terminal when a browsing request from the user terminal is detected;
[0200] The acquisition module 402 is also used to retrieve recommended content that is associated with location information from the cache database when such recommended content exists in the cache database.
[0201] The sending module 403 is used to recommend content to the user.
[0202] In one possible implementation, the processing module 404 is also used to release recommended content in the cache database that is associated with the location information when the user's location information is detected to be updated.
[0203] The content recommendation device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0204] Figure 5 This is a schematic diagram of the structure of a content recommendation device provided in an embodiment of this application. Figure 5 As shown, the content recommendation device 500 provided in this embodiment includes at least one processor 501 and a memory 502. Optionally, the content recommendation device 500 further includes a communication interface 503. The processor 501, memory 502, and communication interface 503 are connected via a bus 504.
[0205] In a specific implementation, at least one processor 501 executes computer execution instructions stored in memory 502, causing at least one processor 501 to perform the above-described method.
[0206] The specific implementation process of processor 501 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0207] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0208] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0209] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0210] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0211] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0212] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0213] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0214] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0215] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0216] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0217] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0218] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0219] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0220] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0221] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.
[0222] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.
[0223] When integrated units / modules are implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.
[0224] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0225] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0226] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0227] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A content recommendation method, characterized in that, The method includes: In response to the location information from the user terminal, multiple candidate location data that match the location information and the associated attribute identifier corresponding to each candidate location data are determined from the memory database. The memory database stores multiple geographic location data that have undergone spatial hash encoding. Retrieve content data corresponding to multiple associated attribute identifiers; Based on the content data, corresponding recommended content is determined and recommended to the user.
2. The method according to claim 1, characterized in that, The method further includes: In response to uploaded content, determine the geographical location corresponding to the uploaded content; The geographical location is spatially hashed to obtain the corresponding geographical location data; The geographic location data and the associated attribute identifiers of the uploaded content are stored in the memory database.
3. The method according to claim 2, characterized in that, The in-memory database includes multiple storage areas, and stores the geographic location data and the associated attribute identifiers of the uploaded content in the in-memory database, including: The feature parameters of the geographic location data are determined based on the geofence corresponding to the geographic location, or based on the content category corresponding to the uploaded content. The storage region corresponding to the feature parameter is determined from multiple storage regions, and the associated attribute identifier is stored in the corresponding storage region according to the geographical location data.
4. The method according to claim 3, characterized in that, The step of determining multiple candidate location data matching the location information from the memory database and the associated attribute identifier corresponding to each candidate location data includes: Determine the target feature parameters of the location information; Determine the target storage region corresponding to the target feature parameters from multiple storage regions; From the target storage area, determine multiple candidate location data that meet preset conditions and the associated attribute identifier corresponding to each candidate location data; The preset condition includes: the distance between the location information and the location information is less than a preset distance.
5. The method according to claim 1, characterized in that, The step of determining the corresponding recommended content based on the content data includes: For any one of the multiple content data, determine whether the content data meets the preset conditions; If the content data meets the preset conditions, the content data will be used as recommended content. If the content data does not meet the preset conditions, the content data is discarded.
6. The method according to claim 5, characterized in that, The preset conditions include any one of the following: The content data refers to the uploaded content; The content data falls within the user's selected filter range; Content data is matched with user category preferences; The content data is not within the scope of blocked content.
7. The method according to any one of claims 1-6, characterized in that, Before recommending the content to the user, the method further includes: For any one of the multiple recommended content items, a distance score is determined based on the geographical location corresponding to the recommended content and the location information of the user's terminal. Based on the evaluation data corresponding to the recommended content, the rating value of the recommended content is determined; Based on the interaction data corresponding to the recommended content, the interaction value of the recommended content is determined; The distance score, rating value, and interaction value are weighted and summed to determine the comprehensive score of the recommended content, wherein the weight coefficients of the distance score, rating value, and interaction value are different; Based on the comprehensive score, the multiple recommended items are sorted to obtain the corresponding recommendation list; Accordingly, recommending the content to the user includes: Recommended content is sent to the user's device according to the recommended list.
8. The method according to any one of claims 1-7, characterized in that, The method further includes: Establish the association between the location information and the recommended content; The location information and the recommended content are cached in the cache database; Upon detecting a browsing request from the user's device, determine the location information of the user's device. If recommended content related to the location information exists in the cache database, the recommended content related to the location information is retrieved from the cache database and recommended to the user.
9. The method according to claim 8, characterized in that, The method further includes: Upon detecting an update to the user's location information, the recommended content in the cache database that is associated with the location information is released.
10. A content recommendation device, characterized in that, The device includes: The determination module is used to determine, in response to the location information of the user terminal, multiple candidate location data that match the location information and the associated attribute identifier corresponding to each candidate location data from the memory database, wherein the memory database stores multiple geographic location data that have undergone spatial hash encoding; The acquisition module is used to acquire content data corresponding to multiple associated attribute identifiers; The determining module is also used to determine the corresponding recommended content based on the content data; The sending module is used to recommend the content to the user terminal.
11. A content recommendation device, characterized in that, include: Memory; processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 9.
13. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 9.