The search engine for your web site is based on the IDC facilities of IIS. Constructing the search engine is a matter of writing an idc file for each of the queries you want to be able to execute. On this site, users can search by subject, title, or author. Therefore, you will need an idc file for each of these queries.
Open a new document in your text editor. This document will allow the user to conduct a search by subject. Add the following code to specify the datasource, template, maximum number of return records, and SQL query for the subject search:
DataSource:Bookstore
Template:c:\inetsrv\scripts\project3\selected.htx
MaxRecords:21
SQLStatement:
+SELECT Titles.Title,Titles.Description,
+Titles.Price,Authors.Author,Titles.Special
+FROM Titles,Authors,[Title Author]
+WHERE Titles.Subject LIKE '%txtSubject%'
+AND Titles.ISBN=[Title Author].ISBN
+AND [Title Author].Au_ID=Authors.Au_ID
Note the MaxRecords line. This lines sets the maximum number of records that can be returned from a query. In this situation, it is 21 records. Save this file as subject.idc in the \scripts\project3 folder that you set up at the beginning of this project.
Open a new document in your text editor. This document will allow the user to conduct a search by title. Add the following code to specify the datasource, template, maximum number of return records, and SQL query for the title search:
DataSource:Bookstore
Template:c:\inetsrv\scripts\project3\selected.htx
MaxRecords:21
SQLStatement:
+SELECT Titles.Title,Titles.Description
+,Authors.Author,Titles.Price,Titles.Special
+FROM Titles,[Title Author],Authors
+WHERE Titles.Title LIKE '%txtTitle%'
+AND Titles.ISBN=[Title Author].ISBN
+AND [Title Author].Au_ID=Authors.Au_ID
Save this file as title.idc in the \scripts\project3 folder that you set up at the beginning of this project.
Open a new document in your text editor. This document will allow the user to conduct a search by author. Add the following code to specify the datasource, template, maximum number of return records, and SQL query for the author search:
DataSource:Bookstore
Template:c:\inetsrv\scripts\project3\selected.htx
MaxRecords:21
SQLStatement:
+SELECT Titles.Title,Titles.Description
+,Authors.Author,Titles.Price,Titles.Special
+FROM Titles,[Title Author],Authors
+WHERE Authors.Author LIKE '%txtAuthor%'
+AND Authors.Au_ID=[Title Author].Au_ID
+AND [Title Author].ISBN=Titles.ISBN
Save this file as author.idc in the \scripts\project3 folder that you set up at the beginning of this project.