يك برنامه جستجو با ASP

لطفا اگر امكان دارد در مورد ساخت يك برنامه جستجو با ASP.NET مرا راهنمايي كنيد.
قبلا از همكاري شما سپاسگذارم. :oops:
 

miladmovie

Active Member
سلام


شما مي خواهيد از سرچرهاي سايت هاي ديگر استفاده كنيد يا خودتون مي خواهيد سرچر درست كنيد
 
من ميخواهم خودم يك سرچر درست كنم.دوباره سپاسگذارم كه راهنمايي ميكنيد.
 

miladmovie

Active Member
سلام
اگر خواستيد من مي تونم با استفاده از ASP به شما كمك كنم راستش ASP.NET درست بلد نيستم
 

Amir2003

Member
با سلام
آقا يه سوال اينجا بايد پرسيده بشه كه شما با اون
سرچرتون مي خواهيد فقط سايت خودتون را بسرچيد!!! :mrgreen:
يا د رمورد يك مطلب روي اينترنت؟
 
من با اين سرچر ميخواهم مطالب موجود در يك سايت شخصي را سرچ نمايم.
اگر با ASP هم باشد مشكلي نيست.بخاطر محيط ويژوال ASP.NET من آن را انتخاب كرده بودم.
در آخر هم از راهنمايي و پيگيري شما دوستان بسيار سپاسگذارم.
 

hoom

Active Member
سلام

اين برنامه فقط با ويندوز 2000 كه يه Index Server3 فعال داشته باشه كار ميكنه.

<form action="search.asp" name="search.asp" id="search.asp">
Search for:
<input type="text" name="q" id="txtQuery" value="<%= strQuery %>" size="20">
<input type="submit" name="Submit" value="Search">
&lt;/form>


&lt;%
strQuery = Request("q")

If strQuery &lt;> "" Then

lcErrorMsg = ""
Set rs = RunQuery(strQuery, strVirtual)

if TypeName(rs) &lt;> "Recordset" then
lcErrorMsg = "Your search returned no matching documents.
"
lcErrorMsg = lcErrorMsg &amp; "Please try another search."
End If

Function RunQuery(lcQuery,lcVirtual)
if TypeName(lcVirtual) &lt;> "String" then
lcVirtual = "/"
End If

if TypeName(lcQuery) &lt;> "String" then
Set RunQuery = nothing
Exit Function
End If

Set oQ=Server.CreateObject("ixsso.Query")
oQ.query = lcQuery
' Allows you to specify which page properties are returned in the recordset
oQ.columns = "Vpath,DocTitle,Filename,Write,Characterization,DocKeyWords,Rank"
' Other properties: Contents, hitcount, Path, DocAuthor
oQ.SortBy = "Rank [d]"
oQ.MaxRecords = 100

Set oU=Server.Createobject("ixsso.util")

' Add a few directories for searching - customise for your structure.
oU.AddScopeToquery oQ,"/asphelp","shallow"
oU.AddScopeToquery oQ,"/asphelp/scripting","deep"
oU.AddScopeToquery oQ,"/asphelp/hosting","deep"

Set rs=oQ.CreateRecordset("nonsequential")

if TypeName(rs) &lt;> "Recordset" then
Set RunQuery = nothing
exit function
End If

if rs.RecordCount &lt; 1 then
Set RunQuery = nothing
else
' Return result RecordSet
Set RunQuery = rs
End If
End Function
%>
&lt;% If Len(lcErrorMsg) > 0 then %>
&lt;p>
&lt;%= lcErrorMsg %>
&lt;%
End If

If lcErrorMsg = "" Then

intRecordCount = rs.recordcount
intResTop = 1
intResBot = intRes + 10
If intRecordCount &lt; intRes + 10 Then intResBot = intRecordCount
If intRes > 0 Then intResTop = intRes + 1
%>

&lt;%= intResTop %> to &lt;%= intResBot %> of &lt;%= intRecordCount %> results for: "&lt;%= strQuery %>"

&lt;% Call WriteNav() %>

&lt;table border="0" cellspacing="1" cellpadding="2">
&lt;%
If intRes > 1 Then
For a = 1 to intRes
rs.MoveNext
i = i + 1
Next
End If

Do While NOT rs.eof

If rs("DocTitle") &lt;> "" Then
strTitle = rs("DocTitle")
Else
strTitle = rs("filename")
End If
strPath = rs("vPath")
i = i + 1
b = b + 1
%>
&lt;tr>
&lt;td valign="top">&lt;%= i %>. &lt;/td>
&lt;td valign="top">
&lt;font color="#808080">&lt;%=Fix(rs("rank")/10)%>%&lt;/font> &lt;a href="&lt;%=strPath%>">&lt;%=strTitle%>&lt;/a>
&lt;%=strPath%>
&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&amp;nbsp;&lt;/td>
&lt;td>
Summary: &lt;%= rs("characterization") %>
&lt;% If rs("dockeywords") &lt;> "" Then %>
Keywords: &lt;%= rs("dockeywords") %>
&lt;% End If %>
Updated: &lt;%= rs("write") %>
&lt;/td>
&lt;/tr>
&lt;%
If b = 10 Then Exit Do
rs.MoveNext
loop
rs.Close
%>
&lt;/table>
&lt;%
End If
Call WriteNav()
End If


'Page Navigation Display Subroutine
Sub WriteNav()
If intRecordCount > 10 Then
%>
&lt;center>
&lt;% If intRes > 0 Then %>
&lt;a href="search.asp?q=&lt;%= Server.URLEncode(strQuery) %>&amp;s=&lt;%= intSection %>&amp;r=&lt;%= intRes - 10 %>">&lt;&lt; Previous Page&lt;/a>
&lt;% Else %>
&lt;font color="#808080">&lt;&lt; Previous Page&lt;/font>
&lt;%
End If
intPages = Fix(intRecordCount / 10)
If intRecordCount > (intPages * 10) Then intPages = intPages + 1
For a = 1 to intPages
If ((a * 10) - 10) = CInt(intRes) OR (a = 1 AND intRes = 0) Then
%>
&lt;%= a %>
&lt;% Else %>
&lt;a href="search.asp?q=&lt;%= Server.URLEncode(strQuery) %>&amp;s=&lt;%= intSection %>&amp;r=&lt;%= (a*10)-10 %>">&lt;%= a %>&lt;/a>
&lt;%
End If
Next
If intRecordCount &lt; (intRes + 10) OR intRes = 0 Then
%>
&lt;a href="search.asp?q=&lt;%= Server.URLEncode(strQuery) %>&amp;s=&lt;%= intSection %>&amp;r=&lt;%= intRes + 10 %>">Next Page >>&lt;/a>
&lt;% Else %>
&lt;font color="#808080">Next Page >>&lt;/font>
&lt;% End If %>
&lt;/center>
&lt;%
End If
End Sub
%>

ارادتمند
 
با عرض سلام و تشكر بخاطر راهنمايي در مورد موتور جستجو.
اگه زحمتي نباشه خواهش ميكنم در مورد اين برنامه يه توضيح فارسي هم لطف بفرماييد.
چون من تازه برنامه نويسي رو شروع كردم.
از توجه شما بسيا ممنونم.
persepolise
 

جدیدترین ارسال ها

بالا