Search results order

Posted By saturation Thu 28 Jul 2011
Add to Favorites0
Author Message
saturation
 Posted Thu 28 Jul 2011
Supreme Being

Supreme Being - (57,748 reputation)Supreme Being - (57,748 reputation)Supreme Being - (57,748 reputation)Supreme Being - (57,748 reputation)Supreme Being - (57,748 reputation)Supreme Being - (57,748 reputation)Supreme Being - (57,748 reputation)Supreme Being - (57,748 reputation)Supreme Being - (57,748 reputation)

Group: Forum Members
Last Active: Fri 30 Nov 2012
Posts: 108, Visits: 1,185
I'm looking to order my search results by product name (descending).   Is there a way to add this to the code?  v.1.3.
Mohammad
 Posted Thu 28 Jul 2011
Kartris Expert

Kartris Expert - (70,561 reputation)Kartris Expert - (70,561 reputation)Kartris Expert - (70,561 reputation)Kartris Expert - (70,561 reputation)Kartris Expert - (70,561 reputation)Kartris Expert - (70,561 reputation)Kartris Expert - (70,561 reputation)Kartris Expert - (70,561 reputation)Kartris Expert - (70,561 reputation)

Group: Administrators
Last Active: Sun 27 Sep 2015
Posts: 115, Visits: 706
1. If you want to control the whole results order (so to ignore the best matches), then you can do that from the search stored procedure, which could be either "spKartrisDB_Search" (default) or "spKartrisDB_SearchFTS" (if you enabled Full Text Search in your database).

Go to the 4th or 5th line from the bottom of the stored procedure (Line 240 +/- from the top):

Replace
ORDER BY TotalScore DESC

By
ORDER BY P_Name DESC

OR

2. If you want to keep the best matches at the top pages, but order the results per page, you need to do that from the code behind.

Go to "UserControls\Templates\ProductTemplateSearchResult.ascx.vb" find LoadSearchResult Sub:

Replace:
rptSearchResult.DataSource = ptblResult
rptSearchResult.DataBind()

By:
Dim dvResults as DataView = ptblResult.DefaultView
dvResults.Sort = "P_Name DESC"
rptSearchResult.DataSource = dvResults
rptSearchResult.DataBind()

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top