In part 1, the article discussed document based searches that display results based on the number of search
words found in each document. This article is an extension that ranks based on number of search words found
plus number of occurrences of each search word in the document.
To search for php tutorials and examples, the following table shows the title and occurrence of each search
word in the document. Common words like is, was, and etc. are removed from the search constraints by the program.
So in this example, we have three search words, php, tutorials and examples.
Article #203 has the highest occurrence and it is given rank 1. Similarly ranking is given for other results.
Building The Database:
The database consists of three tables. Document Table, Keyword Table and Link Table. Document Table holds
articles title, and abstract. Keyword Table holds keyword and the keyword field is indexed. Link Table holds keyword
id, content id, and occurrences.
The SQL Statement for creating these three tables are shown below.
CREATE TABLE content (
contid mediumint NOT NULL auto_increment,
title text NOT NULL,
abstract longtext NOT NULL,
PRIMARY KEY (contid)