The search engine is composed of an ASP file of an HTM file, mainly uses the FileSystemObject component to achieve the goal, the function is formidable, after modifies the interface may use directly, certainly adds a little own thing to be even better.
Searchpage.htm
The HTM file is used to pass in the condition
<HTML>
<HEAD>
<title>asp Search Engine Example </TITLE>
</HEAD>
<BODY>
<CENTER>
<form method=post action= "Search.asp" >
<table bgcolor= "#CC6633" border= "0" >
<TR>
<TD rowspan= "3" bgcolor= "#CC6633" width= "nowrap>" </TD>
<TD width= "363" nowrap> <font color= "#FFFFFF" >
<input type= "text" name= "SearchText" size= ">"
<input type= "checkbox" name= "Case" >
Highly sensitive </FONT> </TD>
<TD rowspan= "3" width= "ten" >
<input type= "Submit" value= "OK" >
<P>
<input type= "Reset" value= "clear" >
</TD>
<TD rowspan= "3" bgcolor= "#CC6633" width= "> </TD>
</TR>
<TR>
<TD width= "363" nowrap> <font color= "#FFFFFF" > Return results
<select name= "Rlength" >
<option value= "selected>" Long information </option>
<option value= > Short Message </option>
<option value= "0" > Only return connection </option>
</SELECT>
<select name= "Rresults" >
<option value= "Ten" selected>10
<option value= ">25"
<option value= ">50"
</SELECT>
</FONT>
</TD>
</TR>
<TR>
<TD width= "363" nowrap> <font color= "#FFFFFF" > must include:
<input type= "checkbox" Name= "Iimage" >
Image
<input type= "checkbox" Name= "Izips" >
Zip format
<input type= "checkbox" Name= "Ijavas" > JavaScript
</FONT>
</TD>
</TR>
</TABLE>
</FORM>
</CENTER>
<DL>
<DD> </DD>
</DL>
</BODY>
</HTML>
------------------------------------------------------------------------
ASP programs that display results
Search.asp
<HTML>
<HEAD>
<TITLE> ' <%=request ("SearchText")%> ' search results </TITLE>
</HEAD>
<BODY>
<B> ' <%=request ("SearchText")%> ' search results </B><BR>
<%
Const fsoforreading = 1
Dim objfile, Objfolder, Objsubfolder, objTextStream
Dim bolcase, Bolfilefound, Boltagfound
Dim Strcount, Strdetag, Strext, strfile, Strcontent, Strroot, Strtag, StrText, Strtitle, Strtitlel
Dim reqimage, Reqjavas, Reqlength, Reqnumber, Reqzip
strfile = ". asp. htm. html. js. txt. css"
Strroot = "/"
StrText = Request ("SearchText")
Strtag = Chr (Panax) & Chr (62)
Bolfilefound = False
Boltagfound = False
If Request ("case") = ' on ' Then bolcase = 0 Else bolcase = 1
If Request ("iimage") = "on" Then reqimage = "If Request ("izips") = "on" Then reqzips = ". zip" Else reqimage = ""
If Request ("ijavas") = "on" Then Reqjavas = "JavaScript" Else reqimage = ""
If Request ("rresults") = "Ten" Then Reqnumber = 10
If Request ("rresults") = "Then" Reqnumber = 25
If Request ("rresults") = "Then" Reqnumber = 50
Reqlength = Request ("Rlength")
Set objFSO = Server.CreateObject ("Scripting.FileSystemObject")
Set objfolder = Objfso.getfolder (Server.MapPath (strroot))
Schsubfol (objfolder)
Sub Schsubfol (objfolder)
For each objfile in Objfolder.files
If Strcount + 1 > reqnumber or StrText = "" Then Exit Sub
If response.isclientconnected Then
Set objTextStream = objFSO.OpenTextFile (objfile.path,fsoforreading)
Strcontent = Objtextstream.readall
If INSTR (1, strcontent, Strtag, bolcase) Then
Else
If Mid (Objfile.name, Len (objfile.name)-1, 1) = "." Then Strext = Mid (Objfile.name, Len (objfile.name)-1, 2)
If Mid (Objfile.name, Len (Objfile.name)-2, 1) = "." Then Strext = Mid (Objfile.name, Len (objfile.name)-2, 3)
If Mid (Objfile.name, Len (Objfile.name)-3, 1) = "." Then Strext = Mid (Objfile.name, Len (objfile.name)-3, 4)
If Mid (Objfile.name, Len (Objfile.name)-4, 1) = "." Then Strext = Mid (Objfile.name, Len (Objfile.name)-4, 5)
If InStr (1, strcontent, StrText, Bolcase) and _
InStr (1, Strcontent, Reqimage, 1) and _
InStr (1, Strcontent, Reqzips, 1) and _
InStr (1, Strcontent, Reqjavas, 1) and _
INSTR (1, strfile, Strext, 1) Then
If Instr (1, strcontent, "<TITLE>", 1) Then strtitle = Mid (Strcontent, INSTR (1 , Strcontent, "<TITLE>", 1) + 7, InStr (1, strcontent, "</TITLE>", 1)) Else strtitle = "Unnamed"
Strcount = strcount + 1
Response.Write "<DL><DT><B><I>" & Strcount & "</I></B>-<a href=" & Objfile.path & ">" & strtitle & "</A></A></DT><BR><DD>"
Strtitlel = INSTR (1, strcontent, "</TITLE>", 1)-InStr (1, strcontent, "<TITLE>", 1) + 7
Strdetag = ""
Boltagfound = False
Do While INSTR (Strcontent, "<")
Boltagfound = True
Strdetag = Strdetag & "" & Left (Strcontent, InStr (strcontent, "<")-1)
Strcontent = MID (strcontent, InStr (strcontent, ">") + 1)
Loop
Strdetag = Strdetag & strcontent
If not boltagfound Then Strdetag = strcontent
If reqlength = "0" Then Response.Write Objfile.path & "</DD></DL>" Else Response.Write Mid (Strdetag, Strti Tlel, Reqlength) & "... <br><b><font size= ' 2 ' >url:" & Objfile.path & "-Last Modified:" & obj File.datelastmodified & "-& FormatNumber (objfile.size/1024) &" Kbytes</font></b></dd ></DL> "
Bolfilefound = True
End If
Objtextstream.close
End If
End If
Next
End Sub
For each objsubfolder in Objfolder.subfolders
Schsubfol (Objsubfolder)
Next
If not Bolfilefound then Response.Write "No matching results"
If Bolfilefound Then Response.Write "<B> Search End </B>"
Set objTextStream = Nothing
Set objfolder = Nothing
Set objFSO = Nothing
%>
</BODY></HTML>