国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 編程設計 > 正文

如何實現全文檢索?

2020-06-19 13:42:04
字體:
來源:轉載
供稿:網友

<%@ LANGUAGE="VBscript" %>
  <html>
  <head>
  <meta NAME="GENERATOR" Content="Microsoft FrontPage 3.0">
  <meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb_2312-80">
  <title>星河影動之全文檢索</title>
  <meta name="Microsoft Border" content="tl, default">

</head>
   <body BGPROPERTIES="FIXED" BGCOLOR="#00FFFF">

<%
  mousepointer=13
  Set Conn1 = Server.CreateObject("ADODB.Connection")
  conn1.open "DSN=intels"
  Set rcst1 = conn1.execute("select * from pages_catalogue")
  sch_str=request.form("text1")
  doubbytes=len(sch_str)/2
  sch_str=left(sch_str,doubbytes)

' 匹配字串的長度.預處理Request取得的數據(用戶輸入的有用信息), 通過計算有效信息長度來截取所需的字串.我們也可以在輸入字串后附加一標志字符(如#chr(7))來處理.
  Response.Write "<CENTER>檢索結果<HR><Br>"
  Dim result
  result =false
  Response.Write "<UL>"
  do while not rcst1.eof
  tit=rcst1.fields("file_title")
  fn=rcst1.fields("file_name")
  file_name= Server.MapPath ("/") & "/song/chunfeng/" & fn
  to_find=text_match(file_name,sch_str)

' 逐個打開記錄集中當前記錄所指向的文件。用查找的字串對文件的全文本進行匹配比較.
  if to_find then
  url="chunfeng/" & fn
  Response.Write "<A HREF=" & url & ">
" & tit
  end if
  rcst1.movenext
  result=result or to_find
  loop
  Response.Write "</UL>"

' 符合條件的文件標題以超級鏈接形式輸出到客戶端.
  if not result then
  Response.Write "對不起,沒有找到!"
  end if
  mousepointer=0
  %>
  <script RUNAT="Server" LANGUAGE="VBScript">
  function text_match(filename,search_string)
  dim retstring
  dim find_pos
  Dim fso, a
  dim done
  text_match=false
  Set fso = Server .CreateObject("Scripting.FileSystemObject
")

' 創建腳本的文件系統,打開文本流以讀入.
  Set a = fso.OpenTextFile(filename, 1, FALSE)

done=a.AtEndOfStream or text_match
  Do While not done
  retstring = a.ReadLine
  find_pos=instr(retstring,search_string)
  if find_pos>0 then text_match=true
  done=a.AtEndOfStream or text_match
  Loop
  a.Close
  end function
  </script>
  </body></html>

[1]

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 远安县| 曲阜市| 礼泉县| 应城市| 镇沅| 准格尔旗| 浏阳市| 老河口市| 板桥市| 云安县| 齐河县| 扶沟县| 鹤庆县| 郁南县| 筠连县| 天台县| 泊头市| 嵊泗县| 宁陵县| 鹤峰县| 象州县| 宝应县| 青海省| 巴东县| 井研县| 泽州县| 平湖市| 武强县| 许昌市| 铁岭市| 徐闻县| 吉隆县| 景宁| 保德县| 察哈| 梓潼县| 磐安县| 西丰县| 金沙县| 西宁市| 惠来县|