--- trunk/Estraier.pm 2006/01/06 18:35:53 54 +++ trunk/Estraier.pm 2006/01/06 20:39:58 55 @@ -1095,7 +1095,7 @@ sub name { my $self = shift; - $self->set_info unless ($self->{name}); + $self->_set_info unless ($self->{name}); return $self->{name}; } @@ -1108,7 +1108,7 @@ sub label { my $self = shift; - $self->set_info unless ($self->{label}); + $self->_set_info unless ($self->{label}); return $self->{label}; } @@ -1121,7 +1121,7 @@ sub doc_num { my $self = shift; - $self->set_info if ($self->{dnum} < 0); + $self->_set_info if ($self->{dnum} < 0); return $self->{dnum}; } @@ -1134,7 +1134,7 @@ sub word_num { my $self = shift; - $self->set_info if ($self->{wnum} < 0); + $self->_set_info if ($self->{wnum} < 0); return $self->{wnum}; } @@ -1147,7 +1147,7 @@ sub size { my $self = shift; - $self->set_info if ($self->{size} < 0); + $self->_set_info if ($self->{size} < 0); return $self->{size}; } @@ -1268,6 +1268,8 @@ =head2 cond_to_query +Return URI encoded string generated from Search::Estraier::Condition + my $args = $node->cond_to_query( $cond ); =cut @@ -1425,15 +1427,47 @@ } -=head2 set_info +=head2 set_snippet_width + +Set width of snippets in results + + $node->set_snippet_width( $wwidth, $hwidth, $awidth ); + +C<$wwidth> specifies whole width of snippet. It's C<480> by default. If it's C<0> snippet +is not sent with results. If it is negative, whole document text is sent instead of snippet. + +C<$hwidth> specified width of strings from beginning of string. Default +value is C<96>. Negative or zero value keep previous value. + +C<$awidth> specifies width of strings around each highlighted word. It's C<96> by default. +If negative of zero value is provided previous value is kept unchanged. + +=cut + +sub set_snippet_width { + my $self = shift; + + my ($wwidth, $hwidth, $awidth) = @_; + $self->{wwidth} = $wwidth; + $self->{hwidth} = $hwidth if ($hwidth >= 0); + $self->{awidth} = $awidth if ($awidth >= 0); +} + + + +=head1 PRIVATE METHODS + +You could call those directly, but you don't have to. I hope. + +=head2 _set_info Set information for node - $node->set_info; + $node->_set_info; =cut -sub set_info { +sub _set_info { my $self = shift; $self->{status} = -1;