+ # 240 is the number used by omindex to decide when to hash an
+ # overlong term. This does not use a compatible hash method though.
+ if (length $page > 240) {
+ eval q{use Digest::SHA1};
+ if ($@) {
+ debug("search: ".sprintf(gettext("need Digest::SHA1 to index %s"), $page)) if $@;
+ return undef;
+ }
+
+ # Note no colon, therefore it's guaranteed to not overlap
+ # with a page with the same name as the hash..
+ return "U".lc(Digest::SHA1::sha1_hex($page));
+ }
+ else {
+ return "U:".$page;
+ }
+}