breaking search modifications into smaller PRs

This commit is contained in:
sbwalker
2024-06-28 15:43:54 -04:00
parent 22063248ca
commit 0178e015e3
9 changed files with 89 additions and 57 deletions

View File

@ -95,19 +95,15 @@ namespace Oqtane.Managers.Search
searchContent.EntityName = EntityNames.Module;
}
if(searchContent.EntityId == 0)
if(string.IsNullOrEmpty(searchContent.EntityId))
{
searchContent.EntityId = pageModule.ModuleId;
searchContent.EntityId = pageModule.ModuleId.ToString();
}
if (searchContent.IsActive)
{
searchContent.IsActive = !pageModule.Module.IsDeleted;
}
if (searchContent.ModifiedTime == DateTime.MinValue)
if (searchContent.ContentModifiedOn == DateTime.MinValue)
{
searchContent.ModifiedTime = pageModule.ModifiedOn;
searchContent.ContentModifiedOn = pageModule.ModifiedOn;
}
if (string.IsNullOrEmpty(searchContent.AdditionalContent))

View File

@ -48,16 +48,18 @@ namespace Oqtane.Managers.Search
var searchContent = new SearchContent
{
EntityName = EntityNames.Page,
EntityId = page.PageId,
SiteId = page.SiteId,
ModifiedTime = page.ModifiedOn,
AdditionalContent = string.Empty,
Url = $"{(!string.IsNullOrEmpty(page.Path) && !page.Path.StartsWith("/") ? "/" : "")}{page.Path}",
EntityName = EntityNames.Page,
EntityId = page.PageId.ToString(),
Title = !string.IsNullOrEmpty(page.Title) ? page.Title : page.Name,
Description = string.Empty,
Body = $"{page.Name} {page.Title}",
IsActive = !page.IsDeleted && Utilities.IsPageModuleVisible(page.EffectiveDate, page.ExpiryDate)
Url = $"{(!string.IsNullOrEmpty(page.Path) && !page.Path.StartsWith("/") ? "/" : "")}{page.Path}",
Permissions = $"{EntityNames.Page}:{page.PageId}",
ContentModifiedBy = page.ModifiedBy,
ContentModifiedOn = page.ModifiedOn,
AdditionalContent = string.Empty,
CreatedOn = DateTime.UtcNow
};
if (searchContent.SearchContentProperties == null)