diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2026-05-06 19:42:33 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2026-05-06 19:42:33 +0800 |
| commit | 819bf74c2841fabdcc481e12e13615d48a92cb7f (patch) | |
| tree | 00ba8c9105a96d88536f50f8ef96e838c04408e3 /_site/cgi-bin/indexer.pl | |
| parent | eddb76ad8c6e850c7e24f97ff27a185d48b104ee (diff) | |
| download | site-search-bm-819bf74c2841fabdcc481e12e13615d48a92cb7f.tar.gz | |
Change directory structure and add benchmark runner.
Diffstat (limited to '_site/cgi-bin/indexer.pl')
| -rw-r--r-- | _site/cgi-bin/indexer.pl | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/_site/cgi-bin/indexer.pl b/_site/cgi-bin/indexer.pl deleted file mode 100644 index 0dcd7e2..0000000 --- a/_site/cgi-bin/indexer.pl +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use Storable qw(nstore); -use HTML::Entities qw(decode_entities); - -# --- Configuration --- -my $built_site_dir = '../log'; -my $output_file = 'search_index.dat'; -my %index; - -print "Building search index from $built_site_dir...\n"; - -foreach my $path (glob("$built_site_dir/*/index.html")) { - next unless open(my $fh, '<:utf8', $path); - my $html = do { local $/; <$fh> }; - close($fh); - - # Extract Title and Main Content - my ($title) = $html =~ m|<title>(.*?)</title>|is || "Unknown"; - my ($main) = $html; - - # Normalize path - my $url = $path; - - $index{$url} = { - t => $title || "Untitled", - c => $main - }; -} - -nstore(\%index, $output_file); -printf("Index complete: %d files (%.2f KB)\n", scalar(keys %index), (-s $output_file) / 1024); |
