6 |
use HTML::Pager; |
use HTML::Pager; |
7 |
use HTML::FillInForm; |
use HTML::FillInForm; |
8 |
use SWISH; |
use SWISH; |
9 |
use Unicode::String qw(utf8 utf16); |
use Unicode::MapUTF8 qw(to_utf8 from_utf8 utf8_supported_charset); |
|
require Unicode::Map8; |
|
10 |
use DBI; |
use DBI; |
11 |
|
|
12 |
# configuration options |
# configuration options |
13 |
# FIX: they really should go in configuration file! |
# FIX: they really should go in configuration file! |
14 |
my $TEMPLATE_PATH = '/data/webpac/template_html'; |
my $TEMPLATE_PATH = '/data/webpac/template_html'; |
15 |
my $CHARSET = 'ISO-8859-2'; |
my $CHARSET = 'ISO-8859-2'; |
16 |
my $SWISH = '/data/swish/swish-e'; |
my $SWISH = '/usr/local/bin/swish-e'; |
17 |
my $INDEX = '/data/webpac/index/isis.index'; |
my $INDEX = '/data/webpac/index/isis.index'; |
18 |
my $MAX_HITS = 500; |
my $MAX_HITS = 500; |
19 |
my $ON_PAGE = 10; |
my $ON_PAGE = 10; |
90 |
|
|
91 |
my $tmpl = $self->load_tmpl('results.html'); |
my $tmpl = $self->load_tmpl('results.html'); |
92 |
|
|
|
my $l2_map = Unicode::Map8->new($CHARSET) || die; |
|
|
my $us = Unicode::String->new(); |
|
|
|
|
93 |
# call swish |
# call swish |
94 |
my $sh = SWISH->connect('Fork', |
my $sh = SWISH->connect('Fork', |
95 |
prog => $SWISH, |
prog => $SWISH, |
98 |
results => sub { |
results => sub { |
99 |
my ($sh,$hit) = @_; |
my ($sh,$hit) = @_; |
100 |
|
|
|
$us->utf8($hit->swishtitle); |
|
|
|
|
101 |
push @swish_results, { |
push @swish_results, { |
102 |
nr => ($#swish_results + 2), |
nr => ($#swish_results + 2), |
103 |
path => $hit->swishdocpath, |
path => $hit->swishdocpath, |
104 |
title => $l2_map->to8($us->utf16), |
title => to_utf8({ -string => $hit->swishtitle, -charset => $CHARSET }), |
105 |
rank => $hit->swishrank }; |
rank => $hit->swishrank }; |
106 |
|
|
107 |
# my @fields = $hit->field_names; |
# my @fields = $hit->field_names; |