Share Button

One essential thing that you will need to do in almost every search implementation is linking each search result item to their full (details) pages. The Sitecore content search provider for Solr doesn’t index the item url by default, here are the steps you need to get it working:

The Sitecore.ContentSearch.SearchTypes.SearchResultsItem base class contains the following property:

[IndexField("urllink")]
public virtual string Url {get; set;}

Consider the following sample code to get the urls of items located under a specific parent:

...
using(var context = index.CreateSearchContext())
{
  var query = context.GetQueryable<SearchResultItem>();
  var pageUrls = query.Where(i => i.Parent == new ID("<ParentItemIdHere>"))
                      .GetResults().Hits.Select(h => h.Document.Url).ToList();
}

Read More Sitecore 7 & Solr – Why SearchResultItem.Url is always null?

Sitecore Solr