|
This tutorial demonstrates how to build a paged
search engine that will search through a selectedset of folders on a web
site, returning a list of files that contain the text entered by the
searcher.
Author: 4GuysFromRolla Code: ASP 2.0 & VBScript |
| |
Overall Rating:
 User Rated
| |
not working  Written by Anonymous User (#1640-196) from BH (Wednesday, July 21, 2004)
 |
Strengths: no comment Weaknesses: no comment Details: I used these codes in vb, it works fine in win2000 and winxp but not in win98. Plz tell me what may the reason. Review Based On: using demo only |
Great Script!  Written by Anonymous User from BC, Canada (Wednesday, March 15, 2000)
 |
Strengths: no comment Weaknesses: no comment Details: This is the best 'simple' ASP site search engine I have found. All the asp code resides in a single page and there are no components to install. Works great as well!
<BR><BR>
Some areas that may give setup problems and should be better clarified:
<BR><BR>
1.<BR>
Function FormatURL(strPath)<BR>
'Cut off everything before wwwroot and replace all \ with /<BR>
Dim iPos<BR>
iPos = InStr(1,strPath,"wwwroot",1)<BR><BR>
Dim str<BR>
str = Mid(strPath,iPos+7,Len(strPath))<BR><BR>
FormatURL = Replace(str,"\","/")<BR>
End Function<BR><BR>
-> If your root is not wwwroot be sure to change the info in iPos and str to suit your server<BR><BR>
2.<BR>
'Do we need to search this file?<BR>
If UCase(Right(objFile.Name,6)) = ".SHTML" then<BR>
If bolLFFound then<BR>
if objFile.Size > 0 then<BR>
'Read the contents of the file into a string variable<BR>
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")<BR>
Set objTextStream = objFSO.OpenTextFile(objFile.Path,1)<BR>
strContents = objTextStream.ReadAll<BR>
objTextStream.Close<BR>
Set objFSO = Nothing<BR><BR>
'... continued in next code block ...<BR><BR>
--> if you are looking at a different file extension don't forget to modify the line:<BR>
"If UCase(Right(objFile.Name,6)) = ".SHTML" then"<BR><BR>
ie for .htm pages change to:<BR>
"If UCase(Right(objFile.Name,4)) = ".HTM" then"<BR><BR>
The code from this asp is well layed out and is good to look through even if you don't need a search engine...some snippets gave me insight into solutions to other ideas I had been mulling with!
|
| |
|