PhpDig.net

Go Back   PhpDig.net > PhpDig Forums > Troubleshooting

Reply
 
Thread Tools
Old 08-19-2004, 11:41 PM   #1
bforsyth
Green Mole
 
Join Date: Jun 2004
Posts: 22
Search on search results page not working

Hi,

This is a little weird. I have a site wide search box on my site which works just fine.

http://cgasson.truth.posiweb.net/new/

PHP Code:
<form action="search.php" method="get"
<
input type="text" size="15" maxlength="50" name="query_string" value=""/>
<
input type="submit" value =" GO »" name="search">
<
input type='hidden' name='limite'  value='10'>
</
form
This box returns results as expected.

However, if you try and resubmit the same search query (or any other query for that matter) from the search box at the top of the search results page, it returns a null result?

Any ideas why?
bforsyth is offline   Reply With Quote
Old 08-20-2004, 04:38 AM   #2
vinyl-junkie
Purple Mole
 
Join Date: Jan 2004
Posts: 694
You are missing some variables in your form. Have a look at this thread.
vinyl-junkie is offline   Reply With Quote
Old 08-20-2004, 08:07 PM   #3
bforsyth
Green Mole
 
Join Date: Jun 2004
Posts: 22
Thanks for your quick response vinyl-junkie but I think that you have mis-understood my problem.

When you do a search from the "Quick search" box in the left hand colmn under the nav bar, the search results return as you would expect it to.

However, after doing a search, if you try and do another search using the search box atthe top of the search results page (not the quick search box on the left hand side), the search will produce no reults with the same or any other query in it.

Looking at the code that phpDig produces for the form v's the form code I have in my quick search form, the form at the top of the Search results page seems to be missing a value in the the template_demo line:

My quick search form code (which works):

PHP Code:
<input type='hidden' name='template_demo' value='/search/templates/search.php'/> 
phpDig search form at teh top of results page:

PHP Code:
<input name="template_demo" value="" type="hidden"
Is this the problem?

Last edited by bforsyth; 08-20-2004 at 08:12 PM.
bforsyth is offline   Reply With Quote
Old 08-20-2004, 08:12 PM   #4
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Compare the HTML source of your search box at the top of your page to one of the search boxes on this site, and then fix your search box form.
__________________
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-20-2004, 08:31 PM   #5
bforsyth
Green Mole
 
Join Date: Jun 2004
Posts: 22
Thanks Charter - you beat me to my post edit. This is exactly what I have done - with the results above.

And the template_demo value is the only thing that appears to be different.
However, the parameters that are appearing in the GET request are significantly different:

The working form (quicksearch) is producing this URL request:

PHP Code:
http://127.0.0.1/gwi/rcs/search.php?
query_string=test
&search=GO+%BB
&limite=10 
request from the phpDig dearch form at the top of the search results page (returns no results)

PHP Code:
http://127.0.0.1/gwi/rcs/search.php?
path=
&
refine=1
&template_demo=%2Fsearch%2Ftemplates%2Fsearch.php
&result_page=search.php
&query_string=test
&search=Go
&limite=10
&option=start 
bforsyth is offline   Reply With Quote
Old 08-20-2004, 08:32 PM   #6
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Why is refine set to one initially?
__________________
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-20-2004, 08:34 PM   #7
bforsyth
Green Mole
 
Join Date: Jun 2004
Posts: 22
I've no idea? I am just looking for the code that actually produces the form at the top of the reults page.

I assume that refine is a boolean used to refine the search by searching within the resuls already returned?
bforsyth is offline   Reply With Quote
Old 08-20-2004, 08:35 PM   #8
bforsyth
Green Mole
 
Join Date: Jun 2004
Posts: 22
Yup - If I set refine=0 then everything works as I would expect it to?

I have edited the php_dig_form function at line 130:
PHP Code:
<input type='hidden' name='refine' value='1'/> 
changed to
PHP Code:
<input type='hidden' name='refine' value='0'/> 

Last edited by bforsyth; 08-20-2004 at 08:42 PM.
bforsyth is offline   Reply With Quote
Old 08-20-2004, 08:48 PM   #9
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Right, as there is no $site to refine on, what happens? No results.
PHP Code:
if ($refine) {
     
$query_string urldecode($query_string);
     
$wheresite "AND spider.site_id = $site ";
     if ((
$path) && (strlen($path) > 0)) {
          
$wherepath "AND spider.path like '$my_path' ";
     }
     
$refine_url "&refine=1&site=$site&path=$path";
}
else {
     
$refine_url "";

__________________
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-20-2004, 10:28 PM   #10
bforsyth
Green Mole
 
Join Date: Jun 2004
Posts: 22
Thanks Charter - so my fix should be OK then?

Can you explain what the $site variable brings into play? Does it allow you to search accross multiple sites or something?
bforsyth is offline   Reply With Quote
Old 08-20-2004, 10:35 PM   #11
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
It's okay as long as you don't ever want to refine. The $site variable holds a unique number identifying a site.
__________________
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 returns blank page Anton Troubleshooting 1 02-11-2006 11:20 PM
Search results returns blank page Anton Troubleshooting 0 01-05-2006 09:56 PM
search results page lukemack How-to Forum 1 11-10-2005 10:48 PM
Search page problems, no results kalli Troubleshooting 1 09-03-2005 01:55 PM
highlight search results on page? rediray How-to Forum 2 10-03-2003 04:40 AM


All times are GMT -8. The time now is 02:08 PM.


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