diff options
author | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-04-01 06:30:37 +0000 |
---|---|---|
committer | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-04-01 23:27:54 +0000 |
commit | 7503aeb540af5afd5cb1b554b3c29f35f5fc918d (patch) | |
tree | a951f16abdeed74b97182c7b24b378a2bf02aeaa /lib/PublicInbox/SearchIdx.pm | |
parent | 11182cf3e95cf76bbaf3112311cf613755d1a86a (diff) | |
download | public-inbox-7503aeb540af5afd5cb1b554b3c29f35f5fc918d.tar.gz |
We can store :bytes and :lines in doc_data since we never sort or search by them. We don't have much use for the Date: stamp at the moment, either.
Diffstat (limited to 'lib/PublicInbox/SearchIdx.pm')
-rw-r--r-- | lib/PublicInbox/SearchIdx.pm | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 36f97b36..2e0b9a43 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -114,25 +114,12 @@ sub add_val ($$$) { $doc->add_value($col, $num); } -sub add_values ($$) { - my ($doc, $values) = @_; - - my $ts = $values->[PublicInbox::Search::TS]; +sub add_values { + my ($doc, $ts, $ds, $num) = @_; add_val($doc, PublicInbox::Search::TS, $ts); - - my $num = $values->[PublicInbox::Search::NUM]; - defined($num) and add_val($doc, PublicInbox::Search::NUM, $num); - - my $bytes = $values->[PublicInbox::Search::BYTES]; - defined($bytes) and add_val($doc, PublicInbox::Search::BYTES, $bytes); - - my $lines = $values->[PublicInbox::Search::LINES]; - add_val($doc, PublicInbox::Search::LINES, $lines); - - my $ds = $values->[PublicInbox::Search::DS]; - add_val($doc, PublicInbox::Search::DS, $ds); my $yyyymmdd = strftime('%Y%m%d', gmtime($ds)); add_val($doc, PublicInbox::Search::YYYYMMDD, $yyyymmdd); + defined($num) and add_val($doc, PublicInbox::Search::NUM, $num); } sub index_users ($$) { @@ -295,8 +282,10 @@ sub add_message { } my $lines = $mime->body_raw =~ tr!\n!\n!; - my @values = ($smsg->ds, $num, $bytes, $lines, $smsg->ts); - add_values($doc, \@values); + $smsg->{lines} = $mime->body_raw =~ tr!\n!\n!; + defined $bytes or $bytes = length($mime->as_string); + $smsg->{bytes} = $bytes; + add_values($doc, $smsg->ts, $smsg->ds, $num); my $tg = $self->term_generator; @@ -366,8 +355,8 @@ sub add_message { $self->delete_article($num) if defined $num; # for reindexing if ($skel) { - push @values, $mids, $xpath, $data; - $skel->index_skeleton(\@values); + my @vals = ($smsg->ts, $num, $mids, $xpath, $data); + $skel->index_skeleton(\@vals); $doc->add_boolean_term('Q' . $_) foreach @$mids; $doc->add_boolean_term('XNUM' . $num) if defined $num; $doc_id = $self->{xdb}->add_document($doc); |