user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 0/9] misc cleanups and trimming
@ 2017-01-07  1:44  7% Eric Wong
  2017-01-07  1:44  5% ` [PATCH 9/9] search: remove subject_summary Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2017-01-07  1:44 UTC (permalink / raw)
  To: meta

Weak reference dependencies are entirely gone.  This should
simplify the internal object structures of Perl a bit and
hopefully make the data structures easier to reason about.

While we're at it, there's several search-related cleanups
to eliminate some dead code.

9 changes:

      qspawn: prepare to support runtime reloading of Limiter
      config: always use namespaced "publicinboxlimiter"
      config: remove unused get() method
      inbox: describe the full key name
      inbox: eliminate weaken usage entirely
      config: allow per-inbox nntpserver
      remove incorrect comment about strftime + locales
      searchmsg: favor direct hash access over accessor methods
      search: remove subject_summary


 lib/PublicInbox/Config.pm        | 14 ++------
 lib/PublicInbox/Inbox.pm         | 73 ++++++++++++++++++----------------------
 lib/PublicInbox/Qspawn.pm        | 11 ++++--
 lib/PublicInbox/Search.pm        | 29 ++--------------
 lib/PublicInbox/SearchIdx.pm     |  4 +--
 lib/PublicInbox/SearchMsg.pm     | 36 +++-----------------
 lib/PublicInbox/WwwAtomStream.pm |  1 -
 t/config.t                       | 25 ++++++++++++--
 t/config_limiter.t               | 11 +++---
 t/search.t                       | 17 ----------
 10 files changed, 78 insertions(+), 143 deletions(-)


^ permalink raw reply	[relevance 7%]

* [PATCH 9/9] search: remove subject_summary
  2017-01-07  1:44  7% [PATCH 0/9] misc cleanups and trimming Eric Wong
@ 2017-01-07  1:44  5% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2017-01-07  1:44 UTC (permalink / raw)
  To: meta

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


^ permalink raw reply related	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2017-01-07  1:44  7% [PATCH 0/9] misc cleanups and trimming Eric Wong
2017-01-07  1:44  5% ` [PATCH 9/9] search: remove subject_summary Eric Wong

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).