Page 1 of 1

Combine RSS Feeds by Relevance

Posted: Mon Jun 16, 2008 7:15 am
by ojsimon
Hi
does anyone know how to combine several rss feeds and sort by relevance to a few specified keywords?

Thanks

Re: Combine RSS Feeds by Relevance

Posted: Mon Jun 16, 2008 8:11 am
by onion2k
Need more information. How are you defining relevance?

Re: Combine RSS Feeds by Relevance

Posted: Mon Jun 16, 2008 8:26 am
by Ambush Commander
If you need to combine RSS feeds, use DOMDocument->importNode. As for sorting, generating a numeric relevance key for each entry and then sorting a PHP array with that should yield the best results.

Re: Combine RSS Feeds by Relevance

Posted: Mon Jun 16, 2008 8:47 am
by ojsimon
How could you do the sort, once you have the rss feeds into an array, how can you sort them with the method you described?

Thanks

Re: Combine RSS Feeds by Relevance

Posted: Mon Jun 16, 2008 8:50 am
by Ambush Commander
array_multisort with a temporary array of relevances.

Re: Combine RSS Feeds by Relevance

Posted: Mon Jun 16, 2008 9:11 am
by ojsimon
Ok i have no idea how to do this could you explain in slightly more detail?
Thanks

Re: Combine RSS Feeds by Relevance

Posted: Mon Jun 16, 2008 9:13 am
by Ambush Commander
Iterate through each of the RSS items via DOM and assign each a numeric relevance to each of them in an associative array, looking like array($item_id => $relevance, ...). Then, asort this array. Finally, create a new DOM object, and iterate through the sorted array add the old RSS items to it.

Re: Combine RSS Feeds by Relevance

Posted: Mon Jun 16, 2008 9:23 am
by ojsimon
Still have no idea how to do this, but thanks for your help i will have a look through the internet, i might have to higher a freelancer to do this, how much do u think this should cost?

Thanks for your help

Re: Combine RSS Feeds by Relevance

Posted: Mon Jun 16, 2008 9:33 am
by Ambush Commander
Not a php coder, are you?