# This is script for MySQL to 
# create database structure for UdmSearch 3.0.7, innominate NewsArchive Version 1.2.1
# use: "mysql database <create.txt"
#
#DROP table url;
#DROP table dict;
#DROP table robots;
#DROP table stopword;
#DROP TABLE thread;


CREATE TABLE dict (
  url_id int(11) DEFAULT '0' NOT NULL,
  word varchar(32) DEFAULT '' NOT NULL,
  intag tinyint(4) DEFAULT '0' NOT NULL,
  KEY url_id (url_id),
  KEY word_url (word)
);

CREATE TABLE robots (
  hostinfo varchar(127) DEFAULT '' NOT NULL,
  path varchar(127) DEFAULT '' NOT NULL
);


CREATE TABLE stopword (
  word char(32) DEFAULT '' NOT NULL,
  lang char(2) DEFAULT '' NOT NULL,
  PRIMARY KEY (word, lang)
);


CREATE TABLE url (
  rec_id int(11) DEFAULT '0' NOT NULL auto_increment,
  status int(11) DEFAULT '0' NOT NULL,
  url varchar(128) DEFAULT '' NOT NULL,
  content_type varchar(32) DEFAULT '' NOT NULL,
  last_modified varchar(32) DEFAULT '' NOT NULL,
  title varchar(128) DEFAULT '' NOT NULL,
  txt text ,
  docsize int(11) DEFAULT '0' NOT NULL,
  last_index_time INT NOT NULL,
  next_index_time INT NOT NULL,
  referrer int(11) DEFAULT '0' NOT NULL,
  tag int(11) DEFAULT '0' NOT NULL,
  hops int(11) DEFAULT '0' NOT NULL,
  keywords varchar(255) DEFAULT '' NOT NULL,
  description text,
  crc varchar(33) DEFAULT '' NOT NULL,
  lang varchar(2) DEFAULT '' NOT NULL,
  header_date datetime,	
  header_subj varchar(255) DEFAULT '' NOT NULL,	
  header_from varchar(255) DEFAULT '' NOT NULL,	
  header_group varchar(255) DEFAULT '' NOT NULL,	
  header_refs text NOT NULL DEFAULT '',
  msg_id char(255) NOT NULL DEFAULT '',	
  PRIMARY KEY (rec_id),
  UNIQUE url (url),
  KEY key_crc (crc(8)),
  INDEX msg_id_idx (msg_id)
);

CREATE TABLE thread(
	parent int(11) NOT NULL DEFAULT '0',
	child  int(11) NOT NULL DEFAULT '0',
	KEY parent_key (parent),
	KEY child_key  (child)
);

