A method, apparatus, device, and medium for recommending objects.
By dividing the user query area into multiple sub-regions and calculating the distance between the center point of each sub-region and the user, the problem of consuming computational resources for sorting a large number of objects in O2O applications is solved, and efficient object recommendation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-16
- Publication Date
- 2026-03-13
AI Technical Summary
In O2O applications, when there are a large number of offline objects, calculating the distance between the user and each object and sorting them will consume a lot of computing resources.
The user's query area is divided into multiple sub-regions. By calculating the distance between the center point of each sub-region and the user, the target points are sorted and the objects that match the query request are displayed in the order of the sub-regions, reducing the number of times the distance between each object and the user is directly calculated.
It saves computing resources, improves sorting efficiency, ensures user experience, and reduces system performance consumption.
Smart Images

Figure CN115470419B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of recommendation system technology, specifically to an object recommendation method, apparatus, device, and medium. Background Technology
[0002] In today's internet landscape, users can locate offline objects by accessing their online records. For example, O2O (Online to Offline) applications offer sorting features based on distance. Users input their desired type of offline store, such as a restaurant, and the application calculates the distance from each store to the user's location, presenting the results in ascending order of distance. However, when the number of stores or businesses is very large, calculating the distance to each store and then sorting them sequentially consumes significant computing resources. Summary of the Invention
[0003] This application provides an object recommendation method, apparatus, device, and medium to address the problem that sorting a large number of objects by distance between them and users consumes a lot of computing resources.
[0004] Firstly, this application provides an object recommendation method, including:
[0005] In response to a query request initiated by a user, the multiple target points are sorted according to the distance between the coordinates of multiple target points and the coordinates of the user; wherein each target point corresponds to a first sub-region in the target region, and different target points correspond to different first sub-regions, and the target region is the region queried in the query request initiated by the user;
[0006] According to the sorted order of the multiple target points, a first order of objects that meet the query request within the multiple first sub-regions represented by the multiple target points is obtained, and the first order is displayed.
[0007] The above method can calculate the distance between the coordinates of the target points in multiple sub-regions of the area to be queried and the user's coordinates after the user initiates a query request. Then, it sorts the objects in the sub-regions represented by the target points according to the order of the target points and displays the order to the user. This method of calculating the order based on the distance between the sub-regions and the user saves computing resources compared to the method of calculating the order by comparing the distance between each object and the user.
[0008] In one possible embodiment, prior to displaying the first order, the method further includes:
[0009] Based on the user's coordinates and the coordinates of objects matching the query request within the screening area of the target area, the objects matching the query request are sorted to obtain a second sorted order;
[0010] Remove the target object from the first order; wherein the target object is the same as the object in the first order in the second order;
[0011] Based on the distance between the coordinates of the objects in the first and second orders after removal and the user's coordinates, the objects in the second order are merged into the first order after removal.
[0012] In one possible embodiment, the screening area in the target area is determined by the following method:
[0013] From a plurality of second sub-regions within the target region, a target second sub-region is determined; wherein, the target second sub-region is the second sub-region where the user is located; the area of the second sub-region is smaller than the area of the first sub-region;
[0014] The target second sub-region, and a plurality of second sub-regions surrounding the target second sub-region, are designated as screening regions within the target region.
[0015] In one possible embodiment, before sorting the multiple target points based on the distance between the coordinates of the multiple target points and the user's coordinates, the method further includes:
[0016] Determine that the query requirements in the query request initiated by the user meet preset requirements;
[0017] The preset requirements include:
[0018] The distance between the object queried in the query request initiated by the user and the user is greater than a preset number of kilometers; and / or
[0019] The total number of objects queried in the query request initiated by the user is greater than a preset number.
[0020] In one possible implementation, the coordinates of multiple target points are determined in the following manner:
[0021] The coordinates of target points corresponding to multiple first sub-regions within the target region are retrieved from the database; wherein each first sub-region of the target region in the database is represented by a geohash value.
[0022] In one possible embodiment, the geohash value of each of the first sub-regions in the target region is determined by the following method:
[0023] The number of bits in the geohash value corresponding to the target region is determined based on the correspondence between the area size of the region and the number of bits in the geohash value.
[0024] The geohash value of each of the first sub-regions in the target region is determined according to the number of bits in the geohash value corresponding to the target region.
[0025] In one possible embodiment, after obtaining a first order of objects matching the query request within a plurality of first sub-regions represented by the plurality of target points according to the sorted order of the plurality of target points, the method further includes:
[0026] Store the first order;
[0027] If, within a preset time period following the response to the user's query request, another request identical to the query request is received from the user, the first sequence will be displayed again.
[0028] Secondly, this application provides an object recommendation device, comprising:
[0029] The first sorting module is used to respond to a query request initiated by a user and sort the multiple target points according to the distance between the coordinates of multiple target points and the coordinates of the user; wherein, each target point corresponds to a first sub-region in the target region, and different target points correspond to different first sub-regions, and the target region is the region queried in the query request initiated by the user;
[0030] The display module is used to obtain a first order of objects that meet the query request within a plurality of first sub-regions represented by the plurality of target points according to the sorted order of the plurality of target points, and to display the first order.
[0031] In one possible embodiment, the device further includes:
[0032] The second sorting module is used to sort the objects that meet the query request according to the user's coordinates and the coordinates of the objects that meet the query request in the screening area of the target area, so as to obtain a sorted second order;
[0033] The elimination module is used to eliminate target objects in the first order; wherein the target object is an object in the second order that is the same as the object in the first order;
[0034] The fusion module is used to merge objects in the second order into the first order after removal, based on the distance between the coordinates of objects in the first order after removal and the coordinates of the second order and the user's coordinates.
[0035] In one possible embodiment, the second sorting module is further configured to:
[0036] From a plurality of second sub-regions within the target region, a target second sub-region is determined; wherein, the target second sub-region is the second sub-region where the user is located; the area of the second sub-region is smaller than the area of the first sub-region;
[0037] The target second sub-region, and a plurality of second sub-regions surrounding the target second sub-region, are designated as screening regions within the target region.
[0038] In one possible embodiment, the device further includes:
[0039] The preprocessing module is used to determine whether the query requirements in the query request initiated by the user meet preset requirements;
[0040] The preset requirements include:
[0041] The distance between the object queried in the query request initiated by the user and the user is greater than a preset number of kilometers; and / or
[0042] The total number of objects queried in the query request initiated by the user is greater than a preset number.
[0043] In one possible embodiment, the first sorting module is further configured to:
[0044] The coordinates of target points corresponding to multiple first sub-regions within the target region are retrieved from the database; wherein each first sub-region of the target region in the database is represented by a geohash value.
[0045] In one possible embodiment, the first sorting module is further configured to:
[0046] The number of bits in the geohash value corresponding to the target region is determined based on the correspondence between the area size of the region and the number of bits in the geohash value.
[0047] The geohash value of each of the first sub-regions in the target region is determined according to the number of bits in the geohash value corresponding to the target region.
[0048] In one possible embodiment, the device further includes:
[0049] The post-processing module is used to store the first sequence;
[0050] If, within a preset time period following the response to the user's query request, another request identical to the query request is received from the user, the first sequence will be displayed again.
[0051] Thirdly, this application provides an electronic device, comprising:
[0052] Memory, used to store program instructions;
[0053] A processor is configured to invoke program instructions stored in the memory and execute the steps of the method described in any one of the first aspects according to the obtained program instructions.
[0054] Fourthly, this application provides a computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed by a computer, cause the computer to perform the method described in any one of the first aspects.
[0055] Fifthly, this application provides a computer program product comprising: computer program code, which, when run on a computer, causes the computer to perform the method described in any one of the first aspects. Attached Figure Description
[0056] Figure 1 This is a schematic diagram illustrating the application of an object recommendation method provided in an embodiment of this application;
[0057] Figure 2 A flowchart illustrating an object recommendation method provided in this application embodiment;
[0058] Figure 3 A schematic diagram of multiple first sub-regions for dividing a target region, provided in an embodiment of this application;
[0059] Figure 4 A flowchart illustrating another object recommendation method provided in this application embodiment;
[0060] Figure 5 A schematic diagram illustrating a target region division comprising multiple first sub-regions and multiple second sub-regions, provided in an embodiment of this application;
[0061] Figure 6 A flowchart illustrating a store recommendation method provided in this application embodiment;
[0062] Figure 7 A structural diagram of an object recommendation device provided in an embodiment of this application;
[0063] Figure 8 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0064] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. 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. Unless otherwise specified, the embodiments and features in the embodiments of this application can be arbitrarily combined with each other. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0065] The terms "first" and "second" in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the term "comprising" and any variations thereof are intended to cover non-exclusive protection. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. The term "multiple" in this application can mean at least two, for example, two, three, or more, and the embodiments of this application do not impose limitations.
[0066] The data collection, dissemination, and use in this application all comply with relevant national laws and regulations.
[0067] Before introducing the object recommendation method provided in the embodiments of this application, for ease of understanding, the technical background of the embodiments of this application will be described in detail below.
[0068] Terminology Explanation:
[0069] O2O: Online To Offline, combines offline business opportunities with the internet, making the internet the front end for offline transactions.
[0070] GeoHash is an address encoding method that encodes two-dimensional spatial latitude and longitude data into a string. Its characteristic is that the closer the latitude and longitude are, the more similar they become after encoding.
[0071] Figure 1 This is a diagram illustrating application scenarios where users query objects using a terminal. For example... Figure 1As shown in the application scenario diagram, a user opens an O2O application on their device, enters the object they want to query, and the O2O application calculates the distance between each offline store's location and the user's location, presenting the results to the user in ascending order of distance. For example, if the order is object 1, object 2, and object 3, the order displayed on the device from top to bottom would be object 1, object 2, and object 3. If the number of objects is large, calculating the distance and sorting them one by one would consume a significant amount of computing resources.
[0072] To address the aforementioned technical issues, this application proposes the following technical concept: Divide the user-queried area into multiple sub-regions, then find a point in each sub-region to represent it, calculate the distance between the point in the sub-region and the user's location, sort the points in the multiple sub-regions, and obtain the order of objects in the sub-regions that meet the user's request according to the order of the points in the sub-regions, and display them to the user. Compared with the method of calculating the distance between multiple objects and the user one by one and then sorting them, this saves computing resources.
[0073] 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.
[0074] Combination Figure 2 As shown in the figure, this application provides an object recommendation method, which includes:
[0075] S200: Responding to a user's query request, sorting multiple target points according to the distance between the coordinates of multiple target points and the user's coordinates;
[0076] Each target point corresponds to a first sub-region within the target region, and different target points correspond to different first sub-regions. The target region is the region queried in the query request initiated by the user.
[0077] The target region is typically the user's province or city. After opening the application, the user is usually prompted to select a region, such as their own province or city, or the region they want to search for; this region is the target region. The application automatically identifies the user's province or city and uses it as the target region. The target point is a point within the first sub-region, such as the center point.
[0078] Coordinates can be represented using latitude and longitude. That is, based on the latitude and longitude of multiple target points and the user's latitude and longitude, the distance between each target point and the user is calculated, and then each target point is sorted.
[0079] S201: According to the sorted order of multiple target points, obtain the first order of objects that meet the query request in multiple first sub-regions represented by multiple target points, and display the first order.
[0080] In detail, the first order of the objects that meet the query request within the first sub-regions represented by the sorted target points is the order in which the target points are closest to the user from smallest to largest.
[0081] Combination Figure 3 As shown, the target area includes first sub-region A, first sub-region B, first sub-region C, and first sub-region D. First sub-region A includes objects 1 to n that meet the query request, first sub-region B includes objects 1 to m that meet the query request, first sub-region C includes objects 1 to p that meet the query request, and first sub-region D includes objects 1 to q that meet the query request.
[0082] Calculate the distance between the user and the center point of the first sub-region A, the distance between the user and the center point of the first sub-region B, the distance between the user and the center point of the first sub-region C, and the distance between the user and the center point of the first sub-region D.
[0083] If the distance between the user and the center point of the first sub-region A is the smallest, the distance between the user and the center point of the first sub-region C is the second smallest, the distance between the user and the center point of the first sub-region B is the third smallest, and the distance between the user and the center point of the first sub-region D is the smallest, then the sorting result of the multiple center points is: center point of the first sub-region A, center point of the first sub-region C, center point of the first sub-region B, center point of the first sub-region D.
[0084] Then, based on the sorting results of multiple center points, the objects in the sub-region are sorted to obtain the first order, which is: object 1~n, object 1~p, object 1~m, object 1~q.
[0085] It should be noted that, in the first order, the objects within the sub-region that meet the user's request are not ordered in any particular order.
[0086] When displaying the first sequence to the user, the distance from the center point of each sub-region to the user can also be displayed, facilitating user queries. For example, when objects 1 to n are displayed, the distance from the center point of the first sub-region A to the user is also displayed; when objects 1 to p are displayed, the distance from the center point of the first sub-region C to the user is also displayed; when objects 1 to m are displayed, the distance from the center point of the first sub-region B to the user is also displayed; and when objects 1 to q are displayed, the distance from the center point of the first sub-region D to the user is also displayed.
[0087] The "Display First Order" option allows you to display objects in the first order based on the number of objects on each page requested by the user and the page currently being accessed.
[0088] For example, if each display page in a user request can hold 5 objects, then the first display page will hold 1 to 5 objects, the second display page will hold 6 to 10 objects, the third display page will hold 11 to 15 objects, and so on.
[0089] For example, when n is 9, p is 5, m is 20, and q is 10, according to the display order described above, the first display page displays 5 objects from 1 to n, the second display page displays 4 objects from 1 to n (these 4 are different from the 5 displayed on the first display page) and 1 object from 1 to p, and the third display page displays 4 objects from 1 to p (these 4 are different from the 1 displayed on the second display page) and 1 object from 1 to m.
[0090] When a user is accessing the first display page, then five objects from object 1 to n are displayed to the user;
[0091] When a user is accessing the second display page, the user is shown four objects from 1 to n and one object from 1 to p.
[0092] When a user is accessing the third display page, the user will be shown four objects from object 1 to p and one object from object 1 to m.
[0093] To help users better understand the distance between themselves and objects, this application can further refine the ranking before the initial order and apply the aforementioned more fuzzy ranking afterward. Specifically, this application provides another object recommendation method, combining... Figure 4 As shown, it includes:
[0094] S400: Responds to the query request initiated by the user and sorts the multiple target points according to the distance between the coordinates of the multiple target points and the user's coordinates;
[0095] S401: According to the sorted order of multiple target points, obtain the first order of objects that meet the query request in multiple first sub-regions represented by multiple target points;
[0096] S402: Based on the user's coordinates and the coordinates of objects matching the query request within the screening area of the target area, sort the objects matching the query request to obtain the second sorted order;
[0097] The screening area within the target area is determined using the following method:
[0098] From multiple second sub-regions within the target region, determine the target second sub-region; wherein, the target second sub-region is the second sub-region where the user is located; the area of the second sub-region is smaller than the area of the first sub-region;
[0099] The target second sub-region, and multiple second sub-regions surrounding the target second sub-region, are designated as screening areas within the target region.
[0100] The multiple second sub-regions surrounding the target second sub-region can be the second sub-regions that surround the target second sub-region. If the second sub-region is a rectangle, then the eight rectangular second sub-regions surrounding the target second sub-region are the multiple second sub-regions surrounding the target second sub-region.
[0101] In detail, step 402 involves calculating the distance between the user and the objects within the screening area that meet the query requirements, and sorting them according to these distances to obtain a second order.
[0102] S403: Remove the target object from the first order;
[0103] The target object is the same as the object in the first order in the second order;
[0104] S404: Merge objects in the second order into the first order after removal, based on the distance between the coordinates of the objects in the first and second orders after removal and the user's coordinates;
[0105] For example, the distance between the object in the second order and the user is compared with the distance between multiple target points and the user in the first order, and the objects in the second order are merged into the first order after being removed, according to the distance from smallest to largest.
[0106] S405: Display first order.
[0107] Based on the above object recommendation methods, this application provides an application scenario, combining... Figure 5As shown, the target second sub-region is second sub-region e, and the multiple second sub-regions surrounding the target second sub-region are second sub-region a, second sub-region b, second sub-region c, second sub-region d, second sub-region f, second sub-region g, second sub-region h, and second sub-region i. The screening area is second sub-regions a to second sub-region i. The distances between the user and objects matching the user's request in second sub-regions a to i are calculated. Based on the distances from smallest to largest, a second order is obtained, for example, object aa, object ab, object ac, object ad, object ae, and object af. Then, objects aa, object ab, object ac, object ad, object ae, and object af are deleted from the first order. Finally, the distances from objects aa, object ab, object ac, object ad, object ae, and object af to the user, as well as the distances from the center points of first sub-regions A, B, C, and D to the user, are calculated in ascending order. The second order is then merged into the first order after deletion.
[0108] For example, if the distances from objects aa, ab, ac, ad, ae, and af to the user are all smaller than the distances from the center points of the first sub-region A, the first sub-region B, the first sub-region C, and the first sub-region D to the user, then the first order can be: objects aa, ab, ac, ad, ae, af, objects within the center point of the first sub-region A that meet the user's request (excluding the aforementioned objects), objects within the center point of the first sub-region C that meet the user's request (excluding the aforementioned objects), objects within the center point of the first sub-region B that meet the user's request (excluding the aforementioned objects), and objects within the center point of the first sub-region D that meet the user's request (excluding the aforementioned objects).
[0109] For example, before sorting multiple target points based on the distance between the coordinates of multiple target points and the user's coordinates, the method further includes:
[0110] Determine that the query requirements in the query request initiated by the user meet the preset requirements;
[0111] The preset requirements include:
[0112] In a user-initiated query request, the distance between the queried object and the user is greater than a preset kilometer; and / or
[0113] The total number of objects queried in the user's query request is greater than the preset number.
[0114] For example, when a user initiates a query request, the user will typically limit the distance of the query and / or the number of objects to be queried. For instance, the query distance is within 5 kilometers, and the number of objects to be queried is 10.
[0115] In detail, when responding to a user's query request, if the distance to the query exceeds 5 kilometers, it indicates that the user wants to query multiple objects. Calculating the distance to each object individually could consume significant computing resources. Therefore, when the user's query distance exceeds 5 kilometers, multiple target points can be sorted based on their distances to the user. The order of these target points determines the first order of objects within the first sub-regions representing the query, and these are then displayed. If the user's query distance is within 5 kilometers, the objects within that 5 kilometers can be sorted based on their distances to the user, and the sorted results are then displayed.
[0116] The same principle applies to the objects being queried. When responding to a user's query request, it is determined whether the number of objects queried by the user exceeds 10. If it does, the object recommendation method described in this application is followed, and the objects are displayed to the user in order. If the number does not exceed 10, the distance between each object matching the user's request and the user can be calculated, sorted, and the sorted results can be displayed.
[0117] In the actual calculation process, this application uses geohash technology. This application determines the coordinates of multiple target points in the following way:
[0118] Find the coordinates of the target points corresponding to multiple first sub-regions in the target region from the database; where each first sub-region of the target region in the database is represented by a geohash value.
[0119] In detail, this application divides the target area into multiple first sub-regions. Since the geographic coordinates of the target area are known, the geographic coordinates of the first sub-regions are also known. Geohash values are used to represent the geographic coordinates of the first sub-regions, and the coordinates of the target point are recorded. The target point is the center point within each first sub-region. The geographic coordinates are latitude and longitude.
[0120] The geohash value of each first sub-region in the target region is determined in the following way:
[0121] Specifically, the number of bits in the geohash value corresponding to the target region is determined based on the correspondence between the area size of the region and the number of bits in the geohash value.
[0122] Determine the geohash value of each first sub-region in the target region based on the number of bits in the geohash value corresponding to the target region.
[0123] For example, as shown in Table 1, the correspondence between the area size of the region and the number of bits in the geohash value is illustrated:
[0124] Table 1
[0125] Area size The number of bits in a Geohash value Less than 50 cubic meters 5 Greater than 50 cubic meters 3
[0126] In other words, when the target area is less than 50 cubic meters, a 5-digit geohash value can be used to represent the first sub-region within the target area.
[0127] If the target area is larger than 50 cubic meters, then a 3-digit geohash value can be used to represent the first sub-region within the target area. The smaller the number of digits in the geohash value, the larger the area it represents.
[0128] Once the number of bits in the geohash value corresponding to the target region is known, the geohash value of each first sub-region in the target region is determined based on the latitude and longitude of the target region.
[0129] The second sub-region described above is represented by a geohash value, and the number of bits in the geohash value of the second sub-region is determined by the area size of a preset region. This preset region is smaller than the target region, and is generally determined based on the distance range the user wants to query. For example, if the distance range most users query is within 5 kilometers, then a square area within that 5-kilometer range is used as the preset region. Then, based on the area size of the preset region, the geohash values of multiple second sub-regions of the target region are determined. These geohash values of the multiple second sub-regions of the target region are then stored in a database.
[0130] When determining the second order, the user's latitude and longitude are converted to a geohash value with the same number of bits as the geohash value of the second sub-region. Then, it is determined which second sub-region's geohash value the user's geohash value matches. The second sub-region with the same geohash value as the user's geohash value is designated as the target second sub-region. Next, the geohash values of the surrounding second sub-regions are found, and these second sub-regions, along with the target second sub-region, are designated as the screening areas within the target area. Then, based on the latitude and longitude of objects matching the user's request within the screening areas and the user's latitude and longitude, the distance between them is calculated. Based on these distances, the objects matching the user's request within the screening areas are sorted to obtain the second order.
[0131] After obtaining the first order of objects matching the query request within multiple first sub-regions represented by the multiple target points according to the sorted order, the method further includes:
[0132] Store in first order;
[0133] If a second identical query request is received from the same user within a preset time period after responding to a user's query request, it will be displayed in the first order again.
[0134] To improve response speed, this application adds a caching function. Specifically, after determining the first order, it is stored in the database. If, within a preset time after responding to a user's query request, a similar request is received from the user, the first order is retrieved from the database and displayed directly to the user. Alternatively, after the preset time has elapsed since responding to the user's query request, the first order can be deleted from the database to avoid excessive database usage.
[0135] Based on the technical features described above, this application provides an application. For example, targeting offline stores on an O2O platform, the number of digits in the geohash value of the second sub-region is determined based on the distance range queried by most users, and the number of digits in the geohash value of the first sub-region is determined based on the area of the target region. Then, the geographical locations of multiple second sub-regions of the target region are converted into geohash values, and the geographical locations of multiple first sub-regions of the target region are also converted into geohash values. The geohash values of the first sub-regions and the latitude and longitude of their center points are stored in a database, as are the geohash values of the second sub-regions. The correspondence between the latitude and longitude of stores within the first sub-region and their geohash values is also stored in the database, as is the correspondence between the latitude and longitude of stores within the second sub-region and their geohash values. Generally, the geohash value of the first sub-region is set to 3 digits, and the geohash value of the second sub-region is set to 5 digits.
[0136] If a store's location changes or a new store is added, determine which first and second sub-regions the store's latitude and longitude belong to, and then update the latitude and longitude of that first sub-region and the corresponding store. If a store is changed, check if the changed store still belongs to the original first sub-region. If so, directly modify the original latitude and longitude of the changed store corresponding to the original first sub-region to match the changed store's latitude and longitude. If the changed store does not belong to the original first sub-region, directly delete the original latitude and longitude of the changed store corresponding to the original first sub-region, and add the changed store's latitude and longitude to the new first sub-region to which the changed store belongs. The same process applies to the second sub-region.
[0137] If it's a newly added store, determine which first sub-region the new store belongs to, and add the store's latitude and longitude to the corresponding relationship for that first sub-region. Then determine which second sub-region the new store belongs to, and add its latitude and longitude to the corresponding relationship for that second sub-region.
[0138] Combination Figure 6 As shown, based on the above, this application provides a store recommendation method, including:
[0139] S600: Receives query requests initiated by users;
[0140] S601: Determine whether the store the user is querying is nearby or far away based on the query request initiated by the user;
[0141] In detail, if the distance between the store queried in the user's query request and the user is greater than the preset kilometers, the store queried by the user is determined to be far away; if the distance between the store queried in the user's query request and the user is less than or equal to the preset kilometers, the store queried by the user is determined to be near.
[0142] Alternatively, if the total number of stores queried in a user's query request is greater than a preset number, the user is determined to be querying a store that is far away; if the total number of stores queried in a user's query request is less than or equal to the preset number, the user is determined to be querying a store that is near.
[0143] Alternatively, if the distance between the user and the store in the query request is greater than a preset number of kilometers, and the total number of stores queried in the query request is greater than a preset number, then the store queried by the user is determined to be far away; if the distance between the user and the store in the query request is less than or equal to a preset number of kilometers, and the total number of stores queried in the query request is less than or equal to a preset number, then the store queried by the user is determined to be near.
[0144] S602: If the store queried by the user is nearby, the user's latitude and longitude will be converted to the user's geohash value with the same number of bits as the geohash value of the second sub-region;
[0145] S603: Find the target second sub-region in the target region whose geohash value is the same as the user's geohash value in the database, and use the target second sub-region and the 8 surrounding second sub-regions as the screening region.
[0146] S604: Based on the distance between the users and the stores that meet the user's request in the screening area, obtain the second order and display the second order to the user.
[0147] S605: If the store queried by the user is far away, then find the latitude and longitude of the center points of multiple first sub-regions in the target area from the database, calculate the distance between the latitude and longitude of the center points of multiple first sub-regions and the user's latitude and longitude, and obtain the order of multiple center points based on the distance of multiple first sub-regions;
[0148] S606: Based on the order of multiple center points, obtain the first order of stores that meet the user's request within the first sub-region corresponding to the multiple center points;
[0149] S607: Display the stores in the first order to the user based on the number of objects on each display page in the user's request and the number of pages being visited.
[0150] In the above embodiments, this application splits distance sorting into two scenarios: near distance sorting and far distance sorting. Near distance sorting uses a precise sorting scheme after filtering all stores with near distance GeoHash values, while far distance sorting uses far distance GeoHash values for coarse sorting. This ensures both user experience and system performance and resource consumption.
[0151] Among them, the near-distance sorting and far-distance sorting can select the corresponding number of bits in the GeoHash value, and the parameters can be dynamically adjusted to adapt to different needs.
[0152] The number of digits in the GeoHash value used for long-distance sorting is determined by the size of the target area to be queried. If the area is large, a GeoHash value with fewer digits can be selected; otherwise, a GeoHash value with more digits can be selected. This ensures that the amount of data to be calculated each time is not large and the system resources consumed are not high.
[0153] Based on the same inventive concept, embodiments of this application provide an object recommendation device, please refer to... Figure 7 The device includes:
[0154] The first sorting module 700 is used to respond to a query request initiated by a user and sort the multiple target points according to the distance between the coordinates of multiple target points and the coordinates of the user; wherein each target point corresponds to a first sub-region in the target region, and different target points correspond to different first sub-regions, and the target region is the region queried in the query request initiated by the user;
[0155] Display module 701 is used to obtain a first order of objects that meet the query request in a plurality of first sub-regions represented by the plurality of target points according to the sorted order of the plurality of target points, and to display the first order.
[0156] Optionally, the device further includes:
[0157] The second sorting module is used to sort the objects that meet the query request according to the user's coordinates and the coordinates of the objects that meet the query request in the screening area of the target area, so as to obtain a sorted second order;
[0158] The elimination module is used to eliminate target objects in the first order; wherein the target object is an object in the second order that is the same as the object in the first order;
[0159] The fusion module is used to merge objects in the second order into the first order after removal, based on the distance between the coordinates of objects in the first order after removal and the coordinates of the second order and the user's coordinates.
[0160] Optionally, the second sorting module is further configured to:
[0161] From a plurality of second sub-regions within the target region, a target second sub-region is determined; wherein, the target second sub-region is the second sub-region where the user is located; the area of the second sub-region is smaller than the area of the first sub-region;
[0162] The target second sub-region, and a plurality of second sub-regions surrounding the target second sub-region, are designated as screening regions within the target region.
[0163] Optionally, the device further includes:
[0164] The preprocessing module is used to determine whether the query requirements in the query request initiated by the user meet preset requirements;
[0165] The preset requirements include:
[0166] The distance between the object queried in the query request initiated by the user and the user is greater than a preset number of kilometers; and / or
[0167] The total number of objects queried in the query request initiated by the user is greater than a preset number.
[0168] Optionally, the first sorting module 700 is further configured to:
[0169] The coordinates of target points corresponding to multiple first sub-regions within the target region are retrieved from the database; wherein each first sub-region of the target region in the database is represented by a geohash value.
[0170] Optionally, the first sorting module 700 is further configured to:
[0171] The number of bits in the geohash value corresponding to the target region is determined based on the correspondence between the area size of the region and the number of bits in the geohash value.
[0172] The geohash value of each of the first sub-regions in the target region is determined according to the number of bits in the geohash value corresponding to the target region.
[0173] Optionally, the device further includes:
[0174] The post-processing module is used to store the first sequence;
[0175] If, within a preset time period following the response to the user's query request, another request identical to the query request is received from the user, the first sequence will be displayed again.
[0176] The object recommendation apparatus provided in this application embodiment can be used to execute the technical solution of the object recommendation method in the above embodiment. Its implementation principle and technical effect are similar, and will not be described again here.
[0177] It should be noted that the division of the various modules in the above device is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, these modules can be implemented entirely in software through processing element calls; they can be implemented entirely in hardware; or some modules can be implemented through processing element calls in software, while others are implemented in hardware. The processing element here can be an integrated circuit with signal processing capabilities. During implementation, each step of the above method or each of the above modules can be completed through the integrated logic circuits in the hardware of the processor element or through software instructions.
[0178] Based on the same inventive concept, this application provides an electronic device that can realize the function of the object recommendation device described above. Please refer to... Figure 8 The device includes a processor 801 and a memory 802.
[0179] Processor 801 executes computer execution instructions stored in memory, causing processor 801 to perform the scheme in the above embodiments. Processor 801 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0180] The memory 802 is connected to the processor 802 via the system bus and communicates with it. The memory 802 is used to store computer program instructions.
[0181] The system bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into address bus, data bus, control bus, etc. For ease of representation, only one thick line is used in the diagram, but this does not indicate that there is only one bus or one type of bus. Transceivers are used to enable communication between database access devices and other computers (e.g., clients, read-write libraries, and read-only libraries). Memory may include random access memory (RAM) and may also include non-volatile memory.
[0182] Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium. The computer program product includes computer program code, which, when executed on a computer, causes the computer to perform any of the object recommendation methods discussed above. Since the principle by which the above-described computer-readable storage medium solves the problem is similar to that of the object recommendation method, the implementation of the above-described computer-readable storage medium can be found in the implementation of the method; repeated details will not be elaborated further.
[0183] Based on the same inventive concept, this application also provides a computer program product, which includes computer program code that, when run on a computer, causes the computer to execute any of the object recommendation methods discussed above. Since the principle by which the above computer program product solves the problem is similar to that of the object recommendation method, the implementation of the above computer program product can be referred to the implementation of the method, and repeated details will not be elaborated further.
[0184] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0185] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0186] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0187] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of user-operated steps to be executed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0188] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. An object recommendation method, characterized in that, include: The target area is divided into multiple first sub-regions; geohash values are used to represent the geographic coordinates of the first sub-regions, and the coordinates of the target points are recorded; Each first sub-region of the target area, represented by a geohash value, is stored in the database. The correspondence between the latitude and longitude of objects within the first sub-region and the geohash value of the first sub-region is stored in the database. Specifically, when an object's location changes, if the changed object's location belongs to the original first sub-region, the location of the changed object in the original first sub-region is updated to the changed object's location. If the changed object's location does not belong to the original first sub-region, the changed object in the original first sub-region is deleted, and the location of the changed object is added to the correspondence of the new first sub-region to which the changed object belongs. When a new object is added, the location of the new object is directly added to the correspondence of the first sub-region to which the new object belongs. In response to a user's query request, if the distance between the queried store and the user in the user's query request is greater than a preset distance, or if the total number of stores queried in the user's query request is greater than a preset number, then the coordinates of target points corresponding to multiple first sub-regions in the target area are retrieved from the database; the multiple target points are sorted according to the distance between the coordinates of the multiple target points and the user's coordinates; wherein, each target point corresponds to a first sub-region in the target area, and different target points correspond to different first sub-regions, and the target area is the area queried in the user's query request; According to the sorted order of the multiple target points, a first order of objects that meet the query request within multiple first sub-regions represented by the multiple target points is obtained and displayed; wherein, the sorting of objects belonging to different first sub-regions in the first order is the same as the order of the multiple target points, and multiple objects in the same first sub-region are not sorted according to the order of the multiple target points; the objects that meet the query request within the first sub-region are found in the correspondence between the latitude and longitude of the objects in the first sub-region and the geohash value of the first sub-region in the database.
2. The object recommendation method as described in claim 1, characterized in that, Before displaying the first order, the method further includes: Based on the user's coordinates and the coordinates of objects matching the query request within the screening area of the target area, the objects matching the query request are sorted to obtain a second sorted order; Remove the target object from the first order; wherein the target object is the same as the object in the first order in the second order; Based on the distance between the coordinates of the objects in the first and second orders after removal and the user's coordinates, the objects in the second order are merged into the first order after removal.
3. The object recommendation method as described in claim 2, characterized in that, The screening area within the target area is determined using the following method: From a plurality of second sub-regions within the target region, a target second sub-region is determined; wherein, the target second sub-region is the second sub-region where the user is located; the area of the second sub-region is smaller than the area of the first sub-region; The target second sub-region, and a plurality of second sub-regions surrounding the target second sub-region, are designated as screening regions within the target region.
4. The object recommendation method as described in claim 1, characterized in that, The geohash value of each of the first sub-regions in the target region is determined in the following manner: The number of bits in the geohash value corresponding to the target region is determined based on the correspondence between the area size of the region and the number of bits in the geohash value. The geohash value of each of the first sub-regions in the target region is determined according to the number of bits in the geohash value corresponding to the target region.
5. The object recommendation method as described in any one of claims 1 to 4, characterized in that, After obtaining the first order of objects matching the query request within multiple first sub-regions represented by the multiple target points according to the sorted order of the multiple target points, the method further includes: Store the first order; If, within a preset time period following the response to the user's query request, another request identical to the query request is received from the user, the first sequence will be displayed again.
6. An object recommendation device, characterized in that, include: The first sorting module is used to divide the target area into multiple first sub-regions; the geohash value is used to represent the geographical coordinates of the first sub-region, and the coordinates of the target point are recorded; Each first sub-region of the target area, represented by a geohash value, is stored in the database. The mapping between the latitude and longitude of objects within each first sub-region and the geohash value of that first sub-region is also stored in the database. Specifically, when an object's location changes, if the new object's location belongs to the original first sub-region, the location of the changed object in the original first sub-region is updated to match the new object's location. If the new object's location does not belong to the original first sub-region, the object in the original first sub-region is deleted, and the new object's location is added to the mapping of the new first sub-region to which the new object belongs. When an object is added, the location of the new object is updated accordingly. The newly added object is directly added to the correspondence of the first sub-region to which it belongs; in response to a user's query request, if the distance between the queried store and the user in the user's query request is greater than a preset number of kilometers, or the total number of stores queried in the user's query request is greater than a preset number, then the coordinates of multiple target points corresponding to the first sub-regions in the target region are retrieved from the database; the multiple target points are sorted according to the distance between the coordinates of the multiple target points and the coordinates of the user; wherein, each target point corresponds to a first sub-region in the target region, and different target points correspond to different first sub-regions, and the target region is the region queried in the user's query request; The display module is used to obtain a first order of objects that meet the query request within multiple first sub-regions represented by the multiple target points according to the sorted order of the multiple target points, and to display the first order; wherein, the sorting of objects belonging to different first sub-regions in the first order is the same as the order of the multiple target points, and multiple objects in the same first sub-region are not sorted according to the order of the multiple target points; the objects that meet the query request within the first sub-region are found in the correspondence between the latitude and longitude of the objects in the first sub-region and the geohash value of the first sub-region in the database.
7. The object recommendation device as described in claim 6, characterized in that, The device further includes: The second sorting module is used to sort the objects that meet the query request according to the user's coordinates and the coordinates of the objects that meet the query request in the screening area of the target area, so as to obtain a sorted second order; The elimination module is used to eliminate target objects in the first order; wherein the target object is an object in the second order that is the same as the object in the first order; The fusion module is used to merge objects in the second order into the first order after removal, based on the distance between the coordinates of objects in the first order after removal and the coordinates of the second order and the user's coordinates.
8. The object recommendation device as described in claim 7, characterized in that, The second sorting module is also used for: From a plurality of second sub-regions within the target region, a target second sub-region is determined; wherein, the target second sub-region is the second sub-region where the user is located; the area of the second sub-region is smaller than the area of the first sub-region; The target second sub-region, and a plurality of second sub-regions surrounding the target second sub-region, are designated as screening regions within the target region.
9. The object recommendation device as described in claim 6, characterized in that, The first sorting module is further configured to: The number of bits in the geohash value corresponding to the target region is determined based on the correspondence between the area size of the region and the number of bits in the geohash value. The geohash value of each of the first sub-regions in the target region is determined according to the number of bits in the geohash value corresponding to the target region.
10. The object recommendation device according to any one of claims 6 to 9, characterized in that, The device further includes: The post-processing module is used to store the first sequence; If, within a preset time period following the response to the user's query request, another request identical to the query request is received from the user, the first sequence will be displayed again.
11. An electronic device, characterized in that, include: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the steps of the method according to any one of claims 1-5.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a computer, cause the computer to perform the method as described in any one of claims 1-5.
13. A computer program product, characterized in that, The computer program product includes: computer program code, which, when run on a computer, causes the computer to perform the method described in any one of claims 1-5.
Citation Information
Patent Citations
Room choosing method and device
CN105975627A
POI retrieving and ordering method, device and computer readable storage medium
CN108763522A