/[Search-Estraier]/trunk/Estraier.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/Estraier.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 52 by dpavlin, Fri Jan 6 14:10:29 2006 UTC revision 53 by dpavlin, Fri Jan 6 14:39:45 2006 UTC
# Line 645  Return number of documents Line 645  Return number of documents
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    
# Line 1175  sub search { Line 1175  sub search {
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          );          );
# Line 1210  sub search { Line 1210  sub search {
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/) {
# Line 1226  sub search { Line 1227  sub search {
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) {
# Line 1235  sub search { Line 1238  sub search {
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,
# Line 1249  sub search { Line 1253  sub search {
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  }  }

Legend:
Removed from v.52  
changed lines
  Added in v.53

  ViewVC Help
Powered by ViewVC 1.1.26