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

Search Problems!!

Quote Reply
Search Problems!!
Hi All,

Wierd this one, when i do a search for anything like abaibaihba i get the template page with sorry no matching records, when i search for somehting like help i get the following.

Code:
Software error:
Can't use an undefined value as an ARRAY reference at admin/Links/Search.pm line 904.
this refers to this section of the pm file
Code:
if ( $self->{mh} ) {

#$i = $self->{page} * $self->{mh} + $i;
my $array_ref = ${$self->{page_results}}[$i] or return undef;
my $names = $self->{NAME};
my %hash = map { $_ => $$array_ref[ $$names { $_ } ] } keys %$names;
$results = \%hash;

} else {

$sth->execute ( $I );
any ideas please, you can see it for yourself at http://www.just35.com/pages

search is at the bottom of page.



Regards

MDJ1
http://www.isee-multimedia.co.uk
mark@isee-multimedia.co.uk
Quote Reply
Re: Search Problems!! In reply to
The following line seems to be the bug:

Code:

#$i = $self->{page} * $self->{mh} + $i;


Since you have remmed it, the $i is not able to be used in the proceeding lines.

Change those codes to the following:

Code:

my $i = $self->{page} * $self->{mh} + $i;


Regards,

Eliot Lee
Quote Reply
Re: Search Problems!! In reply to
I don't understand, the code above is the one supplied why should i need to change it, i havnt missed anything stupid like a hidden tag in the search form have i?

I have replaced the line with the one you gave but im still getting the same error.



Regards

MDJ1
http://www.isee-multimedia.co.uk
mark@isee-multimedia.co.uk
Quote Reply
Re: Search Problems!! In reply to
In Reply To:
I don't understand, the code above is the one supplied why should i need to change it, i havnt missed anything stupid like a hidden tag in the search form have i?
Well, I don't know what to tell ya...but...

Here is the complete sub:

Code:

sub fetchrow_hashref {
#------------------------------------------------------------
my $self = shift;
my $i = $self->{query_index}++;
my $sth = $self->{STH_get_item} or return undef;
my $ref = ${$self->{query_results}}[ $i ] or return undef;

return undef if (!($ref));

my $results;

# ... test if we must use
my ($I,$s) = @$ref;

if ( $self->{mh} ) {

#$i = $self->{page} * $self->{mh} + $i;
my $array_ref = ${$self->{page_results}}[$i] or return undef;
my $names = $self->{NAME};
my %hash = map { $_ => $$array_ref[ $$names { $_ } ] } keys %$names;
$results = \%hash;

} else {

$sth->execute ( $I );

# ... return a ref and score pair
$results = $sth->fetchrow_hashref () or return undef;
$sth->finish ();
}

$$results { $self->{score_key} } = $s;
return $results;
}


Try unremming the line I suggested.

Regards,


Eliot Lee
Quote Reply
Re: Search Problems!! In reply to
Hi eliot,

Ive tried taking out the # but im still getting the same error.

I'll email support


Regards

MDJ1
http://www.isee-multimedia.co.uk
mark@isee-multimedia.co.uk