Use MSN to search your site - and enhance it

I was looking for a way to improve the search box I had on my website.

Then I found Steve C. Orr's article about it, and “saw it was good“.

But, after implementing that in my website, I immidietly saw that somethings, MSN didn't find on my website. Sure, I need to think about SEO and such, but what do you do until everything is fixed?

I took the results from the MSN search API and combined them with the search I already had. I don't want to temper with the results, in case that violates the user agreement, so I was careful only to add resuts, and keep the MSN results in the same order in which they come from MSN.


Protected Sub SearchBox1_SearchResultsReady(ByVal SearchResults As System.Data.DataTable) Handles SearchBox1.SearchResultsReady

'get product search results

Dim ds As DataSet = NewEwdCommon.oProductData.SearchProducts(Request.Params("for"))

Dim dt As New DataTable

dt.Columns.Add("Title")

dt.Columns.Add("Url")

If ds.Tables(0).Rows.Count > 0 Then

Dim row As DataRow

Dim ProductPageUrlFormat As String = _

Request.ServerVariables("SERVER_NAME") & Request.ApplicationPath & _

"/" & Master.VehicleChooser.VehicleArgumentsDirectoryString & _

NewEwdCommon.MyUrl.ProductDetails.Start & "{0}" & NewEwdCommon.MyUrl.ProductDetails.Finish

ProductPageUrlFormat = ProductPageUrlFormat.Replace("//", "/")

ProductPageUrlFormat = "http://" & ProductPageUrlFormat

For Each row In ds.Tables(0).Rows

Dim sTitle As String = String.Format("{0}, Product {1}, SKU {2} - sale price is {3}", _

row(ProductDB.FieldNames.ProductName), _

row(ProductDB.FieldNames.ProductID), _

row(ProductDB.FieldNames.SKU), _

row(ProductDB.FieldNames.PriceCustomer))

Dim sUrl As String = String.Format(ProductPageUrlFormat, row(ProductDB.FieldNames.ProductID))

 

 

dt.Rows.Add(sTitle, sUrl)

Next

'finished, now merge the two data tables:

dt.Merge(SearchResults)

End If

DataList1.DataSource = dt

DataList1.DataBind()

End Sub

 

posted @ Thursday, June 01, 2006 9:09 AM

Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
 

Live Comment Preview:

 
«November»
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345