diff options
author | Eric Wong <e@80x24.org> | 2015-08-16 08:14:40 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-08-16 08:19:53 +0000 |
commit | eb5f82b20944d780ac3b2ff9a926c023da9468fd (patch) | |
tree | 993d57db192d18dd46216adc66158135e43860d7 /lib/PublicInbox/Search.pm | |
parent | 7745ac38a4e2d4ae42e7192183f65c84a8e5662a (diff) | |
download | public-inbox-eb5f82b20944d780ac3b2ff9a926c023da9468fd.tar.gz |
Quick-and-dirty wiring up of to Subject: paths. This may prove more memorizable and easier-to-share than /t/$MESSAGE_ID.html links, but less strict. This changes our schema version to 1, since we now use lower-case subject paths.
Diffstat (limited to 'lib/PublicInbox/Search.pm')
-rw-r--r-- | lib/PublicInbox/Search.pm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 39b06b0a..f4f00b25 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -12,7 +12,10 @@ use PublicInbox::MID qw/mid_clean mid_compressed/; use constant { TS => 0, - SCHEMA_VERSION => 0, + # SCHEMA_VERSION history + # 0 - initial + # 1 - subject_path is lower-cased + SCHEMA_VERSION => 1, LANG => 'english', QP_FLAGS => FLAG_PHRASE|FLAG_BOOLEAN|FLAG_LOVEHATE|FLAG_WILDCARD, }; @@ -209,6 +212,12 @@ sub query { $self->do_enquire($query, $opts); } +sub get_subject_path { + my ($self, $path, $opts) = @_; + my $query = $self->qp->parse_query("path:$path", 0); + $self->do_enquire($query); +} + # given a message ID, get replies to a message sub get_replies { my ($self, $mid, $opts) = @_; @@ -461,13 +470,13 @@ sub merge_threads { # normalize subjects so they are suitable as pathnames for URLs sub subject_path { - my ($subj) = @_; + my $subj = pop; $subj =~ s/\A\s+//; $subj =~ s/\s+\z//; $subj =~ s/^(?:re|aw):\s*//i; # remove reply prefix (aw: German) $subj =~ s![^a-zA-Z0-9_\.~/\-]+!_!g; - $subj; + lc($subj); } sub do_cat_mail { |