Design and CSS styles
Version 3.x > Design and CSS styles > Search results ranking View modes: 
User avatar
Member
Member
jason.hau@triad.co.uk - 7/16/2008 11:23:48 AM
   
Search results ranking
Hi, i'm trying to generate a search results list which will have an incremental value against each result e.g.:

1. "Hyperlink to Result one"
2. "Hyperlink to Result two"

etc.

is there some way to get the index of the search result within the dataset or will I need to alter the query within site manager to create a new field that will show this value?

User avatar
Member
Member
kentico_pavelk - 7/30/2008 8:36:21 AM
   
RE:Search results ranking
Hello,

Thank you for your post.

You can find information how to write your own search provider in our Developer's guide:

http://www.kentico.com/docs/devguide/index.html?development_of_a_custom_search.htm

Could you please write this piece of code insted of the code mentioned in Step 6 in Developer's guide?

CMS.SearchProviderSQL.SearchProvider standardSearchProvider = new CMS.SearchProviderSQL.SearchProvider();

DataSet ds = standardSearchProvider.Search(siteName, searchNodePath, cultureCode, searchExpression,searchMode, searchChildNodes, classNames, filterResultsByReadPermission, searchOnlyPublished,whereCondition, orderBy);

if (ds.Tables.Count > 0)
{
int i = 1;

foreach (DataRow dr in ds.Tables[0].Rows)
{

dr["SearchResultName"] = Convert.ToString(i) + ". " + (string)dr["SearchResultName"];
i++;

}

}

return ds;


Best regards,
Pavel Knotek