lib/PublicInbox/Search.pm | 27 +-------------------------- lib/PublicInbox/SearchMsg.pm | 1 + t/search.t | 17 ----------------- diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 86354b571f88541fe2d271c92c220204a151bf97..a1bae4197e65d5093c6d938d40da474c94a9ad09 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -326,6 +326,7 @@ ($db->postlist_begin($term), $db->postlist_end($term)); } # normalize subjects so they are suitable as pathnames for URLs +# XXX: consider for removal sub subject_path { my $subj = pop; $subj = subject_normalized($subj); @@ -340,32 +341,6 @@ $subj =~ s/\s+\z//s; # no trailing space $subj =~ s/\s+/ /gs; # no redundant spaces $subj =~ s/\.+\z//; # no trailing '.' $subj =~ s/$REPLY_RE//igo; # remove reply prefix - $subj; -} - -# for doc data -sub subject_summary { - my $subj = pop; - my $max = 68; - if (length($subj) > $max) { - my @subj = split(/\s+/, $subj); - $subj = ''; - my $l; - - while ($l = shift @subj) { - my $new = $subj . $l . ' '; - last if length($new) >= $max; - $subj = $new; - } - if ($subj ne '') { - my $r = scalar @subj ? ' ...' : ''; - $subj =~ s/ \z/$r/s; - } else { - # subject has one REALLY long word, and NOT spam? wtf - @subj = ($l =~ /\A(.{1,72})/); - $subj = $subj[0] . ' ...'; - } - } $subj; } diff --git a/lib/PublicInbox/SearchMsg.pm b/lib/PublicInbox/SearchMsg.pm index 5bb00778f1472712d1d609d72bda75125fea3ad0..b8eee6651b47fe748275b37e237f794302311c38 100644 --- a/lib/PublicInbox/SearchMsg.pm +++ b/lib/PublicInbox/SearchMsg.pm @@ -155,6 +155,7 @@ return $tid if defined $tid; $self->{thread} = _get_term_val($self, 'G', qr/\AG/); # *G*roup } +# XXX: consider removing this, we can phrase match subject sub path { my ($self) = @_; my $path = $self->{path}; diff --git a/t/search.t b/t/search.t index c16811d8d462806886c5d6f06e54d09c8dd0f6ba..c9c4e3464ce1a1a83ca8d4af1518b0dbb57faeb5 100644 --- a/t/search.t +++ b/t/search.t @@ -15,23 +15,6 @@ is(0, system(qw(git init -q --bare), $git_dir), "git init (main)"); eval { PublicInbox::Search->new($git_dir) }; ok($@, "exception raised on non-existent DB"); -{ - my $orig = "FOO " x 30; - my $summ = PublicInbox::Search::subject_summary($orig); - - $summ = length($summ); - $orig = length($orig); - ok($summ < $orig && $summ > 0, "summary shortened ($orig => $summ)"); - - $orig = "FOO" x 30; - $summ = PublicInbox::Search::subject_summary($orig); - - $summ = length($summ); - $orig = length($orig); - ok($summ < $orig && $summ > 0, - "summary shortened but not empty: $summ"); -} - my $rw = PublicInbox::SearchIdx->new($git_dir, 1); $rw->_xdb_acquire; $rw->_xdb_release;