Bilgisayar Bölümü ASP Kod ve Script Arşivi


Soundex algorithm

<%
'-------------------------------------------------------------------------------------
Function DidYouMean(SearchPhrase,strTableName,strSearchField)
'Do a soundex lookup
'Return an Integer between 4 And 1 indicating strength of match (4 Is best)
'And Write 'did you mean' With a suggestion URL
Dim RS, intI 'lookup recordset
Set RS = Server.CreateObject( "ADODB.Recordset" )
newSQL = "Select " & strSearchField & " FROM " & strTableName _
& " WHERE Soundex Like '" & dhSoundex(SearchPhrase) & "' "
RS.CursorLocation = 3 'Do Not change this - Recordcount And bookmarks will Not work!
RS.Open newSQL, Con
If RS.Recordcount > 0 Then
'take the first one With the highest rating
intI = 4 'downward counter representing match rating
Do Until RS.EOF
If dhSoundsLike(RS(strSearchField),SearchPhrase,False) >= intI Then
'>>>>>>>>>Set catalog.asp To YOUR PAGE BELOW<<<<<<<<<<<<
Response.Write "<font color=red>Did you mean: </font>"
Response.Write "<A HREF=""Catalog.asp?STR=" & RS(strSearchField) & """>"
Response.Write RS(strSearchField) & "</A> ?<BR>"
DidYouMean = intI
End If
intI = intI -1
If intI = 1 Then 'can't be much alike!
Exit Do
End If
RS.MoveNext
Loop
End If
RS.Close
End Function
'----------------------------------------------------------------------------------------
%>

ASP Kitabı

 

Faydalılar: Altın Fiyatları |Hediye Kolye | pırlanta fiyatları
Ana Sayfa  Sık Kullanılanlara Ekle   admin[at]bilgisayarbolumu.com | © 2006 - 2020 Bilgisayarbolumu.com