Tuesday, August 18, 2009 at 7:31 PM.

newsRiverSuite.eliminateDuplicates

on eliminateDuplicates (adritem, adrtable) {
	<<Changes
		<<8/26/06; 3:40:01 PM by DW
			<<Created. Implements the Eliminate Duplicate Stories option. 
			<<Return true if you can skip this item (ie, don't include it in the output stream), false otherwise.
			<<An interesting story here...
				<<You might think that a guid or a permalink would be the same even if the story appeared in different departments, but apparently not.
				<<What to do? Well, headline writers tend to be creative, but they don't come up with different headlines when a story appears in more than one feed, so I tried using that as the guid, it worked. 
				<<Now if two headline writers for different pubs use exactly the same headline, we'll have a problem...
				<<8/23/06; 6:34:45 AM by DW
	local (guid = "");
	if defined (adritem^.data.title) {
		guid = adritem^.data.title}
	else {
		if defined (adritem^.permalink) {
			guid = adritem^.permalink}
		else {
			if defined (adritem^.guid) {
				guid = adritem^.guid}}};
	if sizeof (guid) > 0 {
		local (adr = @adrtable^.[guid]);
		if defined (adr^) { //it's a duplicate
			adr^++;
			return (true)};
		adr^ = 1};
	return (false)} //don't skip



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.