Hello Everyone,
I'm trying to get search result using tags, in kentico 13 .NET Core. Please suggest me what I'm missing in below code logic, or is there any alternative way to achieve this functionality
string searchText = HttpContext.Request.Query["searchtext"].ToString();
string extraConditions = "|| documenttags:(" + searchText + ")";
var condition = new SearchCondition(extraConditions, SearchModeEnum.AnyWord, SearchOptionsEnum.FullSearch);
string searchCondition = SearchSyntaxHelper.CombineSearchCondition(searchText, condition);
SearchParameters parameters = new SearchParameters
{
SearchFor = searchCondition,
SearchIndexes = properties.SmartSearch,
StartingPosition = 0,
DisplayResults = 100,
NumberOfProcessedResults = 100,
NumberOfResults = 0,
};
return await Task.FromResult((IViewComponentResult)View("~/Components/Widgets/SmartSearch/_SmartSearch.cshtml", new SmartSearchViewModel()
{
SearchResultItems = _smartSearchRepository.GetSearchResults(parameters),
PageSize = string.IsNullOrEmpty(properties.PageSize) ? "9" : properties.PageSize
}));
Thanks,
Any help or suggestion appreciated in advance.