search refactoring
This commit is contained in:
@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public interface ISearchIndexManager
|
||||
{
|
||||
int Priority { get; }
|
||||
|
||||
string Name { get; }
|
||||
|
||||
bool IsIndexEnabled(int siteId);
|
||||
|
||||
int IndexContent(int siteId, DateTime? startTime, Action<List<SearchContent>> processSearchContent, Action<string> handleError);
|
||||
}
|
||||
}
|
@ -1,5 +1,3 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Models;
|
||||
@ -8,7 +6,7 @@ namespace Oqtane.Services
|
||||
{
|
||||
public interface ISearchService
|
||||
{
|
||||
void IndexContent(int siteId, DateTime? startTime, Action<string> logNote, Action<string> handleError);
|
||||
Task SaveSearchContentAsync(List<SearchContent> searchContents);
|
||||
|
||||
Task<SearchResults> SearchAsync(SearchQuery searchQuery);
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Interfaces
|
||||
{
|
||||
public interface ISearchable
|
||||
{
|
||||
public List<SearchContent> GetSearchContents(PageModule pageModule, DateTime startTime);
|
||||
public Task<List<SearchContent>> GetSearchContentsAsync(PageModule pageModule, DateTime lastIndexedOn);
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,9 @@ namespace Oqtane.Models
|
||||
[NotMapped]
|
||||
public int TenantId { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
// constructors
|
||||
public SearchContent() { }
|
||||
|
||||
|
@ -81,7 +81,9 @@ namespace Oqtane.Shared
|
||||
public const string DefaultSearchProviderName = "Database";
|
||||
public const string SearchPageIdPropertyName = "PageId";
|
||||
public const string SearchModuleIdPropertyName = "ModuleId";
|
||||
|
||||
|
||||
public static readonly string[] InternalPagePaths = { "login", "register", "reset", "404" };
|
||||
|
||||
// Obsolete constants
|
||||
|
||||
const string RoleObsoleteMessage = "Use the corresponding member from Oqtane.Shared.RoleNames";
|
||||
|
@ -560,7 +560,7 @@ namespace Oqtane.Shared
|
||||
|
||||
return (localDateTime?.Date, localTime);
|
||||
}
|
||||
public static bool IsPageModuleVisible(DateTime? effectiveDate, DateTime? expiryDate)
|
||||
public static bool IsEffectiveOrExpired(DateTime? effectiveDate, DateTime? expiryDate)
|
||||
{
|
||||
DateTime currentUtcTime = DateTime.UtcNow;
|
||||
|
||||
@ -582,6 +582,7 @@ namespace Oqtane.Shared
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ValidateEffectiveExpiryDates(DateTime? effectiveDate, DateTime? expiryDate)
|
||||
{
|
||||
// Treat DateTime.MinValue as null
|
||||
@ -609,6 +610,7 @@ namespace Oqtane.Shared
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("ContentUrl(Alias alias, int fileId) is deprecated. Use FileUrl(Alias alias, int fileId) instead.", false)]
|
||||
public static string ContentUrl(Alias alias, int fileId)
|
||||
{
|
||||
@ -623,5 +625,12 @@ namespace Oqtane.Shared
|
||||
|
||||
return $"{alias?.BaseUrl}{aliasUrl}{Constants.ContentUrl}{fileId}{method}";
|
||||
}
|
||||
|
||||
[Obsolete("IsPageModuleVisible(DateTime?, DateTime?) is deprecated. Use IsEffectiveOrExpired(DateTime?, DateTime?) instead.", false)]
|
||||
public static bool IsPageModuleVisible(DateTime? effectiveDate, DateTime? expiryDate)
|
||||
{
|
||||
return IsEffectiveOrExpired(effectiveDate, expiryDate);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user