645 |
|
|
646 |
sub doc_num { |
sub doc_num { |
647 |
my $self = shift; |
my $self = shift; |
648 |
return $#{$self->{docs}}; |
return $#{$self->{docs}} + 1; |
649 |
} |
} |
650 |
|
|
651 |
|
|
1175 |
my $resbody; |
my $resbody; |
1176 |
|
|
1177 |
my $rv = $self->shuttle_url( $self->{url} . '/search', |
my $rv = $self->shuttle_url( $self->{url} . '/search', |
1178 |
'text/x-estraier-draft', |
'application/x-www-form-urlencoded', |
1179 |
$self->cond_to_query( $cond ), |
$self->cond_to_query( $cond ), |
1180 |
\$resbody, |
\$resbody, |
1181 |
); |
); |
1210 |
|
|
1211 |
while( ! $isend && $lnum <= $#lines ) { |
while( ! $isend && $lnum <= $#lines ) { |
1212 |
my $line = $lines[$lnum]; |
my $line = $lines[$lnum]; |
1213 |
|
#warn "# $lnum: $line\n"; |
1214 |
$lnum++; |
$lnum++; |
1215 |
|
|
1216 |
if ($line && $line =~ m/^\Q$border\E/) { |
if ($line && $line =~ m/^\Q$border\E/) { |
1227 |
last unless ($rdline); |
last unless ($rdline); |
1228 |
if ($rdline =~ /^%/) { |
if ($rdline =~ /^%/) { |
1229 |
$rdvector = $1 if ($rdline =~ /^%VECTOR\t(.+)$/); |
$rdvector = $1 if ($rdline =~ /^%VECTOR\t(.+)$/); |
1230 |
|
} elsif($rdline =~ /=/) { |
1231 |
|
$rdattrs->{$1} = $2 if ($rdline =~ /^(.+)=(.+)$/); |
1232 |
} else { |
} else { |
1233 |
$rdattrs->{$1} = {$2} if ($line =~ /^(.+)=(.+)$/); |
confess "invalid format of response"; |
1234 |
} |
} |
1235 |
} |
} |
1236 |
while($rlnum < $lnum - 1) { |
while($rlnum < $lnum - 1) { |
1238 |
$rlnum++; |
$rlnum++; |
1239 |
$rdsnippet .= "$rdline\n"; |
$rdsnippet .= "$rdline\n"; |
1240 |
} |
} |
1241 |
|
#warn Dumper($rdvector, $rdattrs, $rdsnippet); |
1242 |
if (my $rduri = $rdattrs->{'@uri'}) { |
if (my $rduri = $rdattrs->{'@uri'}) { |
1243 |
push @docs, new Search::Estraier::ResultDocument( |
push @docs, new Search::Estraier::ResultDocument( |
1244 |
uri => $rduri, |
uri => $rduri, |
1253 |
$isend = 1 if ($line =~ /:END$/); |
$isend = 1 if ($line =~ /:END$/); |
1254 |
} |
} |
1255 |
|
|
|
if (! $isend) { |
|
|
warn "received result doesn't have :END\n$resbody"; |
|
|
return; |
|
|
} |
|
1256 |
} |
} |
1257 |
|
|
1258 |
if (! $isend) { |
if (! $isend) { |
1259 |
warn "received result doesn't have :END\n$resbody"; |
warn "received result doesn't have :END\n$resbody"; |
1260 |
return; |
return; |
1261 |
} |
} |
1262 |
|
|
1263 |
|
#warn Dumper(\@docs, $hints); |
1264 |
|
|
1265 |
return new Search::Estraier::NodeResult( docs => \@docs, hints => $hints ); |
return new Search::Estraier::NodeResult( docs => \@docs, hints => $hints ); |
1266 |
} |
} |