# This is script for MySQL to 
# create database structure for UdmSearch 3.x
# use: "mysql database <create.txt"
#


#DROP TABLE url;
#DROP TABLE dict;
#DROP TABLE robots;
#DROP TABLE stopword;


CREATE TABLE dict (
  url_id int(11) DEFAULT '0' NOT NULL,
  word varchar(32) DEFAULT '' NOT NULL,
  intag int(11) 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(48) DEFAULT '' NOT NULL,
  title varchar(128) DEFAULT '' NOT NULL,
  txt varchar(255) DEFAULT '' NOT NULL,
  docsize int(11) DEFAULT '0' NOT NULL,
  last_index_time INT NOT NULL,
  next_index_time INT NOT NULL,
  last_mod_time INT NOT NULL,
  referrer int(11) DEFAULT '0' NOT NULL,
  tag varchar(11) DEFAULT '0' NOT NULL,
  hops int(11) DEFAULT '0' NOT NULL,
  category varchar(11) DEFAULT '' NOT NULL,
  keywords varchar(255) DEFAULT '' NOT NULL,
  description varchar(100) DEFAULT '' NOT NULL,
  crc32 int(11) DEFAULT '0' NOT NULL,
  lang varchar(2) DEFAULT '' NOT NULL,
  PRIMARY KEY (rec_id),
  UNIQUE url (url),
  KEY key_crc (crc32)
);

