]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/search.pm
Merge branch 'master' into autoconfig
[ikiwiki.git] / IkiWiki / Plugin / search.pm
index 284f477fae5b32f63f9c9159f06c4af84dea2acd..ff18e1faf4eccd4119dcb1e6a4128c62cec41396 100644 (file)
@@ -7,13 +7,25 @@ use strict;
 use IkiWiki 2.00;
 
 sub import { #{{{
+       hook(type => "getsetup", id => "search", call => \&getsetup);
        hook(type => "checkconfig", id => "search", call => \&checkconfig);
        hook(type => "pagetemplate", id => "search", call => \&pagetemplate);
-       hook(type => "sanitize", id => "search", call => \&index);
+       hook(type => "postscan", id => "search", call => \&index);
        hook(type => "delete", id => "search", call => \&delete);
        hook(type => "cgi", id => "search", call => \&cgi);
 } # }}}
 
+sub getsetup () { #{{{
+       return
+               omega_cgi => {
+                       type => "string",
+                       default => "/usr/lib/cgi-bin/omega/omega",
+                       description => "path to the omega cgi program",
+                       safe => 0, # external program
+                       rebuild => 0,
+               },
+} #}}}
+
 sub checkconfig () { #{{{
        foreach my $required (qw(url cgiurl)) {
                if (! length $config{$required}) {
@@ -48,8 +60,6 @@ my $scrubber;
 my $stemmer;
 sub index (@) { #{{{
        my %params=@_;
-       
-       return $params{content} if $IkiWiki::preprocessing{$params{destpage}};
 
        setupfiles();
 
@@ -125,15 +135,13 @@ sub index (@) { #{{{
        $tg->index_text($caption, 2);
        $tg->index_text($title, 2) if $title ne $caption;
        $tg->index_text($toindex);
-       $tg->index_text(lc($title), 1, "ZS"); # for title:foo
+       $tg->index_text(lc($title), 1, "S"); # for title:foo
        foreach my $link (@{$links{$params{page}}}) {
-               $tg->index_text(lc($link), 1, "ZLINK"); # for link:bar
+               $tg->index_text(lc($link), 1, "XLINK"); # for link:bar
        }
 
        $doc->add_term($pageterm);
        $db->replace_document_by_term($pageterm, $doc);
-
-       return $params{content};
 } #}}}
 
 sub delete (@) { #{{{