如何实现全文检索?
- 技术交流
- 2024-10-01 10:23:01
<%@ LANGUAGE="VBscript" %>
<%
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 "
"
Dim result
result =false
Response.Write ""
do while not rcst1.eof
tit=rcst1.fields("file_title")
fn=rcst1.fields("file_name")
file_name= Server.MapPath ("/") & "songchunfeng" & fn
to_find=text_match(file_name,sch_str)
' 逐个打开记录集中当前记录所指向的文件。用查找的字串对文件的全文本进行匹配比较.
if to_find then
url="chunfeng/" & fn
Response.Write "
" & tit
end if
rcst1.movenext
result=result or to_find
loop
Response.Write ""
' 把符合条件的文件标题以超级链接形式输出到客户端.
if not result then
Response.Write "对不起,没有找到!"
end if
mousepointer=0
%>
[1]