A new Full-text search program that has just been written and applied to a software

Source: Internet
Author: User
Program | full-Text Search <p> <!--#include file=function/conn.asp-->

<br>

<%

Keyword=trim (Request ("Okey"))

Stype=trim (Request ("Otype"))

If keyword= "" or keyword= keyword ... "Then

Response.Write "Please enter the keyword!" "

Response.End ()

End If

If stype= "" Then

Response.Write "Please select query information category"

Response.End ()

End If

Dim ftstable ' The name of the stored table to query for information

Dim Ftsfolder ' Store Folder to query for information

If stype= "1" Then

Ftstable= "Tb_bzxx"

Ftsfolder=fjroot

ElseIf stype= "2" Then

Ftstable= "Tb_other"

Ftsfolder=fjroot_other

ElseIf stype= "3" Then

Ftstable= "Tb_info"

Ftsfolder=fjroot_info

Else

Response.Write "went wrong!" "

Response.End

End If

Sql= ""

If stype= "1" Then

Sql= "Select Bz_xuhao as xuhao,bz_name as bname,bz_code as bcode,bz_htm as htm from" & ftstable

ElseIf stype= "2" Then

Sql= "Select P_xuhao as xuhao,p_name as bname,p_code as bcode,p_htm as htm from" & ftstable

ElseIf stype= "3" Then

Sql= "Select info_id as xuhao,info_htm,info_type as htm from" & ftstable

Else

Response.Write "went wrong!" "

Response.End

End If

Call Openconn () ' Open database connection '

Set Fso=server. CreateObject ("Scripting.FileSystemObject")

Set Rs=server.createobject ("Adodb.recordset")

Dim Opattern

Opattern= "<p>|<p (. *) >|</p>"

' If you are querying for a third type of information (other information), then remove all of the information categories and put them in the array.

Dim InfoType ()

If stype= "3" Then

Rs. Open "Select Type_id,type_name from Tb_info_type ORDER by type_id Desc", adocon,3,1

If Rs. Recordcount<=0 Then

Closers RS

Call Closeconn

Response.Write "went wrong!" "

Response.End ()

End If

ReDim InfoType (CLng (RS (0)))

Do but not Rs. Eof

InfoType (CLng (RS (0))) =rs (1)

Rs. MoveNext

Loop

Rs. Close ()

End If

%>


Keywords: <span style= "color: #ff0000" > <%=KEYWORD%>

</span><br>





<table width= ">"

<tr>

&LT;TD style= "font-size:12;color:000000;line-height:1.8" > <%

' To retrieve

Rs. Open sql,adocon,3,1

If Rs. Recordcount>0 Then

Scount=0

Do but not Rs. Eof

Findpos=0

Htm=rs ("htm")

If htm<> "" Then

Vpath=ftsfolder & "/" & RS ("Xuhao") & "/" & htm

Filepath=server.mappath (Vpath)

If FSO. FileExists (filepath) Then

Set OFILE=FSO. GetFile (filepath)

Set Ofilestream=ofile.openastextstream (1)

Ofileinfo= ""

If not Ofilestream.atendofstream then

Ofileinfo=filterhtml (FILTERBR) (Trim (Ofilestream.readall))

If ofileinfo<> "" Then

Findpos=instr (1,ofileinfo,keyword,1)

' Got the data, needed to show

If Findpos>0 Then

Response.Write "<a href=" "& Vpath &" ' target= ' _blank ' > '

If stype= "1" or stype= "2" Then

Response.Write "<span style= ' font-weight:bold;font-size:13;color:0000ff ' >" & RS ("Bname") & "(" & RS ( "Bcode") & ") </span></a><br>"

Else

Response.Write "<span style= ' font-weight:bold;font-size:13;color:0000ff ' >" & InfoType (CLng ("Info_ Type ")) &" </span></a><br> "

End If

If Findpos>50 Then

Response.Write "..." & Replace (mid ofileinfo,findpos-50,200), KeyWord, "<span style= ' color:ff0000 ' >" & KeyWord & "</span>", 1,-1,1) &



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.