Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Search.cgi Bugging up on me :)

Quote Reply
Search.cgi Bugging up on me :)
Hey,

Ever since I restored the back-up, search.cgi when used on the pages, such as the main page http://www.webhostarea.com - that the search failed as
Quote:
Error: Must Set One Parameter.

Now - as informative as this error message is, with the query string set to...

http://www.webhostarea.com/...ferRange=10.1GB-50GB

I think that the script has enough infomation to work with Wink

Anyone know what the problem is?

------------------
Michael Bray
Review your webhost or find a new one.
www.webhostarea.com
Links SQL User
------------------




Quote Reply
Re: Search.cgi Bugging up on me :) In reply to
Try putting the "mh" parameter first.

For some reason, something tells me all the non-standard stuff has to be at the end, and "custom" doesn't ring a bell as one of the parameters. If that's working on pages other than the front page, I don't have a clue....
Quote Reply
Re: Search.cgi Bugging up on me :) In reply to
I don't think that error message is from me is it? I'd need to see your changed search.cgi to see where that is coming from.

Cheers,

Alex
Quote Reply
Re: Search.cgi Bugging up on me :) In reply to
Yeah,

The search.cgi has been modded a bit... heres the code... I have left out the the sub log_query and sub build linked titles cause there not modded and too so people can't take so much of the code Smile

<BLOCKQUOTE><font size="1" face="Verdana, Arial">code:</font><HR><pre>
sub main {
# ---------------------------------------------------
# Determine what to do.
#
my $in = new CGI;
my $dynamic = $in->param('d') ? $in : undef;
print $in->header();

if ($in->param('query') &#0124; &#0124; $in->param('custom')) {
&search ($in, $dynamic);
}
else {
&site_html_search_form ( { query => '' }, $dynamic );
}
}
# ==============================================================

sub search {
# ---------------------------------------------------
# Performs the actual search.
#
my ($in, $dynamic) = @_;
my ($mh, $bool, $nh, $ww, $order, $query, $ignored, %seen, $next,
$catdb, $cat_hits, $category_results, $cat_count, $cat_errors, $linkdb, $link_hits, $link_results, $link_count, $link_errors);
my %in = %{&cgi_to_hash($in)};

# Get/Set the search options.
($in->param('mh') =~ /^(10|25|50|100)$/) ? ($mh = $1) : ($mh = 25);
($in->param('bool') =~ /^(and|or)$/i) ? ($bool = uc $1) : ($bool = 'AND');
($in->param('nh') =~ /^(\d+)$/) ? ($nh = $1) : ($nh = 1);
($in->param('substring')) ? ($ww = 0) : ($ww = 1);
($in->param('order') =~ /^(score|category)$/i) ? ($order = uc $1) : ($order = 'CATEGORY');

# Split up the search term.
$query = $in->param('query');
$in{'term'} = $in->escape ($query);

# Search the category listings.
$catdb = new Links: Smile

------------------
Michael Bray
Review your webhost or find a new one.
www.webhostarea.com
Links SQL User
------------------




Quote Reply
Re: Search.cgi Bugging up on me :) In reply to
Michael,

I ran into the same problems as you with the code you're using. I've gone a slightly different root and took the advice in the original forum on this topic and split the search up into two subroutines. Then add this code at the top:

if ($in->param('query')) {
&search ($in, $dynamic);
}
elsif ($in->param('custom')) {
&custom_search ($in, $dynamic);
}
else {
&site_html_search_form ( { query => '', db=>Links }, $dynamic );
}

Hope that helps a bit. I've stopped getting that parameter error message.

I'm not sure exactly how I'm going to use the custom search. I'm probably going to use it as advanced search options since the query itself is extremely powerful (albeit a bit buggy).

When I get to that stage I'll be looking into the query logging as well.

till then.

Peace.

Kyle
Quote Reply
Re: Search.cgi Bugging up on me :) In reply to
the field names must be from the Links database.. for example.. if you say

Space=>50

then it will look for something inside of the field Space that is more than 50.. but it won't work with multiples.. that requires more editing.

------------------
Jerry Su
Links SQL User
------------------
Quote Reply
Re: Search.cgi Bugging up on me :) In reply to
Widgetz,

That isn't with Range searches, thats for just normal searching the fields... It was working till I restored the bloody backup - then all hell broke loose Smile

Any other ideas? Thanks!

------------------
Michael Bray
Review your webhost or find a new one.
www.webhostarea.com
Links SQL User
------------------




Quote Reply
Re: Search.cgi Bugging up on me :) In reply to
Hmm.. Well the error is on this line:

($in->param('custom') && keys %filter > 0)

Try printing out:

print "Custom: '", $in->param('custom'), "' filter: '", scalar (keys %filter), "'";

and see what it says, that way we can tell what's causing the error.

Cheers,

Alex
Quote Reply
Re: Search.cgi Bugging up on me :) In reply to
Alex,

I managed to fix this the other day by wiping the tables and starting again Frown - Not the best solution - but the best I could come up with.

The search.cgi is still the same as I posted but it now works, so I am thinking there was a bug when I setup the script (I installed it myself...)

------------------
Michael Bray
Review your webhost or find a new one.
www.webhostarea.com
Links SQL User
------------------