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

2016-01-29 17:16 82 1 收藏

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

【 tulaoshi.com - ASP 】

  <%
Response.Buffer=True

'
' OneFile Search Engine (ofSearch v1.0)
' Copyright ?000 Sixto Luis Santos <sixtos@prtc.net
' 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
                 

来源:http://www.tulaoshi.com/n/20160129/1500836.html

延伸阅读
标签: PHP
  模板生成,文件名:muobanshen.php <html <head <title测试</title <meta http-equiv="Content-Type" content="text/html; charset=gb2312" <link rel="stylesheet" href="image/yifancss.css" </head <body leftmargin="0" topmargin="0"...
标签: Web开发
随便GOOGLE的地图是用AJAX做的,但是GOOGLE并不支持AJAX,大多数搜索引擎也不支持,所以假如用AJAX做网站的话,那网站的排名,流量可想而知了,虽然说以后搜索引擎发展可能支持,但是那要到什么时候那???有一种解决的技术就是双页面,就是用AJAX做一套,用JSP或者ASP或者别的写一套页面,可想而知那开发速度就不用我说了。而且就中国目前的网...
标签: PHP
编者按:这是一篇精彩的编程教学文章,不但详细地剖析了搜索引擎的原理,也提供了笔者自己对使用PHP编制搜索引擎的一些思路。整篇文章深入浅出,相信无论是高手还是菜鸟,都能从中得到不少的启发。 谈到网页搜索引擎时,大多数人都会想到雅虎。的确,雅虎开创了一个互联网络的搜索时代。然而,雅虎目前用于搜索网页的技...
标签: PHP
  模板提交,文件名:muban.php <html <head <titleUntitled Document</title <meta http-equiv="Content-Type" content="text/html; charset=gb2312" </head <body bgcolor="#FFFFFF" background="image/b-graingr1.jpg" <form method="post" action...
标签: PHP
  网站管理,文件名:guanli.php <html <head <titleUntitled Document</title <meta http-equiv="Content-Type" content="text/html; charset=gb2312" </head <body bgcolor="#FFFFFF" background="image/b-graingr2.jpg" <table width="775" border...

经验教程

640

收藏

97
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部