CPAN::Search::Lite::Populate - create and populate database tables |
CPAN::Search::Lite::Populate - create and populate database tables
This module is responsible for creating the tables
(if setup
is passed as an option) and then for
inserting, updating, or deleting (as appropriate) the
relevant information from the indices of
CPAN::Search::Lite::Info and CPAN::Search::Lite::PPM and the
state information from CPAN::Search::Lite::State. It does
this through the insert
, update
, and delete
methods associated with each table.
Note that the tables are created with the setup
argument
passed into the new
method when creating the
CPAN::Search::Lite::Index
object; existing tables will be
dropped.
The tables used are described below.
This table contains module information, and is created as
mod_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT dist_id SMALLINT UNSIGNED NOT NULL mod_name VARCHAR(100) NOT NULL mod_abs TINYTEXT doc bool mod_vers VARCHAR(10) dslip CHAR(5) chapterid TINYINT(2) UNSIGNED PRIMARY KEY (mod_id) FULLTEXT (mod_abs) KEY (dist_id) KEY (mod_name(100))
dists
table.
Foo::Bar
in the dist_name
distribution.
Foo::Bar
in the dist_name
distribution.
This table contains distribution information, and is created as
dist_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT stamp TIMESTAMP(8) auth_id SMALLINT UNSIGNED NOT NULL dist_name VARCHAR(90) NOT NULL dist_file VARCHAR(110) NOT NULL dist_vers VARCHAR(20) dist_abs TINYTEXT size MEDIUMINT UNSIGNED NOT NULL birth DATE NOT NULL readme bool changes bool meta bool install bool PRIMARY KEY (dist_id) FULLTEXT (dist_abs) KEY (auth_id) KEY (dist_name(90))
auths
table.
dist_name
will be My-Distname
).
dist_vers
will be 0.22
).
Foo::Bar
, if present, will
be used for the Foo-Bar
distribution.
This table contains CPAN author information, and is created as
auth_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT cpanid VARCHAR(20) NOT NULL fullname VARCHAR(40) NOT NULL email TINYTEXT PRIMARY KEY (auth_id) FULLTEXT (fullname) KEY (cpanid(20))
This table contains chapter information associated with
distributions. PAUSE allows one, when registering modules,
to associate a chapter id with each module (see the mods
table). This information is used here to associate chapters
(and subchapters) with distributions in the following manner.
Suppose a distribution Quantum-Theory
contains a module
Beta::Decay
with chapter id 55
, and
another module Laser
with chapter id 87
. The
Quantum-Theory
distribution will then have two
entries in this table - chapterid
of 55 and
subchapter
of Beta, and chapterid
of 87 and
subchapter
of Laser.
The table is created as follows.
chap_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT chapterid TINYINT UNSIGNED NOT NULL dist_id SMALLINT UNSIGNED NOT NULL subchapter TINYTEXT KEY (dist_id)
dists
table.
This table lists the prerequisites of the distribution,
as found in the META.yml file (if supplied - note that
only relatively recent versions of ExtUtils::MakeMaker
or Module::Build
generate this file when making a
distribution). The table is created as
req_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT dist_id SMALLINT UNSIGNED NOT NULL mod_id SMALLINT UNSIGNED NOT NULL req_vers VARCHAR(10) KEY (dist_id)
dists
table.
mods
table.
This table contains information on Win32 ppm
packages available in the repositories specified
in $repositories
of the CPAN::Search::Lite::Util manpage.
The table is created as
ppm_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT dist_id SMALLINT UNSIGNED NOT NULL rep_id TINYINT(2) UNSIGNED NOT NULL ppm_vers VARCHAR(20) KEY (dist_id)
dists
table.
$repositories
data structure.
This table contains information on the Win32 ppm
repositories specified in $repositories
of
the CPAN::Search::Lite::Util manpage.
The table is created as
rep_id SMALLINT UNSIGNED NOT NULL abs TINYTEXT browse TINYTEXT perl VARCHAR(10) KEY (rep_id)
rep_id
of the ppms
table.
This contains information on the chapters. The table is created as
chapterid SMALLINT UNSIGNED NOT NULL chap_link TINYTEXT KEY (chapterid)
dists
table.
This is the primary (unique) key of the table, and
corresponds to the chapterid
of the dists
, mods
,
and chaps
table.
chapterid
corresponds
to (eg, File_Handle_Input_Output
).
When uploading a module to PAUSE, there exists an option to assign it to one of 24 broad categories. However, many modules have not been assigned such a category, for one reason or another. When populating the tables, the AI::Categorizer module is used to guess a possible category for those modules that haven't been assigned one, based on a training set based on the modules that have been assigned a category (see <AI::Categorizer> for general details). If this guess is above a configurable threshold (see the CPAN::Search::Lite::Index manpage, the guess is accepted and subsequently inserted into the database, as well as updating the categories associated with the module's distribution.
the CPAN::Search::Lite::Index manpage
CPAN::Search::Lite::Populate - create and populate database tables |