Using Docbase::Indexer

Example 7.17 shows a script that uses the services of Docbase::Indexer to build both static and dynamic navigational controls for the ProductAnalysis docbase.

Example 7-17. A Docbase::Indexer Driver Script

#! perl -w

use strict;

my $app = "ProductAnalysis";

my @indexed_fields = ('company','product','analyst','duedate');

use Docbase::Docbase;
my $db = Docbase::Docbase->new($app);

use Docbase::Indexer;

my $di = Docbase::Indexer->new($db,\@indexed_fields);

$di->buildIndexStructures;

$di->buildTabbedIndexes;

$di->buildSequenceStructures;

$di->buildStaticControls;      # optional, only for static version

You could arrange to run this script after each record is added to the docbase. More likely, you’ll want to schedule it to run periodically by using a crontab entry on a Unix-like system or an AT command on NT.

Get Practical Internet Groupware now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.