Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Craig O'Mahony 363 posts 917 karma points
    Jun 24, 2013 @ 17:56
    Craig O'Mahony
    0

    Unable to get Examine Working

    Hi Folks,

    I'm in an 4.9.1 build of Umbraco and I'm trying to set up a search page using Examine in a user control. I've followed the video instructions at http://umbraco.com/help-and-support/video-tutorials/developing-with-umbraco/examine but I'm receiving an erroring the following piece of code:

    public partial class usercontrols_CLTSearch : System.Web.UI.UserControl
    {
        /// <summary>
        /// The term being searched on
        /// </summary>
        protected string SearchTerm { get; private set; }
        /// <summary>
        /// The search results list
        /// </summary>
        protected IEnumerable<SearchResult> SearchResults { get; private set; }
        public CLTSearchResults()
        {
            SearchTerm = string.Empty;
            SearchResults = new List<SearchResult>();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SearchTerm = Request.QueryString["s"];
            if (string.IsNullOrEmpty(SearchTerm)) return;
            var criteria = ExamineManager.Instance
                .SearchProviderCollection["CLTSearcher"]
                .CreateSearchCriteria();
            var filter = criteria
                .GroupedOr(new string[] {"nodeName", "bodyText"},SearchTerm)
                .Not()
                .Field("umbracoNavihide", "1")
                .Compile();
            SearchResults = ExamineManager.Instance.SearchProviderCollection["CLTSearcher"].Search(filter);
            SearchResultListing.DataSource = SearchResults;
            SearchResultListing.DataBind();
        }
    }

     

    The declaration of  public CLTSearchResults() is returning an error of Method must have a return type.

    Does anyone have other examples/tutorials or can anyone see what's wrong?

    Thanks in advance,

    Craig

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jun 24, 2013 @ 20:11
    Jeroen Breuer
    0

    The Examine API has changed over the last couple of versions so perhaps the video is old. If you want to use Examine for searching you should try this package: http://our.umbraco.org/projects/website-utilities/ezsearch

    Jeroen

  • Craig O'Mahony 363 posts 917 karma points
    Jun 25, 2013 @ 11:06
    Craig O'Mahony
    0

    Hi Jeroen,

    Thanks for your response, sadly I'm not running a MVC solution (win forms) although it does appear that I could use this with Razor but according to the docs it runs on v6+ and I'm running 4.9 :(

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jun 25, 2013 @ 12:15
    Jeroen Breuer
    0

    Hmm this documentation has some good examples which you could use: http://our.umbraco.org/Documentation/Reference/Searching/Examine/index

    Jeroen

  • Craig O'Mahony 363 posts 917 karma points
    Jun 27, 2013 @ 00:23
    Craig O'Mahony
    0

    Cheers! Got me started off a treat. Now I'm stuck on passing in multiple search words in!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies