Creating a Search Engine with ASP

Results 1 to 5 of 5

Thread: Creating a Search Engine with ASP

  1. #1
    G. Derekenaris Guest

    Default Creating a Search Engine with ASP

    I would like to create a search engine for a web site. The search should be limited within the pages of this site. I have a strict deadline and time is pressing. <BR>Is there an easy way to do this with ASP? <BR>Otherwise is there an alternative way? <BR>

  2. #2
    Daniel Root Guest

    Default RE: Creating a Search Engine with ASP

    For a quick fix, the FrontPage search engine works nice, and could be installed quickly. If you don&#039t have frontpage, there are other 3rd party search engines (www.infoseek.com) has one called ultraseek. With ASP, you could write a script to walk all of the directories and record metatags/filenames/keywords/whatever else in a database. That could get kind of hairy though.<BR><BR>Daniel Root

  3. #3
    mani Guest

    Default RE: Creating a Search Engine with ASP

    The best way would be to use microsoft index server.

  4. #4
    Chad Franklin Guest

    Default RE: Creating a Search Engine with ASP

    FirstPage.asp<BR><BR>&#060;html><BR><BR>&#060;head ><BR>&#060;title>Search Wizard&#060;/title><BR>&#060;/head><BR><BR>&#060;body BGCOLOR="#FFFFFF"><BR><BR>&#060;form ACTION="redir.asp" METHOD="POST" onsubmit="return FrontPage_Form1_Validator(this)"<BR>name="FrontPag e_Form1"><BR> &#060;input type="hidden" name="TemplateName" value="query">&#060;input type="hidden"<BR> name="CiMaxRecordsPerPage" value="10">&#060;input type="hidden" name="CiSort" value="rank[d]">&#060;input<BR> type="hidden" name="HTMLQueryForm" value="&#060;%= Request.ServerVariables("PATH_INFO")&#037;&#062;"> &#060;input<BR> type="hidden" name="IDQFile" value="/scripts/samples/search/query.idq">&#060;div align="center">&#060;center>&#060;table<BR> BORDER="0" BORDERCOLOR="#000000" CELLPADDING="0" CELLSPACING="0" HEIGHT="318" WIDTH="555"><BR> &#060;tr><BR> &#060;td WIDTH="555" VALIGN="TOP" HEIGHT="18" COLSPAN="5" BGCOLOR="#000084">&#060;font SIZE="1"<BR> COLOR="#FFFFFF" FACE="MS Sans Serif, Arial, Helv">&#060;b>&nbsp; InTouch Search Wizard &#060;/b>&#060;/font>&#060;/td><BR> &#060;/tr><BR> &#060;tr><BR> &#060;td WIDTH="1" ROWSPAN="7" HEIGHT="318" VALIGN="TOP">&#060;img SRC="black.gif" HEIGHT="318"<BR> WIDTH="1" BORDER="0"> &#060;/td><BR> &#060;td WIDTH="95" ROWSPAN="7" HEIGHT="318" VALIGN="TOP">&#060;img SRC="searchbar.gif" BORDER="0"<BR> WIDTH="95" HEIGHT="318"> &#060;/td><BR> &#060;td>&#060;/td><BR> &#060;td>&#060;/td><BR> &#060;td WIDTH="1" ROWSPAN="7" HEIGHT="318" VALIGN="TOP" ALIGN="RIGHT">&#060;img SRC="black.gif"<BR> HEIGHT="318" WIDTH="1" BORDER="0"> &#060;/td><BR> &#060;/tr><BR> &#060;tr><BR> &#060;td WIDTH="450" VALIGN="TOP" COLSPAN="2">&#060;font FACE="MS Sans Serif, Arial, Helv" SIZE="1"><BR><BR> &nbsp;&nbsp;&#060;strong>I want to search for:&#060;/strong>&#060;p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&#060;!--webbot<BR> bot="Validation" startspan S-Display-Name="Search Box" B-Value-Required="TRUE" -->&#060;!--webbot<BR> bot="Validation" endspan -->&#060;input NAME="txtSearchString" VALUE SIZE="58"> <BR><BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#060;b>&#060; a href="Help.htm">Quick Tips&#060;/a> for more<BR> effective searching.&#060;/b> &#060;/font>&#060;/td><BR> &#060;/tr><BR> &#060;tr><BR> &#060;td WIDTH="450" COLSPAN="2">&#060;font FACE="MS Sans Serif, Arial, Helv" SIZE="1"><BR><BR> &nbsp;&nbsp;&#060;strong>I want to search the:&#060;/strong> &#060;/font>&#060;/td><BR> &#060;/tr><BR> &#060;tr><BR> &#060;td COLSPAN="2" WIDTH="450">&#060;font FACE="MS Sans Serif, Arial, Helv" SIZE="1"><BR><BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#060;input NAME="SearchType" TYPE="RADIO" VALUE="local" checked>InTouch<BR> site (Under Construction)<BR><BR> &#060;font FACE="MS Sans Serif, Arial, Helv" SIZE="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#060;input<BR> NAME="SearchType" TYPE="RADIO" VALUE="Government">Ontario Government web sites&#060;/font>&#060;/font>&#060;/td><BR> &#060;/tr><BR> &#060;tr><BR> &#060;td WIDTH="225" COLSPAN="1">&#060;font FACE="MS Sans Serif, Arial, Helv" SIZE="1"><BR><BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#060;input NAME="SearchType" TYPE="RADIO" VALUE="altavista">Internet<BR> using Alta Vista<BR><BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#060;input NAME="SearchType" TYPE="RADIO" VALUE="excite">Internet<BR> using Excite<BR><BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#060;input NAME="SearchType" TYPE="RADIO" VALUE="infoseek">Internet<BR> using Infoseek<BR><BR> &#060;/font>&#060;/td><BR> &#060;td WIDTH="225" COLSPAN="1">&#060;font FACE="MS Sans Serif, Arial, Helv" SIZE="1"><BR><BR> &#060;input NAME="SearchType" TYPE="RADIO" VALUE="lycos">Internet using Lycos<BR><BR> &#060;input NAME="SearchType" TYPE="RADIO" VALUE="hotbot">Internet using HotBot<BR><BR> &#060;input NAME="SearchType" TYPE="RADIO" VALUE="yahoo">Internet using Yahoo<BR><BR> &#060;/font>&#060;/td><BR> &#060;/tr><BR> &#060;tr><BR> &#060;td WIDTH="450" COLSPAN="2">&#060;font FACE="MS Sans Serif, Arial, Helv" SIZE="1"><BR><BR> <BR><BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&#060;b>&#060;a href="Info.htm">Info&#060;/a> about the different<BR> search services.&#060;/b> <BR><BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp; &#060;/font>&#060;/td><BR> &#060;/tr><BR> &#060;tr><BR> &#060;td WIDTH="450" HEIGHT="40" ALIGN="RIGHT" COLSPAN="2">&#060;font<BR> FACE="MS Sans Serif, Arial, Helv" SIZE="1">&#060;input TYPE="submit" NAME="Finish"<BR> VALUE="Search Now!"> &nbsp; <BR><BR> &#060;/font>&#060;/td><BR> &#060;/tr><BR> &#060;tr><BR> &#060;td WIDTH="555" VALIGN="TOP" HEIGHT="18" COLSPAN="5" BGCOLOR="#000084"><BR><BR> &#060;/td><BR> &#060;/tr><BR> &#060;/table><BR> &#060;/center>&#060;/div><BR>&#060;/form><BR>&#060;/body><BR>&#060;/html><BR><BR>SecondPage.asp<BR><BR>&#060;%@ LANGUAGE="VBSCRIPT"&#037;&#062;<BR>&#060;%<BR>&#03 9 when we do it this way, we can handle POST and GET with one piece of code<BR>SearchType = Trim(Request("SearchType"))<BR>URLRedirTo = ""<BR>strSearch = Server.Urlencode(Trim(Request("txtSearchString"))) <BR>&#037;&#062;<BR>&#060;%<BR>Select Case SearchType<BR> Case "local"<BR>&#039Connect to Database<BR>Dim Conn<BR>If IsObject(Session("Access Database_conn")) Then<BR> Set conn = Session("Access Database_conn")<BR>Else<BR> Set conn = Server.CreateObject("ADODB.Connection")<BR> conn.open "Access Database","",""<BR> Set Session("Access Database_conn") = conn<BR>End If<BR>&#037;&#062;<BR>&#060;%&#039Set these up to your preference<BR>DefaultBoolean = "OR"<BR>RecordsPerPage = 10<BR>&#037;&#062;<BR>&#060;%<BR>&#039Get our form variable<BR>Dim strSearch<BR>strSearch = Request.form("txtSearchString")<BR>&#037;&#062;<BR >&#060;%<BR>&#039Get our current ID. This let&#039s us know where we are Dim ID<BR>ID = Request.QueryString("ID")<BR>&#037;&#062;<BR>&#060 ;%<BR>&#039Set up our SQL Statement<BR>Dim strSQL<BR>strsql = "SELECT * FROM ArticleURL WHERE "<BR>tmpSQL = "(Meta Like "<BR>&#037;&#062;<BR>&#060;%<BR>&#039OK, we need to parse our string here<BR>DIM Pos<BR>DIM tmpSQL<BR>Pos = 1<BR>Pos = InStr(1, strSearch," ")<BR>IF Pos = 0 THEN<BR> tmpSQL = tmpSQL & "&#039%" & strSearch & "%&#039)"<BR>ELSE<BR> Dim strYourString<BR> strYourString = Trim(strSearch)<BR> tmpSQL = "(Meta LIKE &#039%" & Replace(strSearch," ","%&#039 OR Meta LIKE &#039%") & "%&#039)" <BR>END IF<BR>&#037;&#062;<BR>&#060;%<BR>&#039Now, we&#039ve got to make sure we only get the right records <BR>strSQL = strSQL & tmpSQL<BR>&#037;&#062;<BR>&#060;%<BR>&#039Make our Recordset variable and get the results<BR>Dim rsResults<BR>Set rsResults = Server.CreateObject("ADODB.Recordset")<BR>&#037;&# 062;<BR>&#060;% rsResults.CursorType = adForwardOnly &#037;&#062;<BR>&#060;% rsResults.MaxRecords = RecordsPerPage &#037;&#062;<BR>&#060;%<BR>&#039Get our data<BR>rsResults.Open strSQL, Conn<BR>&#037;&#062;<BR>&#060;% <BR>&#039OK, we&#039ve got the data, let&#039s display it in HTML<BR>&#039First, though, let&#039s get the total number of records<BR>Dim rsTotalRecords<BR>strSQL = "SELECT COUNT(*) FROM ArticleURL WHERE " & tmpSQL<BR>Set rsTotalRecords = Conn.Execute(strSQL)<BR><BR>&#039We also need the max ID value for our search Dim rsMaxID<BR>strSQL = "SELECT MAX(ArticleURLID) FROM ArticleURL WHERE " & tmpSQL<BR>Set rsMaxID = Conn.Execute(strSQL)<BR>&#037;&#062;<BR>&#060;%<BR > Case "altavista"<BR> URLRedirTo = "http://altavista.digital.com/cgi-bin/query" & "?pg=q"<BR> URLRedirTo = URLRedirTo & "&what=web&fmt="<BR> URLRedirTo = URLRedirTo & "&q=" & strSearch<BR><BR> Case "excite"<BR> URLRedirTo = "http://www.excite.com/search.gw"<BR> URLRedirTo = URLRedirTo & "?trace=a&search=" & strSearch & "&collection=web"<BR><BR> Case "infoseek"<BR> URLRedirTo = "http://www.infoseek.com/Titles"<BR> URLRedirTo = URLRedirTo & "?col=WW&qt=" & strSearch & "&sv=IS&lk=noframes&nh=10"<BR><BR> Case "lycos"<BR> URLRedirTo = "http://www.lycos.com/cgi-bin/pursuit"<BR> URLRedirTo = URLRedirTo & "?cat=lycos&query=" & strSearch<BR><BR> Case "hotbot"<BR> URLRedirTo = "http://www.hotbot.com/"<BR> URLRedirTo = URLRedirTo & "?SW=the+Web&SM=B&MT=" & strSearch<BR> URLRedirTo = URLRedirTo & "&DC=10&DE=2&RG=NA&_v=2" <BR><BR> Case "yahoo"<BR> URLRedirTo = "http://search.yahoo.com/bin/search"<BR> URLRedirTo = URLRedirTo & "?p=" & strSearch<BR><BR> Case "Government"<BR> URLRedirTo = "http://www.search.gov.on.ca/compass" <BR> URLRedirTo = URLRedirTo & "?ui=sr" & "&scope=" & strSearch<BR><BR> Case Else<BR> &#039 no search machine we┬┤ve implemented,so we are sorry!<BR>End Select<BR><BR>if ("" &#060;> URLRedirTo) then <BR> Response.Redirect(URLRedirTo)<BR>else<BR>&#037;&#0 62;<BR>&#060;font face="Verdana"><BR>&#060;html><BR><BR>&#060;head>< BR>&#060;title>&#060;/title><BR>&#060;/head><BR><BR>&#060;body><BR>&#060;% if rsResults.EOF then &#039No matches found<BR>&#037;&#062;<BR><BR>&#060;p>No matches found! Try broadening your search criteria.&#060;/p><BR><BR>&#060;p>&#060;a href="search_main.asp">Return to Search&#060;/a> &#060;% Else<BR>Dim iCurrentID<BR>While Not rsResults.EOF <BR>iCurrentID = rsResults("ArticleURLID")&#037;&#062; &#060;a HREF="http://&#060;%=rsResults("URL")&#037;&#062;">&#060;%=rsRe sults("Title")&#037;&#062;&#060;/a><BR><BR>&#060;%=rsResults("Description")&#037;&# 062;<BR><BR>&#060;/p><BR><BR>&#060;p>&#060;% rsResults.MoveNext &#037;&#062;&#060;% Wend &#037;&#062;&#060;/p><BR><BR>&#060;p>&#060;%=rsTotalRecords(0)&#037;& #062; Found!<BR><BR>&#060;% if iCurrentID &#060; rsMaxID(0) then &#037;&#062;&#060;!-- We have at least another record... -->&#060;/p><BR>&#060;% end if <BR>end if &#039End if for .EOF clause above &#037;&#062;<BR>&#060;/font><BR>&#060;/body><BR>&#060;/html><BR>&#060;% end if &#037;&#062;<BR><BR>This can use some work, but it works. If you improve on this please send me the design at chad.franklin@jus.gov.on.ca<BR>


  5. #5
    devonian Guest

    Default RE: Creating a Search Engine with ASP

    For low traffic sites I use and Access database with a file based DSN. In addition to the Link, AddedDate, Category, and SubmittedBy fields I have a Description field. The Description field is a memo data type and into it I cut-n-paste the text from each page.<BR>The ASP Search page is just a HTML page that uses one text box for the user to enter a parameter and a combo box for the user to select a Search Category (Date, Category, Description, etc.). The search word and search category is sent to the Data Access ASP page that builds it into a SELECT query, sends it to the server and returns the results into a CSS formatted HTML page.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •