View Single Post
Old 08-03-2005, 07:49 PM   #12
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Okay, the issue is that (a) the site_id column of the sites table contains IDs that are not in the site_id column of the spider table, (b) the site_id column of the spider table contains IDs that are not in the site_id column of the sites table, or (c) a combination of (a) and (b) so what I did was change the following query:
Code:
           $query = "SELECT spider.spider_id,sum(weight) as weight, spider.site_id
           FROM ".PHPDIG_DB_PREFIX."keywords as k,".PHPDIG_DB_PREFIX."engine as engine, ".PHPDIG_DB_PREFIX."spider as spider
           WHERE engine.key_id = k.key_id
           ".$kconds[$n]."
           AND engine.spider_id = spider.spider_id $wheresite $wherepath
           GROUP BY spider.spider_id,spider.site_id ";
To the following query in search_function.php:
Code:
           $query = "SELECT spider.spider_id,sum(weight) as weight, spider.site_id
           FROM ".PHPDIG_DB_PREFIX."keywords as k,".PHPDIG_DB_PREFIX."engine as engine, ".PHPDIG_DB_PREFIX."spider as spider,
		".PHPDIG_DB_PREFIX."sites as sites
           WHERE engine.key_id = k.key_id
           ".$kconds[$n]."
		AND sites.site_id = spider.site_id
           AND engine.spider_id = spider.spider_id $wheresite $wherepath
           GROUP BY spider.spider_id,spider.site_id ";
This seems to rid the search results of blanks, but you might want to look at the sites and spider tables to see what IDs are in one table but not the other table. I'm not sure why these tables got out of sync, maybe a dropped database connection, maybe a misdelete, who knows, haven't ever had it happen to me, but now that I know what is out of sync, I might add a new clean routine to a later release to take care of it more thoroughly.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote