Am getting some weird issues here with my examine search result where @nodeName is causing the razor file to crash.
Whenever i add the @result.Fields["nodeName"] the script crash, and if changed to bodyContent or @result.Id I works just fine.
Here is my razor script
var searchTerm = Request.Form["searchTerm"]; var list = 0; //Check if SearchQuery is Null if(String.IsNullOrEmpty(searchTerm)){ <p>Please use the search Box</p> return; }
var searcher = ExamineManager.Instance.SearchProviderCollection["EspralSearcher"]; var searchCriteria = searcher.CreateSearchCriteria(BooleanOperation.Or); var query = searchCriteria.GroupedOr(new string[] { "nodename", "nodeName", "bodyContent", "altPageTitle"}, searchTerm).Compile(); var searchResults = searcher.Search(query); var noResults = searchResults.Count(); <p> You Searched for <strong><u>@searchTerm</u></strong>, and found @noResults results</p> <div id="searchMnu"> <ul> @foreach (var result in searchResults) { list++; <li><a href="@umbraco.library.NiceUrl(result.Id)">@result.Fields["nodeName"]</a></li> <li><a href="@umbraco.library.NiceUrl(result.Id)">@result.Id</a> <br/>@Library.Truncate(@Library.StripHtml(result.Fields["bodyContent"]), 300)</li> } </ul> </div>
Anyone ever had this issue ? i have other site running with examine but they work just fine.
Yes but still not getting any result from @result.Fields["nodeName"] the other issue am getting is whenever i type Test in the search the script crashes.
Is Test a reserved tex here ? tes, tests, testing works perfectly.
Finally got it working, what was wrong is that i was actually getting some results from some other property field that was not being displayed. My mistake i guess for not checking if the field was empty or not and if so to display the content and URL.
Search Result not displaying "nodeName"
Hi everyone,
Am getting some weird issues here with my examine search result where @nodeName is causing the razor file to crash.
Whenever i add the @result.Fields["nodeName"] the script crash, and if changed to bodyContent or @result.Id I works just fine.
Here is my razor script
Anyone ever had this issue ? i have other site running with examine but they work just fine.
//fuji
Any help please? ?
Fuji,
Run the query in luke and see what you are getting back see if nodeName is missing for one of the results
Hi Ismail,
How can i be missing nodeName from the results ? Damn i cant use luke from where i am, need to access a local server at office .
You may have one dodgy result in there? Try re publishing the xml then rebuild the index see if that fixes it.
Well since i cant access the local network from where i am, i instead changed part of code to this
Wierd i just check my config file and do have nodeName attributes set up but still search crashes
did you try re publishing the xml and rebuilding the index?
Yes but still not getting any result from @result.Fields["nodeName"] the other issue am getting is whenever i type Test in the search the script crashes.
Is Test a reserved tex here ? tes, tests, testing works perfectly.
Hi Ismail,
Finally got it working, what was wrong is that i was actually getting some results from some other property field that was not being displayed. My mistake i guess for not checking if the field was empty or not and if so to display the content and URL.
is working on a reply...