SAY --- Installing Basic UdmSearch Database Objects ...
/
AUTOCOMMIT OFF
/
    CREATE TABLE dict (
       word                 VARCHAR(32) NOT NULL,
       url_id               FIXED(12) NOT NULL,
       intag                FIXED(2) NOT NULL
)
/
ALTER TABLE dict ADD PRIMARY KEY (word, url_id)  
/
IF $RC (EXISTS TABLE robots) <> 0 
THEN
/
CREATE TABLE robots (
       hostinfo             VARCHAR(127) NOT NULL,
       path                 VARCHAR(127) NOT NULL
)
/
IF $RC (EXISTS TABLE stopword) <> 0 
THEN
    BEGIN
/
CREATE TABLE stopword (
       word                 CHAR(64) NOT NULL,
       lang                 CHAR(2) NOT NULL
)
/
ALTER TABLE stopword ADD  PRIMARY KEY (word, lang) 
/
END
/
IF $RC (EXISTS TABLE url) <> 0 
THEN
    BEGIN
/
CREATE TABLE url (
       rec_id               FIXED(12) NOT NULL,
       status               FIXED(6) DEFAULT 0 NOT NULL,
       url                  VARCHAR(128) NOT NULL,
       content_type         VARCHAR(64) NULL,
       title                VARCHAR(128) NULL,
       txt                  VARCHAR(255) NULL,
       docsize              FIXED(12) NULL,
       last_index_time      FIXED(12) NULL,
       next_index_time      FIXED(12) NULL,
       last_mod_time        FIXED(12) NULL,
       referrer             FIXED(12) DEFAULT 0 NOT NULL,
       tag                  VARCHAR(10) NULL,
       hops                 FIXED(6) DEFAULT 0 NOT NULL,
       category             VARCHAR(10) NULL,
       keywords             VARCHAR(255) NULL,
       description          VARCHAR(100) NULL,
       crc32                FIXED(12) NULL,
       lang		    CHAR(2) NULL
)
/
CREATE UNIQUE INDEX XAK1url ON url
(
       url                            ASC
)
/
CREATE INDEX XIE1url ON url
(
       crc32                          ASC
)
/
CREATE INDEX rec_id_ind ON url
(
       rec_id			
)
/
CREATE INDEX next_index_time_ind ON url
(
       	next_index_time
)
/
END
/
IF $RC ( select * from domain.sequences where SEQUENCE_NAME = 'NEXT_URL_ID') <> 0
THEN
/
CREATE SEQUENCE next_url_id INCREMENT BY 1 START WITH 1
/
COMMIT