PhpDig.net

PhpDig.net (http://www.phpdig.net/forum/index.php)
-   Troubleshooting (http://www.phpdig.net/forum/forumdisplay.php?f=22)
-   -   Search on search results page not working (http://www.phpdig.net/forum/showthread.php?t=1192)

bforsyth 08-19-2004 10:41 PM

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?

vinyl-junkie 08-20-2004 03:38 AM

You are missing some variables in your form. Have a look at this thread.

bforsyth 08-20-2004 07:07 PM

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?

Charter 08-20-2004 07:12 PM

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.

bforsyth 08-20-2004 07:31 PM

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 


Charter 08-20-2004 07:32 PM

Why is refine set to one initially?

bforsyth 08-20-2004 07:34 PM

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 08-20-2004 07:35 PM

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'/> 


Charter 08-20-2004 07:48 PM

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 "";



bforsyth 08-20-2004 09:28 PM

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?

Charter 08-20-2004 09:35 PM

It's okay as long as you don't ever want to refine. The $site variable holds a unique number identifying a site.


All times are GMT -8. The time now is 03:56 AM.

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