I'm trying to build a search to return both matching page titles and matching content from within content pages.
I have included the code from here to index blocklist content as well.
I can find matching page titles no problem but no matter what I try I can't get it to find anything within page content.
Can anyone post a link to an example that works?
At the moment I'm working with this:
public IEnumerable<ResultItem?> SearchUmbraco(string searchTerm, int websiteId)
{
var examineSearcher = _examineManager.TryGetIndex("ExternalIndex", out var externalIndex)
? externalIndex.Searcher
: null;
var criteria = examineSearcher?.CreateQuery("content").GroupedOr(new[] { "nodeName", "content" }, searchTerm);
var filter = criteria.Field("nodeName",
ISearchResults results = filter.Execute();
// convert the results to a list of ResultItem objects while filtering out irrelevant results from other sites etc
var content = results.Select(x => ConvertToResult(int.Parse(x.Id), websiteId, x.Score))
.Where(x => x != null)
.ToList();
return content.OrderByDescending(x => x.score);
}
Examine search for Umbraco 10
I'm trying to build a search to return both matching page titles and matching content from within content pages.
I have included the code from here to index blocklist content as well. I can find matching page titles no problem but no matter what I try I can't get it to find anything within page content.
Can anyone post a link to an example that works?
At the moment I'm working with this:
is working on a reply...