-my $configured=0;
-sub estcfg () { #{{{
- return if $configured;
- $configured=1;
-
- my $estdir="$config{wikistatedir}/hyperestraier";
- my $cgi=IkiWiki::basename($config{cgiurl});
- $cgi=~s/\..*$//;
- open(TEMPLATE, ">:utf8", "$estdir/$cgi.tmpl") ||
- error("write $estdir/$cgi.tmpl: $!");
- print TEMPLATE IkiWiki::misctemplate("search",
- "<!--ESTFORM-->\n\n<!--ESTRESULT-->\n\n<!--ESTINFO-->\n\n",
- baseurl => IkiWiki::dirname($config{cgiurl})."/");
- close TEMPLATE;
- open(TEMPLATE, ">$estdir/$cgi.conf") ||
- error("write $estdir/$cgi.conf: $!");
- my $template=template("estseek.conf");
- eval q{use Cwd 'abs_path'};
- $template->param(
- index => $estdir,
- tmplfile => "$estdir/$cgi.tmpl",
- destdir => abs_path($config{destdir}),
- url => $config{url},
- );
- print TEMPLATE $template->output;
- close TEMPLATE;
- $cgi="$estdir/".IkiWiki::basename($config{cgiurl});
- unlink($cgi);
- my $estseek = defined $config{estseek} ? $config{estseek} : '/usr/lib/estraier/estseek.cgi';
- symlink($estseek, $cgi) ||
- error("symlink $estseek $cgi: $!");
-} # }}}
-
-sub estcmd ($;@) { #{{{
- my @params=split(' ', shift);
- push @params, "-cl", "$config{wikistatedir}/hyperestraier";
- if (@_) {
- push @params, "-";
- }
-
- my $pid=open(CHILD, "|-");
- if ($pid) {
- # parent
- foreach (@_) {
- print CHILD "$_\n";
+sub pageterm ($) {
+ my $page=shift;
+
+ # 240 is the number used by omindex to decide when to hash an
+ # overlong term. This does not use a compatible hash method though.
+ eval q{use Encode};
+ if (length encode_utf8($page) > 240) {
+ eval q{use Digest::SHA};
+ if ($@) {
+ debug("search: ".sprintf(gettext("need Digest::SHA to index %s"), $page)) if $@;
+ return undef;