user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/2] searchidx: simplify ghost creation
Date: Tue, 21 Jun 2016 04:28:58 +0000	[thread overview]
Message-ID: <20160621042859.16146-2-e@80x24.org> (raw)
In-Reply-To: <20160621042859.16146-1-e@80x24.org>

Remove some worthless parameters and redundant no-ops
to make the next (important) patch easier-to-review.
---
 lib/PublicInbox/SearchIdx.pm | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index a259d86..3134687 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -150,11 +150,11 @@ sub add_message {
 
 		if ($was_ghost) {
 			$doc_id = $smsg->doc_id;
-			$self->link_message($smsg, 0);
+			$self->link_message($smsg);
 			$doc->set_data($smsg->to_doc_data);
 			$db->replace_document($doc_id, $doc);
 		} else {
-			$self->link_message($smsg, 0);
+			$self->link_message($smsg);
 			$doc->set_data($smsg->to_doc_data);
 			$doc_id = $db->add_document($doc);
 		}
@@ -211,16 +211,6 @@ sub next_thread_id {
 }
 
 sub link_message {
-	my ($self, $smsg, $is_ghost) = @_;
-
-	if ($is_ghost) {
-		$smsg->ensure_metadata;
-	} else {
-		$self->link_message_to_parents($smsg);
-	}
-}
-
-sub link_message_to_parents {
 	my ($self, $smsg) = @_;
 	my $doc = $smsg->{doc};
 	my $mid = $smsg->mid;
@@ -414,17 +404,15 @@ sub _resolve_mid_to_tid {
 }
 
 sub create_ghost {
-	my ($self, $mid, $tid) = @_;
-
-	$tid = $self->next_thread_id unless defined $tid;
+	my ($self, $mid) = @_;
 
+	my $tid = $self->next_thread_id;
 	my $doc = Search::Xapian::Document->new;
 	$doc->add_term(xpfx('mid') . $mid);
 	$doc->add_term(xpfx('thread') . $tid);
 	$doc->add_term(xpfx('type') . 'ghost');
 
 	my $smsg = PublicInbox::SearchMsg->wrap($doc, $mid);
-	$self->link_message($smsg, 1);
 	$self->{xdb}->add_document($doc);
 
 	$smsg;

  reply	other threads:[~2016-06-21  4:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-21  4:28 [PATCH 0/2] searchidx: fix ghost vivification Eric Wong
2016-06-21  4:28 ` Eric Wong [this message]
2016-06-21  4:28 ` [PATCH 2/2] searchidx: merge old thread id from ghosts Eric Wong
2016-06-21 21:26   ` 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=20160621042859.16146-2-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).