API_PHP Posted July 8, 2013 Share Posted July 8, 2013 I have 3 arrays, each containing a dynamically generated list of documents. (The list changes depending on what the user searches for) $list1['documentname'] $list2['documentname'] $list3['documentname'] Each array is multidimensional and contains other information such as description. $list1 = array('documentname','description') For example if I wanted to output the sixth document`s name and description I would write: echo $list1[5]['documentname'].$newline.$list1[5]['description']; A particular document may be contained in all three lists or none of the lists. What I am trying to do is rank the documents by the documents total score using the following formula: $document_Score = (1/(60+rank_list1)) + (1/(60+rank_list2)) + (1/(60+rank_list3)) I am trying to think of a way of doing this but I am getting nowhere. If document a is ranked 1 in list1, 2 in list2, and 4 in list3, how do I apply the following formula and add the scores together. $document_Score = (1/(60+1)) + (1/(60+2)) + (1/(60+4)) //score for document a I know that I need to apply code based on whether $list1['documentname'] is equal to $list2['documentname'] etc but I have no idea how to implement this. Any tips or ideas would be appreciated. Any ideas? Thanks. Link to comment https://forums.phpfreaks.com/topic/279964-aggregating-document-list-by-score/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.