Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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
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
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 :(
Hmm this documentation has some good examples which you could use: http://our.umbraco.org/Documentation/Reference/Searching/Examine/index
Cheers! Got me started off a treat. Now I'm stuck on passing in multiple search words in!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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:
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
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
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 :(
Hmm this documentation has some good examples which you could use: http://our.umbraco.org/Documentation/Reference/Searching/Examine/index
Jeroen
Cheers! Got me started off a treat. Now I'm stuck on passing in multiple search words in!
is working on a reply...