--- loncom/interface/lonsearchcat.pm 2001/03/22 14:03:55 1.70 +++ loncom/interface/lonsearchcat.pm 2001/03/22 14:58:58 1.76 @@ -544,7 +544,7 @@ sub advancedsearch { elsif ($datequery) { push @queries,$datequery; } - my $customquery; + my $customquery=''; if ($ENV{'form.custommetadata'}) { $customquery=&build_custommetadata_query('custommetadata', $ENV{'form.custommetadata'}); @@ -552,7 +552,13 @@ sub advancedsearch { if (@queries) { $query=join(" AND ",@queries); $query="select * from metadata where $query"; - my $reply=&Apache::lonnet::metadata_query($query); + my $reply=''; + unless ($customquery) { + $reply=&Apache::lonnet::metadata_query($query); + } + else { + $reply=&Apache::lonnet::metadata_query($query,$customquery); + } &output_results('Advanced',$r,$envhash,$customquery,$reply); } else { @@ -793,7 +799,9 @@ sub build_custommetadata_query { $q->prepare($logic_statement); my $matchexp=${$q}{'-parse'}{'-build'}{'matchstring'}; # quick fix to change literal into xml tag-matching - $matchexp=~s/\(\?\:([^\)]*)\\\=([^\)]*)\)/\(\?\:\<$1\>\[\^\\\<\]\*$2\[\^\\\<\]\*\<\/$1\>)/g; + # will eventually have to write a separate builder module + my $oldmatchexp=$matchexp; + $matchexp=~s/(\w+)\\\=(\w+)/\\\<$1\\\>\[\^\\\<\]\*$2\[\^\\\<\]\*\\\<\\\/$1\\\>/g; return $matchexp; }