PhpDig.net

Go Back   PhpDig.net > PhpDig Forums > Troubleshooting

Reply
 
Thread Tools
Old 07-19-2005, 05:53 PM   #1
Dave A
Purple Mole
 
Dave A's Avatar
 
Join Date: Aug 2004
Location: North Island New Zealand
Posts: 170
Slight problem with results.

Hi Charter & Everyone,
I am having a problem with the results that are displayed, when a search is carried out some results come back blank:
I have checked to see if any files in the DB are of zero file length, and have run the PHP Admin cleaner a few times but I can't seem to get rid of these blank results coming through.
Any ideas my friend?

1. [100.00 %]
limit to

2. [95.26 %]
limit to

3. [43.03 %]
limit to

4. [40.82 %]
limit to

5. [40.82 %]
limit to
Dave A is offline   Reply With Quote
Old 07-23-2005, 12:32 PM   #2
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Does this happen when you do an exact search?
__________________
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
Old 07-23-2005, 03:37 PM   #3
Dave A
Purple Mole
 
Dave A's Avatar
 
Join Date: Aug 2004
Location: North Island New Zealand
Posts: 170
Hi Charter, yes even an exact search produces a few 100% results with no text or domain details in the results.
And or searches produce even more of those empty results..
Dave A is offline   Reply With Quote
Old 07-23-2005, 05:34 PM   #4
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Something got out of sync. Maybe info was deleted from the database directly instead of from the admin panel?

Try the following. First create the following table in the same database as the PhpDig tables:
Code:
CREATE TABLE blanks (
	blank TEXT DEFAULT '' NOT NULL
);
Then in search_function.php find:
Code:
             $query = "SELECT sites.site_url, sites.port, spider.path,spider.file,spider.first_words,sites.site_id,spider.spider_id,spider.last_modified,spider.md5 "
                      ."FROM ".PHPDIG_DB_PREFIX."spider AS spider, ".PHPDIG_DB_PREFIX."sites AS sites "
                      ."WHERE spider.spider_id=$spider_id AND sites.site_id = spider.site_id";
             $result = mysql_query($query,$id_connect);
             $content = mysql_fetch_array($result,MYSQL_ASSOC);
And afterwards add the following:
Code:
             if (empty($content['site_url'])) {
                      $blank = addslashes(serialize($content));
                      mysql_query("INSERT INTO blanks (blank) VALUES ('$blank')",$id_connect);
             }
Now do some searches, and then attach to this thread about ten rows from the blanks table so I can have a look-see.
__________________
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
Old 08-02-2005, 10:19 PM   #5
Dave A
Purple Mole
 
Dave A's Avatar
 
Join Date: Aug 2004
Location: North Island New Zealand
Posts: 170
Huston we have a problem?

Hi Charter, I have made the table in the database, copied the code over to the searchfunction.php file

When I do a few searches the results still show blank results but the table in the database would appear to be empty when I go there and look using phpmyadmin
So I am not really sure what is happening the blanks table remains empty?

I would appreciate your help if possible with this.

Heaps of regards
Dave A
Dave A is offline   Reply With Quote
Old 08-03-2005, 08:30 AM   #6
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Okay, now try the following...

First create the following table in the same database as the PhpDig tables:
Code:
CREATE TABLE blanks2 (
	blank TEXT DEFAULT '' NOT NULL
);
Then in search_function.php find:
Code:
    $timer->stop('reorder results');
And beforehand add the following:
Code:
	if (is_array($final_result) && count($final_result) > 0) {
		arsort($final_result);
		reset($final_result);
		while (list($spider_id,$weight) = each($final_result)) {
			$content_file = $relative_script_path.'/'.TEXT_CONTENT_PATH.$spider_id.'.txt';
			if (!is_file($content_file)) {
				mysql_query("INSERT INTO blanks2 (blank) VALUES ($spider_id)",$id_connect);
				if (isset($final_result[$spider_id])) { unset($final_result[$spider_id]); }
			}
		}
	}
Again do some searches, and then attach to this thread about ten rows from the blanks2 table so I can have a look-see. Note that searches might take longer.

Also note that this may seem like it removes the blanks, but it's a temporary thing. I'll need to see if any rows get inserted into blanks2 to put things back in sync.
__________________
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
Old 08-03-2005, 06:24 PM   #7
Dave A
Purple Mole
 
