Craig100
07/28/2023, 10:00 PMvar searchQuery = umbIndex.Searcher.CreateQuery(IndexTypes.Content)
.NodeTypeAlias("generalPage")
.And().Field("mainContent", searchTerm)
.Not().Field("umbracoNaviHide", 1.ToString())
.Not().Field("published", "n");
umbIndex is an IUmbracoIndex and it has a .GetCultureFields(Index, Culture) on it, but I doubt it's useful. I should just mention this is in a View with the following injections:-
@inject IExamineManager _examineManager
@inject IPublishedSnapshotAccessor _publishedSnapshotAccessor
Any ideas appreciated.D_Inventor
07/29/2023, 7:58 AMCraig100
07/29/2023, 8:36 AM+__NodeTypeAlias:generalpage +mainContent.items[0].text_en-gb:financial
, but that got me nothing in the back office. But as you say, using +__NodeTypeAlias:generalpage +mainContent_en-gb:financial
gets results.
So code is now like this and it works!
string searchFieldWithCulture = "mainContent_" + culture;
var searchQuery = umbIndex.Searcher.CreateQuery(IndexTypes.Content)
.NodeTypeAlias("generalPage")
.And().Field(searchFieldWithCulture, searchTerm)
.Not().Field("umbracoNaviHide", 1.ToString())
.Not().Field("published", "n");
Thanks.