--- trunk/Estraier.pm 2006/01/06 14:10:29 52 +++ trunk/Estraier.pm 2006/01/06 14:39:45 53 @@ -645,7 +645,7 @@ sub doc_num { my $self = shift; - return $#{$self->{docs}}; + return $#{$self->{docs}} + 1; } @@ -1175,7 +1175,7 @@ my $resbody; my $rv = $self->shuttle_url( $self->{url} . '/search', - 'text/x-estraier-draft', + 'application/x-www-form-urlencoded', $self->cond_to_query( $cond ), \$resbody, ); @@ -1210,6 +1210,7 @@ while( ! $isend && $lnum <= $#lines ) { my $line = $lines[$lnum]; + #warn "# $lnum: $line\n"; $lnum++; if ($line && $line =~ m/^\Q$border\E/) { @@ -1226,8 +1227,10 @@ last unless ($rdline); if ($rdline =~ /^%/) { $rdvector = $1 if ($rdline =~ /^%VECTOR\t(.+)$/); + } elsif($rdline =~ /=/) { + $rdattrs->{$1} = $2 if ($rdline =~ /^(.+)=(.+)$/); } else { - $rdattrs->{$1} = {$2} if ($line =~ /^(.+)=(.+)$/); + confess "invalid format of response"; } } while($rlnum < $lnum - 1) { @@ -1235,6 +1238,7 @@ $rlnum++; $rdsnippet .= "$rdline\n"; } + #warn Dumper($rdvector, $rdattrs, $rdsnippet); if (my $rduri = $rdattrs->{'@uri'}) { push @docs, new Search::Estraier::ResultDocument( uri => $rduri, @@ -1249,17 +1253,14 @@ $isend = 1 if ($line =~ /:END$/); } - if (! $isend) { - warn "received result doesn't have :END\n$resbody"; - return; - } } if (! $isend) { warn "received result doesn't have :END\n$resbody"; return; } - + + #warn Dumper(\@docs, $hints); return new Search::Estraier::NodeResult( docs => \@docs, hints => $hints ); }