Detailed Description
In order to provide an implementation scheme for reducing the consumption of processing resources on the social network side and reducing the consumption of network bandwidth resources when searching for a social object, the embodiments of the present invention provide a method and an apparatus for searching for a social object, and the following description is made in conjunction with the accompanying drawings of the specification for describing preferred embodiments of the present invention. And the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
An embodiment of the present invention provides a social object search method, as shown in fig. 1, including:
step 101, searching the social objects according to the search conditions to obtain each social object matched with the search conditions.
And 102, sequentially taking each social object in the social objects as a current social object, and acquiring a social object concerned by the current social object and a social object concerned by the current social object.
And 103, determining the weight index value of each social object according to the social objects respectively concerned by each social object and the social objects respectively concerned by each social object.
Andstep 104, returning each social object according to the sequence of the weight index values from high to low.
The specific way of determining the weight index value of each social object instep 103 may be as follows:
before determining the weight index value of each social object, sequentially taking each social object in each social object as a current social object, and determining the number of the social objects concerned by the current social object and the number of the social objects concerned by the current social object;
then, according to the number of the social objects respectively concerned by each social object and the number of the social objects respectively concerned by each social object, determining the weight index value of each social object.
For convenience and understanding, the number of social objects to which a social object pays attention may be referred to as the number of the social objects to which the social object pays attention, and the number of social objects to which a social object pays attention may be referred to as the number of the social objects to which the social object pays attention, that is, the weight index value of each social object is determined according to the number of the social objects to which the social object pays attention and the number of the social objects to which the social object pays attention.
For example, specifically, the larger the number of the concerned social objects is, the larger the weight index value of the social objects is, the larger the number of the concerned social objects is, and the larger the weight index value of the social objects is, such as performing weighted summation based on the number of the concerned social objects and the number of the concerned social objects to obtain the weight index value;
the weight index value may be determined according to the number of the concerned social objects, and the larger the number of the concerned social objects is, the larger the weight index value of the social objects is, and if the number of the concerned social objects is the same, the weight index value may be adjusted according to the number of the concerned social objects, and the larger the number of the concerned social objects is, the larger the weight index value of the social objects is.
In addition to the above specific manner of thestep 103, other manners may be adopted in the embodiments of the present invention, and the method and the apparatus provided by the present invention are described in detail with reference to the specific embodiments below.
Example 1:
fig. 2 is a flowchart of a social object searching method provided in embodiment 1 of the present invention, which specifically includes the following processing steps:
step 201, a user sends a social object search request to a network server of a social network through a client, wherein the social object search request carries search conditions.
Step 202, after receiving the social object search request, the network server of the social network searches the social object according to the carried search condition to obtain each social object matched with the search condition.
The specific way of searching for the social object according to the search condition may be various ways in the prior art.
In this step, an object tag matched with the search condition may be specifically determined, and each social object labeled with the object tag is used as a search result;
the social objects noted with the object tags and concerned by the social objects can be further used as search results;
still further, when the number of the social objects included in the search result is large, in order to reduce the calculation amount in the subsequent ranking of the social objects, a part of the social objects may be excluded from the search result, and the excluded social objects may be social objects for which the number of the social objects concerning the social objects does not reach a preset number threshold.
Step 203, sequentially taking each social object in the social objects in the search result as a current social object, obtaining a social object concerned by the current social object and a social object concerned by the current social object, that is, obtaining the social object concerned by each social object in the social objects and the social object concerned by each social object.
For the convenience of obtaining, the social objects concerned by each social object and the social objects concerned by each social object may be stored in advance for each social object in the social network in the following manner 1:
TABLE 1
| Social objects | Number of concerns | Social objects of interest | Social objects of interest | ... | Social objects of interest |
| U1 | S1 | U(1,1) | U(1,2) | ... | U(1,S1) |
| U2 | S2 | U(2,1) | U(2,2) | ... | U(2,S2) |
| ... | ... | ... | ... | ... | ... |
| UN-1 | SN-1 | U(N-1,1) | U(N-1,2) | ... | U(N-1,SN-1) |
| UN | SN | U(N,1) | U(N,2) | ... | U(N,SN) |
In Table 1 above, N is the number of social objects in the search results, UiAs the ith social object, SiThe number of social objects of interest for the ith social object, and U (i, j) is S of interest for the ith social objectiA jth social object of the social objects.
While storing Table 1, U1-UNThe social contact information can be respectively integers from 0 to N and respectively corresponds to the IDs of N social contact objects, so that the attention information of one social contact object can be found within O (1) complexity; moreover, the table 1 can be loaded into a server with a large memory, so that the efficiency of acquiring information from the table 1 is improved.
Step 204, sequentially determining the weight index value of each social object in the search result according to the following formula:
pr (i) a weight index value of the ith social object in the social objects determined in this iteration, N is the number of the social objects, in (i) a set of the social objects focusing on the ith social object, out (j) a set of the social objects focusing on the jth social object, | out (j) the number of the social objects focusing on the jth social object, | pr (j) a weight index value of the jth social object determined in the last iteration, and pr (j) a preset initial weight index value of the jth social object when the first iteration is determined, where the preset initial weight index values of the social objects are equal, for example, may be 1, d is a preset attention transition probability representing a probability that after one social object is focused on, a social object is continuously selected for focusing on from the social objects focusing on the jth social object, the specific value can be flexibly set according to actual needs, and can be set to 0.85, for example.
And step 205, judging whether the end condition of the iteration determination is met, if so, enteringstep 206, and if not, enteringstep 204 for next iteration determination.
Specifically, the end condition of iteration determination may be that the number M of times determined by the current iteration reaches a preset fixed value;
the iteration-determined end condition may also satisfy the following relation for the number M of times of the current iteration:
or,
wherein, PR (i)M-1Weight metric value of ith social object determined for M-1 iteration, PR (i)MWeight index value, PR, of the ith social object determined for the Mth iterationCIs a preset weight difference threshold.
And step 206, sequencing the social objects included in the search result according to the sequence of the weight index values determined by the last iteration from high to low, and returning the social objects to the client according to the sequence of the sequencing so as to display the social objects on the client according to the sequence of the weight index values from high to low.
By adopting the method provided by the embodiment 1 of the present invention, since the determined weight index value represents the importance degree of the social objects, the social objects are returned according to the order of the weight index value from high to low, so that the user can find the social objects desired to be searched by the user through fewer click views, thereby reducing the click view operation of the user on each social object included in the search result, further reducing the consumption of the processing resources on the social network side, and reducing the consumption of the network bandwidth resources.
Example 2:
in practical application of a social network, when searching for a social object, it is often necessary to search for the social object with respect to a certain object tag, for example, search for the social object with respect to a certain topic tag, and at this time, the search result may include not only the social object labeled with the object tag but also a social object not labeled with the object tag, in embodiment 2 of the present invention, that is, when searching for the social object with respect to a certain object tag, a method for how to order the social objects in the search result according to importance levels is described in detail, as shown in fig. 3, which specifically includes the following processing steps:
step 301, a user sends a social object search request to a network server of a social network through a client, where the social object search request carries search conditions.
Step 302, after receiving the social object search request, the network server of the social network searches the social object according to the carried search condition to obtain each social object matched with the search condition.
The specific way of searching for the social object according to the search condition may be various ways in the prior art.
In this step, an object tag matched with the search condition may be specifically determined, and each social object labeled with the object tag is used as a search result;
the social objects noted with the object tags and concerned by the social objects can be further used as search results;
still further, when the number of the social objects included in the search result is large, in order to reduce the calculation amount in the subsequent ranking of the social objects, a part of the social objects may be excluded from the search result, and the excluded social objects may be social objects for which the number of the social objects concerning the social objects does not reach a preset number threshold.
Step 303, determining an object tag matched with the search condition, where the object tag may be an interest tag or a topic tag.
When the object tags matching the search condition have been determined in theabove step 302, this step is omitted.
Step 304, determining whether each social object included in the search result is marked with the object tag matched with the search condition.
And 305, taking each social object in the social objects in the search result as a current social object, acquiring a social object concerned by the current social object and a social object concerned by the current social object, namely acquiring the social object concerned by each social object in the social objects and the social object concerned by each social object.
For the convenience of obtaining, the social objects concerned by each social object in the social network and the social objects concerned by each social object may be stored in advance in the following manner as shown in table 2:
TABLE 2
| Social objects | Number of concerns | Social objects of interest | Social objects of interest | ... | Social objects of interest |
| U1 | S1 | U(1,1) | U(1,2) | ... | U(1,S1) |
| U2 | S2 | U(2,1) | U(2,2) | ... | U(2,S2) |
| ... | ... | ... | ... | ... | ... |
| UN-1 | SN-1 | U(N-1,1) | U(N-1,2) | ... | U(N-1,SN-1) |
| UN | SN | U(N,1) | U(N,2) | ... | U(N,SN) |
In Table 2 above, N is the number of social objects in the search results, UiAs the ith social object, SiThe number of social objects of interest for the ith social object, and U (i, j) is S of interest for the ith social objectiA jth social object of the social objects.
While storing Table 2, U1-UNThe social contact information can be respectively integers from 0 to N and respectively corresponds to the IDs of N social contact objects, so that the attention information of one social contact object can be found within O (1) complexity; moreover, the table 2 can be loaded into a server with a large memory, so that the efficiency of acquiring information from the table 2 is improved.
There is no strict sequence between thisstep 305 and theabove steps 303 and 304.
Step 306, this step can be performed in two ways:
the first mode is as follows: sequentially determining the weight index value of each social object in the search result aiming at the object label according to the following formula:
PR (i) is the weight index value of the ith social object in the social objects determined by the iteration, and r is the weight index value of the ith social object when the ith social object is marked with the object labeliIs 1, when the ith social object is not labeled with the object label ri0, in (i) is a set of social objects paying attention to the ith social object, out (j) is a set of social objects paying attention to the jth social object, | out (j) is the number of social objects paying attention to the jth social object, pr (j) is a weight index value of the jth social object determined in the last iteration, and pr (j) is a preset initial weight index value of the jth social object determined in the first iteration, the initial weight index value of the social object marked with the object tag in each social object is a preset first initial weight index value, the initial weight index value of the social object not marked with the object tag in each social object is a preset second initial weight index value, and the first initial weight index value is larger than the jth initial weight index valueThe two initial weight index values, for example, the first initial weight index value is 1, the second initial weight index value is 0, and d is a preset attention transition probability, which represents a probability that, after a social object is concerned, a social object is continuously selected from the social objects concerned by the concerned social object for attention, and a specific value may be flexibly set according to actual needs, for example, may be set to 0.85.
The second mode is as follows: sequentially determining the weight index value of each social object in the search result aiming at the object label according to the following formula:
pr (i) is a weight index value of the ith social object in the social objects determined in this iteration, in (i) is a set of social objects focusing on the ith social object, out (j) is a set of social objects focusing on the jth social object, | out (j) | is the number of social objects focusing on the jth social object, pr (j) is a weight index value of the jth social object determined in the last iteration, and pr (j) is a preset initial weight index value of the jth social object in the first iteration, the initial weight index value of the social object marked with the object tag in each social object is a preset first initial weight index value, and the initial weight index value of the social object not marked with the object tag in each social object is a preset second initial weight index value, and the first initial weight index value is greater than the second initial weight index value, for example, the first initial weight index value is 1, the second initial weight index value is 0, d is a preset attention transition probability, which represents a probability that, after a social object is concerned, a social object is continuously selected from the social objects concerned by the concerned social object for attention, and a specific numerical value may be flexibly set according to actual needs, for example, may be set to 0.85.
This step is described below by way of example using the second approach described above:
assuming that the search result includes 5 social objects, U1, U2, U3, U4, and U5, respectively, and U1, U3, and U5 are labeled with an object tag T matching the search condition, U2 and U4 are not labeled with the object tag T, the first initial weight index value is 1, the second initial weight index value is 0, and the cases of the social objects of interest to each of U1, U2, U3, U4, and U5 are as shown in table 3:
TABLE 3
| Social objects | Number of concerns | Concerned social pairsElephant | Social objects of interest | Social objects of interest |
| U1 | 3 | U2 | U3 | U4 |
| U2 | 2 | U3 | U4 | |
| U3 | 2 | U1 | U2 | |
| U4 | 1 | U3 | | |
| U5 | 2 | U2 | U3 | |
Taking the first iteration determination as an example, the determination process of the weight index value of each social object for the object tag T is as follows:
and 307, judging whether the end condition of the iteration determination is met, if so, entering astep 308, and if not, entering astep 306 for next iteration determination.
Specifically, the end condition of iteration determination may be that the number M of times determined by the current iteration reaches a preset fixed value;
the iteration-determined end condition may also satisfy the following relation for the number M of times of the current iteration:
or,
wherein, PR (i)M-1Weight metric value of ith social object determined for M-1 iteration, PR (i)MWeight index value, PR, of the ith social object determined for the Mth iterationCIs a preset weight difference threshold.
And 308, sequencing the social objects included in the search result according to the sequence of the weight index values determined by the last iteration from high to low, and returning the social objects to the client according to the sequence of the sequencing so as to display the social objects on the client according to the sequence of the weight index values from high to low.
By adopting the method provided by the embodiment 2 of the present invention, since the determined weight index value represents the importance degree of the social objects, the social objects are returned according to the order of the weight index value from high to low, so that the user can find the social objects desired to be searched by the user through fewer click views, thereby reducing the click view operation of the user on each social object included in the search result, further reducing the consumption of the processing resources on the social network side, and reducing the consumption of the network bandwidth resources.
Moreover, for a certain object tag, the social objects included in the search result can be reasonably sorted according to the order of importance from high to low, that is, the user can further find the social object desired to be searched by the user.
Further, in embodiment 2 of the present invention, when it is determined that there are a plurality of object tags matching the search condition, according to theabove step 306 and step 307, a weight index value of each social object may be determined for each object tag in the plurality of object tags, and based on the tag weight values of the plurality of object tags, the weight index values of each social object for the plurality of object tags may be weighted and summed to obtain a final weight index value of the social object, which may specifically be as follows:
wherein score (i) is the final weight index value of the ith social object in the search result, P is the number of tags of the plurality of objects, WjThe weight value of the jth object label in the plurality of object labels can be flexibly set according to actual needs, PR (i)jThe weight index value of the ith social object aiming at the jth object label is obtained.
Accordingly, instep 308, the social objects included in the search result may be specifically sorted according to the determined final weight index value from high to low, and the social objects are returned to the client according to the sorted order, so that the social objects are displayed on the client according to the weight index value from high to low.
Therefore, the social objects included in the search result can be reasonably sorted according to the order of importance from high to low aiming at the plurality of object tags, namely, the social objects which the user desires to search for can be further conveniently found by the user.
In the embodiment of the present invention, when determining the weight index value of the social object, the determination may be performed by a processing system as shown in fig. 4.
The processing system shown in fig. 4 includes a controller and a plurality of processing servers, the controller distributes tasks to be performed to each processing server, each task may include a sub-task for determining a weight index value for a plurality of sets of social objects, and each task may also include a sub-task for determining a weight index value for a social object for a plurality of object tags, and the controller may also distribute the table 2 to each processing server, so that each processing server can quickly find data required for determining a weight index value for a social object.
Each processing server may start multiple threads to process tasks, for example, k threads are started, where k may be the number of CPUs of the processing server, so as to optimize the performance of the processing server. The processing strategy is adopted because the storage of the table 2 needs to occupy a large amount of space, and the table 2 is read-only, so that a plurality of threads of each processing server can share the same table 2.
Each thread of each processing server can request the controller for the tasks to be executed, the obtained tasks are recorded, and after the task processing is finished, the processing results are reported to the controller.
Example 3:
based on the same inventive concept, according to the social object searching method provided in the foregoing embodiment of the present invention, correspondingly, embodiment 3 of the present invention further provides a social object searching apparatus, which is equivalent to the foregoing network server, and may also be integrated in the foregoing network server, and a schematic structural diagram of the social object searching apparatus is shown in fig. 5, and specifically includes:
the searchingunit 501 is configured to search the social objects according to the search condition to obtain each social object matched with the search condition;
an obtainingunit 502, configured to take each social object in the social objects as a current social object in sequence, obtain a social object that is concerned by the current social object, and a social object that is concerned by the current social object;
aweight determining unit 503, configured to determine a weight index value of each social object according to the social objects that the social objects respectively concern, and the social objects that the social objects respectively concern;
and thesorting unit 504 is configured to return the social objects in an order from high to low of the weight index value.
Further, the obtainingunit 502 is further configured to take each social object in the social objects as a current social object in sequence, determine the number of social objects that are concerned by the current social object, and determine the number of social objects that are concerned by the current social object;
theweight determining unit 503 is specifically configured to determine the weight index value of each social object according to the number of the social objects that are respectively concerned by each social object and the number of the social objects that are respectively concerned by each social object.
Further, theweight determining unit 503 is specifically configured to sequentially determine the weight index values of the social objects according to the following formula, and iteratively determine M times:
pr (i) a weight index value of the ith social object in the social objects determined by the current iteration, N is the number of the social objects, in (i) a set of social objects concerning the ith social object, out (j) a set of social objects concerning the jth social object, | out (j) the number of social objects concerning the jth social object, | pr (j) a weight index value of the jth social object determined by the previous iteration, and pr (j) a preset initial weight index value of the jth social object when the first iteration is determined, wherein the preset initial weight index values of the social objects are equal, and d is a preset attention transition probability;
and taking the result of the M times of iterative determination as the final weight index value of each social object.
Further, the above search device further includes:
atag determination unit 505, configured to determine an object tag matching the search condition; determining whether each social object is labeled with the object tag;
theweight determining unit 503 is specifically configured to sequentially determine the weight index values of the social objects for the object tags according to the following formula, and iteratively determine M times:
PR (i) is the weight index value of the ith social object in the social objects determined by the iteration, and r is the weight index value when the ith social object is marked with the object tagiIs 1, r when the ith social object is not labeled with the object tagi0, in (i) is a set of social objects concerned with the ith social object, out (j) is a set of social objects concerned with the jth social object, | out (j) is the number of social objects concerned with the jth social object, pr (j) is a weight index value of the jth social object determined in the last iteration, and p is determined in the first iterationr (j) is a preset initial weight index value of a jth social object, the initial weight index value of the social object marked with the object tag in each social object is a preset first initial weight index value, the initial weight index value of the social object not marked with the object tag in each social object is a preset second initial weight index value, the first initial weight index value is greater than the second initial weight index value, and d is a preset attention transition probability;
and determining the result of M times of iteration as a weight index value of each social object aiming at the object label.
Further, the above search apparatus further includes:
atag determination unit 505, configured to determine an object tag matching the search condition; determining whether each social object is labeled with the object tag;
theweight determining unit 503 is specifically configured to sequentially determine the weight index values of the social objects for the object tags according to the following formula, and iteratively determine M times:
wherein pr (i) is a weight index value of an i-th social object in the social objects determined in the current iteration, in (i) is a set of social objects focusing on the i-th social object, out (j) is a set of social objects focusing on a j-th social object, out (j) is the number of social objects focusing on the j-th social object, pr (j) is a weight index value of a j-th social object determined in the last iteration, and pr (j) is a preset initial weight index value of the j-th social object in the first iteration, the initial weight index value of the social object marked with the object tag in each social object is a preset first initial weight index value, the initial weight index value of the social object not marked with the object tag in each social object is a preset second initial weight index value, and the first initial weight index value is greater than the second initial weight index value, d is a preset attention transfer probability;
and determining the result of M times of iteration as a weight index value of each social object aiming at the object label.
Further, the number M of times of iterative determination when theweight determination unit 503 performs iterative determination is a preset fixed value; or
M satisfies the following relation:
or,
wherein, PR (i)M-1Weight metric value of ith social object determined for M-1 iteration, PR (i)MWeight index value, PR, of the ith social object determined for the Mth iterationCIs a preset weight difference threshold.
The functions of the above units may correspond to the corresponding processing steps in the flows shown in fig. 1 to fig. 3, and are not described herein again.
In summary, the solution provided by the embodiment of the present invention includes: searching the social objects according to the searching conditions to obtain all the social objects matched with the searching conditions; sequentially taking each social contact object in the social contact objects as a current social contact object, acquiring a social contact object concerned by the current social contact object and a social contact object concerned by the current social contact object; determining the weight index value of each social object according to the social objects respectively concerned by each social object and the social objects respectively concerned by each social object; and returning each social object according to the sequence of the weight index values from high to low. By adopting the scheme provided by the embodiment of the invention, the consumption of processing resources at the side of the social network is reduced when the social objects are searched, and the consumption of network bandwidth resources is reduced.
The search device provided by the embodiment of the application can be realized by a computer program. It should be understood by those skilled in the art that the above-mentioned division of the module is only one of many divisions of the module, and if the division into other modules or no division into modules is performed, it is within the scope of the present application as long as the searching apparatus has the above-mentioned functions.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may 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, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.