I'm trying to search the examine index that was included with Umbraco Forms. I can see that the index is healthy and working when I try it from the backend, but it will not return results from my custom search result page on the front end.
This works for returning external pages:
if (!String.IsNullOrEmpty(searchTerm) && ExamineManager.Instance.TryGetIndex("ExternalIndex", out IIndex index))
{
var searcher = index.GetSearcher();
var criteria = searcher.CreateQuery("content", BooleanOperation.And)
.GroupedOr(new List<string> { "combinedField" }, searchTerm);
var searchList = criteria.Execute();
var result = searchList.ToPublishedSearchResults(UmbracoContext.PublishedSnapshot.Content);
But if I simply replace the IndexName, IndexType and Field with the Umbraco Form Index values, nothing will return:
if (!String.IsNullOrEmpty(searchTerm) && ExamineManager.Instance.TryGetIndex("UmbracoFormsRecordsIndex", out IIndex index))
{
var searcher = index.GetSearcher();
var criteria = searcher.CreateQuery("UmbracoForms", BooleanOperation.And)
.GroupedOr(new List<string> { "RecordFields" }, searchTerm);
var searchList = criteria.Execute();
var result = searchList.ToPublishedSearchResults(UmbracoContext.PublishedSnapshot.Content);
if (!String.IsNullOrEmpty(searchTerm) && ExamineManager.Instance.TryGetIndex("ExternalIndex", out var index))
{
var searcher = index.GetSearcher();
var criteria = searcher.CreateQuery("content", BooleanOperation.And)
.GroupedOr(new List<string> { "combinedField" }, searchTerm.ToLower().MultipleCharacterWildcard())
.And()
.Field("searchablePath", Model.HomeNode.Id.ToString())
.Not()
.Field("umbracoNaviHide", "1");
var searchList = criteria.Execute();
var result = searchList.ToPublishedSearchResults(UmbracoContext.PublishedSnapshot.Content);
}
Searching the UmbracoFormsRecordIndex
I'm trying to search the examine index that was included with Umbraco Forms. I can see that the index is healthy and working when I try it from the backend, but it will not return results from my custom search result page on the front end.
This works for returning external pages:
But if I simply replace the IndexName, IndexType and Field with the Umbraco Form Index values, nothing will return:
Am I missing something obvious?
Thanks! md
Try like this
is working on a reply...