An Indexing Demonstration
The following interface performs the tasks below:
- Add the URL to the inverted list if its contents include the keyword.
- If the keyword does not exist in the inverted list, add it and the URL to the list if the URL contents include the keyword.
- List the index of the keyword.
If the keyword is empty, list all indexes.
This demonstration implements an inverted list by using the following statements:
SQL> CREATE TABLE keywords (
2 kwID INT AUTO_INCREMENT PRIMARY KEY,
3 keyword VARCHAR(64) );
SQL> CREATE TABLE url_title (
2 urlID INT AUTO_INCREMENT PRIMARY KEY,
3 url VARCHAR(128),
4 title VARCHAR(128) );
SQL> CREATE TABLE www_index (
2 kwID INT,
3 urlID INT,
4 PRIMARY KEY ( kwID, urlID ),
5 FOREIGN KEY ( kwID ) REFERENCES keywords ( kwID ),
6 FOREIGN KEY ( urlID ) REFERENCES url_title ( urlID ) );
Note that this database design may not meet the requirements of the Exercise I.
The standalone demonstration can be found from here.