From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 9/9] search: remove subject_summary
Date: Sat, 7 Jan 2017 01:44:52 +0000 [thread overview]
Message-ID: <20170107014452.9657-10-e@80x24.org> (raw)
In-Reply-To: <20170107014452.9657-1-e@80x24.org>
Apparently it never actually got used, and the world seems
fine without it, so we can drop it.
While we're at it, consider removing our subject_path
usage from existence, too. We are not using fancy subject-line
based URLs, here.
---
lib/PublicInbox/Search.pm | 27 +--------------------------
lib/PublicInbox/SearchMsg.pm | 1 +
t/search.t | 17 -----------------
3 files changed, 2 insertions(+), 43 deletions(-)
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm
index 86354b5..a1bae41 100644
--- a/lib/PublicInbox/Search.pm
+++ b/lib/PublicInbox/Search.pm
@@ -326,6 +326,7 @@ sub find_doc_ids_for_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);
@@ -343,32 +344,6 @@ sub subject_normalized {
$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;
-}
-
sub enquire {
my ($self) = @_;
$self->{enquire} ||= Search::Xapian::Enquire->new($self->{xdb});
diff --git a/lib/PublicInbox/SearchMsg.pm b/lib/PublicInbox/SearchMsg.pm
index 5bb0077..b8eee66 100644
--- a/lib/PublicInbox/SearchMsg.pm
+++ b/lib/PublicInbox/SearchMsg.pm
@@ -155,6 +155,7 @@ sub thread_id {
$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 c16811d..c9c4e34 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;
--
EW
prev parent reply other threads:[~2017-01-07 1:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-07 1:44 [PATCH 0/9] misc cleanups and trimming Eric Wong
2017-01-07 1:44 ` [PATCH 1/9] qspawn: prepare to support runtime reloading of Limiter Eric Wong
2017-01-07 1:44 ` [PATCH 2/9] config: always use namespaced "publicinboxlimiter" Eric Wong
2017-01-07 1:44 ` [PATCH 3/9] config: remove unused get() method Eric Wong
2017-01-07 1:44 ` [PATCH 4/9] inbox: describe the full key name Eric Wong
2017-01-07 1:44 ` [PATCH 5/9] inbox: eliminate weaken usage entirely Eric Wong
2017-01-07 2:12 ` [PATCH 10/9] inbox: properly register cleanup timer for git processes Eric Wong
2017-01-11 10:21 ` [PATCH 11/9] inbox: reinstate periodic cleanup of Xapian and SQLite objects Eric Wong
2017-01-07 1:44 ` [PATCH 6/9] config: allow per-inbox nntpserver Eric Wong
2017-01-07 1:44 ` [PATCH 7/9] remove incorrect comment about strftime + locales Eric Wong
2017-01-07 1:44 ` [PATCH 8/9] searchmsg: favor direct hash access over accessor methods Eric Wong
2017-01-07 1:44 ` Eric Wong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170107014452.9657-10-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).