diff options
author | Eric Wong <e@80x24.org> | 2019-05-15 01:18:07 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-05-15 01:18:52 +0000 |
commit | 70caf43a131fc5bdf7104f82f2acee9d5353d6a8 (patch) | |
tree | 54691cbe7b16adf0fd8406d2a3a514bbd19741ce /lib/PublicInbox/OverIdx.pm | |
parent | e981538130dd6d285392f4316328edbadab0d330 (diff) | |
download | public-inbox-70caf43a131fc5bdf7104f82f2acee9d5353d6a8.tar.gz |
www: use Inbox->over where appropriate
We don't need to rely on Xapian search functionality for the majority of the WWW code, even. subject_normalized is moved to SearchMsg, where it (probably) makes more sense, anyways.
Diffstat (limited to 'lib/PublicInbox/OverIdx.pm')
-rw-r--r-- | lib/PublicInbox/OverIdx.pm | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm index bb3068dd..9fc51e5f 100644 --- a/lib/PublicInbox/OverIdx.pm +++ b/lib/PublicInbox/OverIdx.pm @@ -14,7 +14,7 @@ use base qw(PublicInbox::Over); use IO::Handle; use DBI qw(:sql_types); # SQL_BLOB use PublicInbox::MID qw/id_compress mids references/; -use PublicInbox::SearchMsg; +use PublicInbox::SearchMsg qw(subject_normalized); use Compress::Zlib qw(compress); use PublicInbox::Search; @@ -237,6 +237,15 @@ sub parse_references ($$$) { \@keep; } +# normalize subjects so they are suitable as pathnames for URLs +# XXX: consider for removal +sub subject_path ($) { + my ($subj) = @_; + $subj = subject_normalized($subj); + $subj =~ s![^a-zA-Z0-9_\.~/\-]+!_!g; + lc($subj); +} + sub add_overview { my ($self, $mime, $bytes, $num, $oid, $mid0) = @_; my $lines = $mime->body_raw =~ tr!\n!\n!; @@ -252,7 +261,7 @@ sub add_overview { my $subj = $smsg->subject; my $xpath; if ($subj ne '') { - $xpath = PublicInbox::Search::subject_path($subj); + $xpath = subject_path($subj); $xpath = id_compress($xpath); } my $dd = $smsg->to_doc_data($oid, $mid0); |