How to implement full-text search?

Source: Internet
Author: User
Tags microsoft frontpage

<% @ 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>Galaxy video full-text search</Title>
  <Meta name = "Microsoft Border" content = "tl, default">

</Head>
 <Body BGPROPERTIES = "FIXED" BGCOLOR = "#00 FFFF">

<%
  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)

'Matching String Length.PreprocessingRequestObtained data (useful information entered by the user),Extract the required string by calculating the length of valid information.You can also append a flag character (for example#OrChr (7))..
  Response. Write "<CENTER>Search results<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)

'Open the files pointed to by the current record in the record set one by one. Use the searched string to match and compare the full text of the file.
  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>"

'SetThe qualified file title is output to the client as a hyperlink.
  If not result then
  Response. Write"Sorry,Not found! "
  End if
  Mousepointer = 0
  %>
  <Script RUNAT = "Server" LANGUAGE = "VBScript">
  Function text_match (filename, search_string)
  Dim retstring
  Dim find_pos
  Dim fso,
  Dim done
  Text_match = false
  Set fso = Server. CreateObject ("Scripting. FileSystemObject
")

'Create a script file system,Open Text Stream to read.
  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>

[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.