Dave A's Avatar
 
Join Date: Aug 2004
Location: North Island New Zealand
Posts: 170
Answers to post

Hi Charter,
I have added the blank2 table and copied the code as you have mentioned into the searchfunction.php file
The results appear to be the same, after about thirty searches both the original blank table and the blank2 table are empty when I use phpmyadmin to have a look at them.
Some of the results are still coming up with blanks that are empty and I didn't notice any change in search speeds.
Perhaps this can help your diagnostics my friend??

All the best
Dave A downunder
Dave A is offline   Reply With Quote
Old 08-03-2005, 07:33 PM   #8
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Hmm, try the following...

First create the following table in the same database as the PhpDig tables:
Code:
CREATE TABLE blanks3 (
	blank TEXT DEFAULT '' NOT NULL
);
Then in search_function.php find:
Code:
             $query = "SELECT sites.site_url, sites.port, spider.path,spider.file,spider.first_words,sites.site_id,spider.spider_id,spider.last_modified,spider.md5 "
                      ."FROM ".PHPDIG_DB_PREFIX."spider AS spider, ".PHPDIG_DB_PREFIX."sites AS sites "
                      ."WHERE spider.spider_id=$spider_id AND sites.site_id = spider.site_id";
             $result = mysql_query($query,$id_connect);
             $content = mysql_fetch_array($result,MYSQL_ASSOC);
And afterwards add the following:
Code:
             $blank = addslashes(serialize($content));
             mysql_query("INSERT INTO blanks3 (blank) VALUES ('$blank')",$id_connect);
Now do one search (using the and option) on "Zealand Sustainability Database" (without the quotes) and then attach to this thread the content from the blanks3 table.
__________________
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
Old 08-03-2005, 07:48 PM   #9
Dave A
Purple Mole
 
Dave A's Avatar
 
Join Date: Aug 2004
Location: North Island New Zealand
Posts: 170
Hi Charter I have just done that and when I completed the search, the blank3 table was empty.
Dave A is offline   Reply With Quote
Old 08-03-2005, 07:49 PM   #10
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Email me FTP access to the PhpDig directory, if you will.
__________________
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
Old 08-03-2005, 08:05 PM   #11
Dave A
Purple Mole
 
Dave A's Avatar
 
Join Date: Aug 2004
Location: North Island New Zealand
Posts: 170
Hi Charter
just fired the access and password over to you.
Dave A is offline   Reply With Quote
Old 08-03-2005, 08: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
Old 08-05-2005, 02:21 PM   #13
Dave A
Purple Mole
 
Dave A's Avatar
 
Join Date: Aug 2004
Location: North Island New Zealand
Posts: 170
Hi Charter,
thanks for your advice and help with the problem, it appears to be okay now.

I went into the phpmyadmin and check the sites table which showed an error because of zero length in site. ID part of the table, so I then tried to repair the table which failed to work it out.
In the end I deleted all sit id's with a zero length and the sites table cleaned itself straight away.
So now it's up and running sweet as.
Thanks for your great help and assistance with this, I know it's not a given that you will sort out users problems but in this case I would really like say thanks!
The whole engine is working, I can now clean the index brilliant help.

Thanks for the support..
Dave A is offline   Reply With Quote
Old 08-07-2005, 07:11 AM   #14
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Glad it is now working. BTW, what do you get from the following query?
Code:
SELECT count(*),max(site_id) FROM sites;
The site_id column of the sites table is set as follows:
Code:
site_id mediumint(9) NOT NULL auto_increment
Maybe your blanks were because you are out of auto_increment numbers?

Hmm...
__________________
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
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search results layer problem josuah08 Troubleshooting 1 02-17-2006 01:36 AM
Problem Mysql when no results noel Troubleshooting 4 10-27-2005 10:56 AM
No most searched terms, biggest results, most 0 results, last search queries, etc. jongag1 How-to Forum 6 04-22-2005 11:43 AM
Problem restricting search results Grenville Hamly How-to Forum 6 10-14-2004 06:19 PM
problem with results marchelly Troubleshooting 1 09-11-2004 07:14 AM


All times are GMT -8. The time now is 12:25 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.