refactoring the code.

This commit is contained in:
Ben
2024-06-04 17:32:31 +08:00
parent 9d85ca07f4
commit 7f970d489f
51 changed files with 806 additions and 700 deletions

View File

@ -4,16 +4,16 @@ using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json;
namespace Oqtane.Models
{
public class SearchDocument : ModelBase
public class SearchContent : ModelBase
{
public int SearchDocumentId { get; set; }
public int SearchContentId { get; set; }
[NotMapped]
public string UniqueKey => $"{IndexerName}:{EntryId}";
public string UniqueKey => $"{EntityName}:{EntityId}";
public int EntryId { get; set; }
public string EntityName { get; set; }
public string IndexerName { get; set; }
public int EntityId { get; set; }
public int SiteId { get; set; }
@ -27,15 +27,13 @@ namespace Oqtane.Models
public DateTime ModifiedTime { get; set; }
public bool IsActive { get; set; }
public bool IsActive { get; set; } = true;
public string AdditionalContent { get; set; }
public string LanguageCode { get; set; }
public IList<SearchContentProperty> Properties { get; set; }
public IList<SearchDocumentTag> Tags { get; set; }
public IList<SearchDocumentProperty> Properties { get; set; }
public IList<SearchContentWords> Words { get; set; }
public override string ToString()
{

View File

@ -3,12 +3,12 @@ using Microsoft.EntityFrameworkCore;
namespace Oqtane.Models
{
public class SearchDocumentProperty
public class SearchContentProperty
{
[Key]
public int PropertyId { get; set; }
public int SearchDocumentId { get; set; }
public int SearchContentId { get; set; }
public string Name { get; set; }

View File

@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations;
namespace Oqtane.Models
{
public class SearchContentWordSource
{
[Key]
public int WordSourceId { get; set; }
public string Word { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Oqtane.Models
{
public class SearchContentWords
{
[Key]
public int WordId { get; set; }
public int SearchContentId { get; set; }
public int WordSourceId { get; set; }
public int Count { get; set; }
public SearchContentWordSource WordSource { get; set; }
}
}

View File

@ -1,14 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace Oqtane.Models
{
public class SearchDocumentTag
{
[Key]
public int TagId { get; set; }
public int SearchDocumentId { get; set; }
public string Tag { get; set; }
}
}

View File

@ -14,14 +14,12 @@ namespace Oqtane.Models
public string Keywords { get; set; }
public IList<string> Sources { get; set; } = new List<string>();
public IList<string> EntityNames { get; set; } = new List<string>();
public DateTime BeginModifiedTimeUtc { get; set; }
public DateTime EndModifiedTimeUtc { get; set; }
public IList<string> Tags { get; set; } = new List<string>();
public IDictionary<string, string> Properties { get; set; } = new Dictionary<string, string>();
public int PageIndex { get; set; }

View File

@ -1,6 +1,6 @@
namespace Oqtane.Models
{
public class SearchResult : SearchDocument
public class SearchResult : SearchContent
{
public float Score { get; set; }