unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [PATCH 4/9] smsg: to_doc_data: use existing fields
Date: Fri, 20 Mar 2020 08:18:16 +0000	[thread overview]
Message-ID: <20200320081821.21715-5-e@yhbt.net> (raw)
In-Reply-To: <20200320081821.21715-1-e@yhbt.net>

No need to pass extra parameters to this method, since
smsg has universal meanings for {blob} and {mid}.
---
 lib/PublicInbox/OverIdx.pm   | 2 +-
 lib/PublicInbox/SearchIdx.pm | 4 +++-
 lib/PublicInbox/Smsg.pm      | 7 +++----
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm
index fd521bdd..9640f9d1 100644
--- a/lib/PublicInbox/OverIdx.pm
+++ b/lib/PublicInbox/OverIdx.pm
@@ -265,7 +265,7 @@ sub add_overview {
 		$xpath = subject_path($subj);
 		$xpath = id_compress($xpath);
 	}
-	my $dd = $smsg->to_doc_data($oid, $mid0);
+	my $dd = $smsg->to_doc_data;
 	utf8::encode($dd);
 	$dd = compress($dd);
 	my $ds = msg_timestamp($hdr, $times->{autime});
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 6e6c6424..c0578809 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -340,7 +340,9 @@ sub add_xapian ($$$$$$) {
 	}
 	$smsg->{to} = $smsg->{cc} = '';
 	PublicInbox::OverIdx::parse_references($smsg, $mid0, $mids);
-	my $data = $smsg->to_doc_data($oid, $mid0);
+	$smsg->{blob} = $oid;
+	$smsg->{mid} = $mid0;
+	my $data = $smsg->to_doc_data;
 	$doc->set_data($data);
 	if (my $altid = $self->{-altid}) {
 		foreach my $alt (@$altid) {
diff --git a/lib/PublicInbox/Smsg.pm b/lib/PublicInbox/Smsg.pm
index 7a47703a..5eb0723f 100644
--- a/lib/PublicInbox/Smsg.pm
+++ b/lib/PublicInbox/Smsg.pm
@@ -34,16 +34,15 @@ sub get_val ($$) {
 }
 
 sub to_doc_data {
-	my ($self, $oid, $mid0) = @_;
-	$oid = '' unless defined $oid;
+	my ($self) = @_;
 	join("\n",
 		$self->subject,
 		$self->from,
 		$self->references,
 		$self->to,
 		$self->cc,
-		$oid,
-		$mid0,
+		$self->{blob},
+		$self->{mid},
 		$self->{bytes} // '',
 		$self->{lines} // ''
 	);

  parent reply	other threads:[~2020-03-20  8:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05  3:23 [PATCH] index: use git commit times on missing Date/Received Eric Wong
2020-03-05  5:13 ` Eric Wong
2020-03-20  8:18   ` [PATCH 0/9] preserve time and date of initial commit Eric Wong
2020-03-20  8:18     ` [PATCH 1/9] index: use git commit times on missing Date/Received Eric Wong
2020-03-20  8:18     ` [PATCH 2/9] v2writable: preserve timestamps from import Eric Wong
2020-03-20  8:18     ` [PATCH 3/9] rename PublicInbox::SearchMsg => PublicInbox::Smsg Eric Wong
2020-03-20  8:18     ` Eric Wong [this message]
2020-03-20  8:18     ` [PATCH 5/9] overidx: parse_references: less error-prone args Eric Wong
2020-03-20  8:18     ` [PATCH 6/9] *idx: pass $smsg in more places instead of many args Eric Wong
2020-03-20  8:18     ` [PATCH 7/9] v2: pass smsg in more places Eric Wong
2020-03-20  8:18     ` [PATCH 8/9] *idx: pass smsg in even " Eric Wong
2020-03-20  8:18     ` [PATCH 9/9] v2: SDBM-based multi Message-ID queue Eric Wong

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=20200320081821.21715-5-e@yhbt.net \
    --to=e@yhbt.net \
    --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.
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).