当前位置: 首页 > 图文教程 > 网络编程 > ASP > 制作一个个人搜索引擎(源码)

ASP
把HTML表单提交的数据转化成XML文件
全球IP地址查询完整版
一个把WORD转换成HTML的程序
天气预报的小偷,可以偷到全国24小时城市天气预报.
显示页面show.asp--基于web的QQ程序1
接收信息页面inform.asp--基于web的QQ程序2
发送信息页面send.asp--基于web的QQ程序3
关于客户端用ASP参生报表
关于客户端用ASP参生报表(高级篇)
利用ASP在线维护数据库
使用JScript.NET创建asp.net页面(一)
使用JScript.NET创建asp.net页面(二)
使用JScript.NET创建asp.net页面(三)
使用JScript.NET创建asp.net页面(四)
使用JScript.NET创建asp.net页面(五)
使用JScript.NET创建asp.net页面(六)
使用JScript.NET创建asp.net页面(七)
创建一个Web投票系统
W3 Jmail中文使用说明
bbs的数据结构和存储过程(一)

ASP 中的 制作一个个人搜索引擎(源码)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 58 ::
收藏到网摘: n/a

  <%
Response.Buffer=True

'
' OneFile Search Engine (ofSearch v1.0)
' Copyright ?000 Sixto Luis Santos <[email protected]>
' All Rights Reserved
'
' Note:
' This program is freeware. This program is NOT in the Public Domain.
' You can freely use this program in your own site.
'
' You cannot re-distribute the code, by any means,
' without the express written authorization by the author.
'
' Use this program at your own risk.
'


' Globals --------------------------------------
' ----------------------------------------------

Const ValidFiles = "htmltxt"
Const RootFld = "./"

Dim Matched
Dim Regex
Dim GetTitle
Dim fs
Dim rfLen
dim RootFolder
Dim DocCount
Dim DocMatchCount
Dim MatchedCount

' ----------------------------------------------
' Procedure: SearchFiles()
' ----------------------------------------------
Public Sub SearchFiles(FolderPath)
Dim fsFolder
Dim fsFolder2
Dim fsFile
Dim fsText
Dim FileText
Dim FileTitle
Dim FileTitleMatch
Dim MatchCount
Dim OutputLine

' Get the starting folder
Set fsFolder = fs.GetFolder(FolderPath)
' Iterate thru every file in the folder
For Each fsFile In fsFolder.Files
    ' Compare the current file extension with the list of valid target files
    If InStr(1, ValidFiles, Right(fsFile.Name, 3), vbTextCompare) > 0 Then
     DocCount = DocCount + 1
     ' Open the file to read its content
        Set fsText = fsFile.OpenAsTextStream
            FileText = fsText.ReadAll
            ' Apply the regex search and get the count of matches found
            MatchCount = Regex.Execute(FileText).Count
            MatchedCount = MatchedCount + MatchCount
            If  MatchCount > 0 Then
                DocMatchCount = DocMatchCount + 1
                ' Apply another regex to get the html document's title
                Set FileTitleMatch = GetTitle.Execute(FileText)
                If FileTitleMatch.Count > 0 Then
                    ' Strip the title tags
                    FileTitle = Trim(replace(Mid(FileTitleMatch.Item(0),8),"</title>","",1,1,1))
                    ' In case the title is empty
                    If FileTitle = "" Then
                     FileTitle = "No Title (" & fsFile.Name & ")"
                    End If
                Else