7/26/00
 Quick Links :
home| forum | whats new | advertise | contact us




Overview
Access Database
Indexing using HTTP protocol
Indexing using FilySystemObject
Deleting URLs from Database
HTML Search Engine Form
Searching Records in the Database
Include File
Conclusion

WantJava.com


Please support our sponsors

Author : Faisal Khan.

In this article I will guide you through the steps of creating a simple but effective search engine. We will divide our work into two steps :

  • Step 1 : Create a set of ASP pages to index the site content.
  • Step 2 : Create a search engine to offer keyword specific database dependant search to our visitors.

Requirements :

  • PWS / IIS
  • Microsoft Access Database

We will begin with creating a set of ASP pages to index the site content and then insert into the database. Here you will learn how easy it practically is to deal with databases in ASP. All statements of SQL select, insert, update and delete will come into play.

Creating HTML Form Page :

We begin by creating an HTML Form page called 'addtodb.htm'. As it's name suggests you will use it to enter URLs of pages to index. So create a new HTML page and name it 'addtodb.htm' and then copy paste the following HTML code into it and then save it :

   <html>
   <head>
   <style>
      body { font-family : Verdana; font-size : 8pt; }
      input { font-family : Verdana; font-size : 8pt; height : 20; width : 250; }
   </style>
   </head>

   <body>
   Insert / Update File : ( using HTTP )
   <form action="addtodb.asp">
   <input type="text" name="look_for"><br>
   <input type="submit" value=" " style="height : 17; width : 17;"> Submit ->
   </form>

   <br><br><br>
   Insert / Update File : ( using FileSystemObject )
   <form action="addtodb_fso.asp">
   Base URL :-<br>
   <input type="text" name="base_url"><br>
   Absolute path to the File :-<br>
   <input type="text" name="look_for"><br>
   <input type="submit" value=" " style="height : 17; width : 17;"> Submit ->
   </form>

   <br><br><br>
   Delete File :
   <form action="delfromdb.asp">
   <input type="text" name="del"><br>
   <input type="submit" value=" " style="height : 17; width : 17;"> Submit ->
   </form>
   </body>
   </html>

What does Form 1 do ?

As you might have guessed by seeing the code, it offer three Forms to site admin ( you ). The first one is used to enter complete URLs including HTTP ( e.g. http://www.stardeveloper.com/default.asp ). This Form will take you to 'addtodb.asp' page which will index the page using HTTP protocol. This is the easiest and most effective way to index pages. It enables you to index any of your site pages spanning across multiple hosts. It is also useful when title, description and keyword tags info in your pages is dynamically generated.

What does Form 2 do ?

The second Form instead of asking the complete URL ( like the first Form ), asks for base URL and absolute path to the page to index. This Form is optional. You should use it only when you cannot use HTTP protocol to index site pages ( more on that ). In the base URL field, you should enter the base URL of your site e.g. http://www.yoursite.com. And in the absolute path field, you should enter the absolute path to the page on your site e.g. /default.asp. This Form will lead to 'addtodb_fso.asp' page which indexes the pages using FileSystemObject. FileSystemObject is one of the scripting objects provided to you by ASP.

What does Form 3 do ?

The third Form asks for complete URL to the page e.g. http://www.stardeveloper.com/default.asp. You should use it when you want to delete a page entry in the database. Note this action will not delete the page, instead it will delete the indexed info of that page in the database. After this action that page will not be shown in the search engine.

In the next page we will create a simple Access database to use with our Search Engine. If you have read the database tutorial, it shouldn't be a problem.



Next -> 




© 1999-2000 Faisal Khan, All rights reserved