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

2018-09-06 11:14

阅读:458

  <%
Response.Buffer=True


OneFile Search Engine (ofSearch v1.0)
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 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
MatchedCount = MatchedCount + MatchCount
0 Then
DocMatchCount = DocMatchCount + 1
Apply another regex to get the html documents title
Set FileTitleMatch = GetTitle.Execute(FileText)
0 Then
Strip the title tags
,,1,1,1))


评论


亲,登录后才可以留言!