search refactoring
This commit is contained in:
@ -127,19 +127,19 @@ namespace Oqtane.Managers.Search
|
||||
searchContent.Title = !string.IsNullOrEmpty(page.Title) ? page.Title : page.Name;
|
||||
}
|
||||
|
||||
if (searchContent.Properties == null)
|
||||
if (searchContent.SearchContentProperties == null)
|
||||
{
|
||||
searchContent.Properties = new List<SearchContentProperty>();
|
||||
searchContent.SearchContentProperties = new List<SearchContentProperty>();
|
||||
}
|
||||
|
||||
if(!searchContent.Properties.Any(i => i.Name == Constants.SearchPageIdPropertyName))
|
||||
if(!searchContent.SearchContentProperties.Any(i => i.Name == Constants.SearchPageIdPropertyName))
|
||||
{
|
||||
searchContent.Properties.Add(new SearchContentProperty { Name = Constants.SearchPageIdPropertyName, Value = pageModule.PageId.ToString() });
|
||||
searchContent.SearchContentProperties.Add(new SearchContentProperty { Name = Constants.SearchPageIdPropertyName, Value = pageModule.PageId.ToString() });
|
||||
}
|
||||
|
||||
if (!searchContent.Properties.Any(i => i.Name == Constants.SearchModuleIdPropertyName))
|
||||
if (!searchContent.SearchContentProperties.Any(i => i.Name == Constants.SearchModuleIdPropertyName))
|
||||
{
|
||||
searchContent.Properties.Add(new SearchContentProperty { Name = Constants.SearchModuleIdPropertyName, Value = pageModule.ModuleId.ToString() });
|
||||
searchContent.SearchContentProperties.Add(new SearchContentProperty { Name = Constants.SearchModuleIdPropertyName, Value = pageModule.ModuleId.ToString() });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace Oqtane.Managers.Search
|
||||
public string GetUrl(SearchResult searchResult, SearchQuery searchQuery)
|
||||
{
|
||||
var pageRepository = _serviceProvider.GetRequiredService<IPageRepository>();
|
||||
var pageIdValue = searchResult.Properties?.FirstOrDefault(i => i.Name == Constants.SearchPageIdPropertyName)?.Value ?? string.Empty;
|
||||
var pageIdValue = searchResult.SearchContentProperties?.FirstOrDefault(i => i.Name == Constants.SearchPageIdPropertyName)?.Value ?? string.Empty;
|
||||
if(!string.IsNullOrEmpty(pageIdValue) && int.TryParse(pageIdValue, out int pageId))
|
||||
{
|
||||
var page = pageRepository.GetPage(pageId);
|
||||
@ -39,7 +39,7 @@ namespace Oqtane.Managers.Search
|
||||
|
||||
public bool Visible(SearchContent searchResult, SearchQuery searchQuery)
|
||||
{
|
||||
var pageIdValue = searchResult.Properties?.FirstOrDefault(i => i.Name == Constants.SearchPageIdPropertyName)?.Value ?? string.Empty;
|
||||
var pageIdValue = searchResult.SearchContentProperties?.FirstOrDefault(i => i.Name == Constants.SearchPageIdPropertyName)?.Value ?? string.Empty;
|
||||
if (!string.IsNullOrEmpty(pageIdValue) && int.TryParse(pageIdValue, out int pageId))
|
||||
{
|
||||
return CanViewPage(pageId, searchQuery.User);
|
||||
|
@ -64,14 +64,14 @@ namespace Oqtane.Managers.Search
|
||||
IsActive = !page.IsDeleted && Utilities.IsPageModuleVisible(page.EffectiveDate, page.ExpiryDate)
|
||||
};
|
||||
|
||||
if (searchContent.Properties == null)
|
||||
if (searchContent.SearchContentProperties == null)
|
||||
{
|
||||
searchContent.Properties = new List<SearchContentProperty>();
|
||||
searchContent.SearchContentProperties = new List<SearchContentProperty>();
|
||||
}
|
||||
|
||||
if (!searchContent.Properties.Any(i => i.Name == Constants.SearchPageIdPropertyName))
|
||||
if (!searchContent.SearchContentProperties.Any(i => i.Name == Constants.SearchPageIdPropertyName))
|
||||
{
|
||||
searchContent.Properties.Add(new SearchContentProperty { Name = Constants.SearchPageIdPropertyName, Value = page.PageId.ToString() });
|
||||
searchContent.SearchContentProperties.Add(new SearchContentProperty { Name = Constants.SearchPageIdPropertyName, Value = page.PageId.ToString() });
|
||||
}
|
||||
|
||||
searchContentList.Add(searchContent);
|
||||
|
Reference in New Issue
Block a user