I have a search engine that, depending on what the users inputs, displays elements in an array in order of viewCount, uploadDate, and rating, but relevance is kicking my butt; I have no clue where to start.
我有一个搜索引擎,根据用户的输入,按照viewCount,uploadDate和rating的顺序显示数组中的元素,但相关性正在踢我的屁股;我不知道从哪里开始。
First, data is retrieved from multiple xml/json feeds.
首先,从多个xml / json提要中检索数据。
$url1 = "http://api.site1.com/?q=$userinput";
$url2 = "http://api.site2.com/?q=$userinput";
$url3 = "http://api.site3.com/?q=$userinput";
//get_and_decode is a function that gets and decodes data from the xml/json feed
get_and_decode($url1);
get_and_decode($url2);
get_and_decode($url3);
Second, all the data is stored in an array.
其次,所有数据都存储在一个数组中。
Finally, the elements in the array are displayed for the user and sorted by either view count, upload date, or rating.
最后,为用户显示数组中的元素,并按视图计数,上载日期或评级进行排序。
Can someone point me in the right direction? I am trying to learn how to calculate relevance.
有人能指出我正确的方向吗?我正在努力学习如何计算相关性。
1 个解决方案
#1
2
Your problem is not related to a specific programming language, but more precisely of the algorithm used. First, try to determine a good algorithm to express relevance as a number. For example, you can try to start from ranking or relevancy.
您的问题与特定的编程语言无关,但更准确地说与所使用的算法无关。首先,尝试确定一个好的算法来表示作为数字的相关性。例如,您可以尝试从排名或相关性开始。
#1
2
Your problem is not related to a specific programming language, but more precisely of the algorithm used. First, try to determine a good algorithm to express relevance as a number. For example, you can try to start from ranking or relevancy.
您的问题与特定的编程语言无关,但更准确地说与所使用的算法无关。首先,尝试确定一个好的算法来表示作为数字的相关性。例如,您可以尝试从排名或相关性开始。