@{ //Get the domain (http://localhost:6436) var siteURL = "http://" + Request.Url.Authority;
//Get the values posted from the form var searchTerm = Request["term"];
//Check if searchTerm is null from the posted form data... if (String.IsNullOrEmpty(searchTerm)) { //Stop all other code running in this Macro return; }
var searcher = ExamineManager.Instance.SearchProviderCollection["SearchBoxSearcher"]; var searchCriteria = searcher.CreateSearchCriteria(BooleanOperation.Or); var query = searchCriteria.GroupedOr(new string[] { "newsText" }, searchTerm).Compile(); var searchResults = searcher.Search(query);
List<dynamic> searchResultKeyVals = new List<dynamic>();
//Convert the search results as JSON foreach(var result in searchResults) { searchResultKeyVals.Add(new { id = siteURL + umbraco.library.NiceUrl(result.Id), label = result.Fields["newsText"], value = result.Fields["newsText"] }); }
JavaScriptSerializer serializer = new JavaScriptSerializer(); var JSONResults = serializer.Serialize(searchResultKeyVals); }
Search JSON. I can't do it work...
Hi,
I am trying to implement this functionality on my webpage. It is the first time that I create a webpage using Umbraco and I am still learning...
Can anyone tell me what I am doing wrong?
When the search is launched, the result always is empty... nothing returns...
Here is mi code:
ExamineIndex.config
ExamineSettings.config
SearchJSON.cshtml
Thanks!
I have installed Examine Dashboard and I get this:
Queue
1 file in queue -> Last update 6/19/2012 9:09:00 AM
Number of documents
0
Log
....
What I am doing wrong????¿?
I have instaled "Examine Dashboard" to know what is happen and these are the results:
- InternalIndexer
This one comes whit Umbraco and works fine.
- InternalMemberIndexer
This one comes whit Umbraco and generates a queue file but this is all.... nothing is indexed.
- SearchBoxIndexer
I have created this one and generates a queue file but this is all.... nothing is indexed.
Any idea????
is working on a reply...