title: How to show search results with their url's in Umbraco 7
body: <p>I have implemented search in Umbraco 7 using examine and user control. Search is working fine. Now I need to show the URL of the search results displayed on the lists. Is there any index property like "BodyText" which can show the URL or do I have to do some stuff in user control?</p>
  
  <p>User Control code:</p>
  
  <pre><code>public static class SiteSearchResultExtensions
  {
      public static string FullURL(this Examine.SearchResult sr)
      {
          return umbraco.library.NiceUrl(sr.Id);
      }
  }
  
  
  
  public partial class SiteSearchResults : System.Web.UI.UserControl
  {
      #region Properties
  
      private int _pageSize = 5;
      public string PageSize
      {
          get { return _pageSize.ToString(); }
          set
          {
              int pageSize;
              if (int.TryParse(value, out pageSize))
              {
                  _pageSize = pageSize;
              }
              else
              {
                  _pageSize = 10;
              }
          }
      }
  
      private string SearchTerm
      {
          get
          {
              object o = this.ViewState["SearchTerm"];
              if (o == null)
                  return "";
              else
                  return o.ToString();
          }
  
          set
          {
              this.ViewState["SearchTerm"] = value;
          }
      }
  
      protected IEnumerable&lt;Examine.SearchResult&gt; SearchResults
      {
          get;
          private set;
      }
  
      #endregion
  
      #region Events
  
      protected override void OnLoad(EventArgs e)
      {
          try
          {
              CustomValidator.ErrorMessage = "";
  
              if (!Page.IsPostBack)
              {
                  topDataPager.PageSize = _pageSize;
                  bottomDataPager.PageSize = _pageSize;
  
                  string terms = Request.QueryString["s"];
                  if (!string.IsNullOrEmpty(terms))
                  {
                      SearchTerm = terms;
                      PerformSearch(terms);
                  }
              }
  
              base.OnLoad(e);
          }
          catch (Exception ex)
          {
              CustomValidator.IsValid = false;
              CustomValidator.ErrorMessage += Environment.NewLine + ex.Message;
          }
      }
  
      protected void searchResultsListView_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
      {
          try
          {
              if (SearchTerm != "")
              {
                  topDataPager.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
                  bottomDataPager.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
                  PerformSearch(SearchTerm);
              }
          }
          catch (Exception ex)
          {
              CustomValidator.IsValid = false;
              CustomValidator.ErrorMessage += Environment.NewLine + ex.Message;
          }
      }
  
      #endregion
  
      #region Methods
  
      private void PerformSearch(string searchTerm)
      {
          if (string.IsNullOrEmpty(searchTerm)) return;
  
          var criteria = ExamineManager.Instance
              .SearchProviderCollection["ExternalSearcher"]
              .CreateSearchCriteria(UmbracoExamine.IndexTypes.Content);
  
          // Find pages that contain our search text in either their nodeName or bodyText fields...
          // but exclude any pages that have been hidden.
          //var filter = criteria
          //    .GroupedOr(new string[] { "nodeName", "bodyText" }, searchTerm)
          //    .Not()
          //    .Field("umbracoNaviHide", "1")
          //    .Compile();
  
          Examine.SearchCriteria.IBooleanOperation filter = null;
          var searchKeywords = searchTerm.Split(' ');
          int i = 0;
          for (i = 0; i &lt; searchKeywords.Length; i++)
          {
              if (filter == null)
              {
                  filter = criteria.GroupedOr(new string[] { "nodeName", "bodyText", "browserTitle", "tags", "mediaTags" }, searchKeywords[i]);
              }
              else
              {
                  filter = filter.Or().GroupedOr(new string[] { "nodeName", "bodyText", "browserTitle", "tags", "mediaTags" }, searchKeywords[i]);
              }
          }
  
          //SearchResults = ExamineManager.Instance
          //    .SearchProviderCollection["ExternalSearcher"]
          //    .Search(filter);
  
          SearchResults = ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"].Search(filter.Compile());
  
          if (SearchResults.Count() &gt; 0)
          {
              searchResultsListView.DataSource = SearchResults.ToArray();
              searchResultsListView.DataBind();
              searchResultsListView.Visible = true;
              bottomDataPager.Visible = topDataPager.Visible = (SearchResults.Count() &gt; _pageSize);
          }
  
          summaryLiteral.Text = "&lt;p&gt;Your search for &lt;b&gt;" + searchTerm + "&lt;/b&gt; returned &lt;b&gt;" +   SearchResults.Count().ToString() + "&lt;/b&gt; result(s)&lt;/p&gt;";
  
          // Output the query which an be useful for debugging.
          queryLiteral.Text = criteria.ToString();
      }
  
      #endregion
    }
  }
  </code></pre>
  
  <p>I have done my Examine settings like this:</p>
  
  <p>ExamineIndex.Config</p>
  
  <pre><code>  &lt;IndexSet SetName="ExternalndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/ExternalIndex/"&gt;
        &lt;IndexAttributeFields&gt;
            &lt;add Name="id"/&gt;
            &lt;add Name="nodeName"/&gt;
            &lt;add Name="nodeTypeAlias"/&gt;
            &lt;add Name="parentID" /&gt;
        &lt;/IndexAttributeFields&gt;
        &lt;IndexUserFields&gt;
            &lt;add Name="bodyText"/&gt;
            &lt;add Name="umbracoNaviHide"/&gt;
       &lt;/IndexUserFields&gt;
       &lt;IncludeNodeTypes/&gt;
       &lt;ExcludeNodeTypes/&gt;
    &lt;/IndexSet&gt;
  </code></pre>
  
  <p>ExamineSettings.Config
  ExamineIndexProviders</p>
  
  <pre><code>      &lt;add name="ExternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
         runAsync="true"
          supportUnpublished="true"
         supportProtected="true"
         interval="10"
         analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"
         indexSet="DemoIndexSet"
         /&gt;
  </code></pre>
  
  <p>ExamineSearchProvide</p>
  
  <pre><code>       &lt;add name="ExternalSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
       analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"
         indexSet="DemoIndexSet"
         /&gt;   
  </code></pre>