--- loncom/interface/lonsearchcat.pm 2001/03/20 17:49:03 1.44 +++ loncom/interface/lonsearchcat.pm 2001/03/21 00:32:33 1.45 @@ -448,7 +448,7 @@ sub selectbox { return $selout.''; } -# ------------------------------------------------ Performing a advanced search +# ----------------------------------------------- Performing an advanced search sub advancedsearch { my ($r,$envhash)=@_; my %ENV=%{$envhash}; @@ -469,22 +469,22 @@ sub advancedsearch { my $query=''; - my $testquery=''; + my @queries; # Go through logical expression AND/OR/NOT phrase fields. foreach my $field ('title','author','subject','notes','abstract') { if ($ENV{'form.'.$field}) { - $testquery=build_SQL_query($field,$ENV{'form.'.$field}); + push @queries,&build_SQL_query($field,$ENV{'form.'.$field}); } } - -# my $concatarg=join('," ",', -# ('title', 'author', 'subject', 'notes', 'abstract')); - - $query="select * from metadata where $testquery"; - - my $reply=&Apache::lonnet::metadata_query($query); - - &output_results('Advanced',$r,$envhash,$query,$reply); + if (@queries) { + $query="(" . (join(") and ("),@queries) . ")"; + $query="select * from metadata where $testquery"; + my $reply=&Apache::lonnet::metadata_query($query); + &output_results('Advanced',$r,$envhash,$query,$reply); + } + else { + &output_results('Advanced',$r,$envhash,$query); + } return OK; } 500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.