Combine RSS Feeds by Relevance

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ojsimon
Forum Newbie
Posts: 24
Joined: Sat Mar 31, 2007 5:01 am

Combine RSS Feeds by Relevance

Post by ojsimon »

Hi
does anyone know how to combine several rss feeds and sort by relevance to a few specified keywords?

Thanks
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Combine RSS Feeds by Relevance

Post by onion2k »

Need more information. How are you defining relevance?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Re: Combine RSS Feeds by Relevance

Post 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.
ojsimon
Forum Newbie
Posts: 24
Joined: Sat Mar 31, 2007 5:01 am

Re: Combine RSS Feeds by Relevance

Post 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
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Re: Combine RSS Feeds by Relevance

Post by Ambush Commander »

array_multisort with a temporary array of relevances.
ojsimon
Forum Newbie
Posts: 24
Joined: Sat Mar 31, 2007 5:01 am

Re: Combine RSS Feeds by Relevance

Post by ojsimon »

Ok i have no idea how to do this could you explain in slightly more detail?
Thanks
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Re: Combine RSS Feeds by Relevance

Post 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.
ojsimon
Forum Newbie
Posts: 24
Joined: Sat Mar 31, 2007 5:01 am

Re: Combine RSS Feeds by Relevance

Post 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
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Re: Combine RSS Feeds by Relevance

Post by Ambush Commander »

Not a php coder, are you?
Post Reply