Added primitive search mechanism in backend.

Began implementing search mechanism for frontend.
This commit is contained in:
2021-08-05 01:22:19 -05:00
parent f71758ca69
commit c94ea4a624
56 changed files with 1623 additions and 490 deletions

View File

@@ -7,7 +7,7 @@ namespace Props.Models.Search
{
public int Id { get; set; }
public string OriginName { get; set; }
public string ShopName { get; set; }
public uint Hits { get; set; }

View File

@@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Props.Models.Search
{
public class QueryWordInfo
{
public int Id { get; set; }
[Required]
public string Word { get; set; }
public uint Hits { get; set; }
[Required]
public virtual ISet<QueryWordInfo> Preceding { get; set; }
[Required]
public virtual ISet<QueryWordInfo> Following { get; set; }
public QueryWordInfo()
{
this.Preceding = new HashSet<QueryWordInfo>();
this.Following = new HashSet<QueryWordInfo>();
}
public QueryWordInfo(ISet<QueryWordInfo> preceding, ISet<QueryWordInfo> following)
{
this.Preceding = preceding;
this.Following = following;
}
}
}

View File

@@ -17,10 +17,13 @@ namespace Props.Models.Search
[Required]
public virtual ApplicationUser ApplicationUser { get; set; }
[Required]
public string Name { get; set; } = "Default";
public Filters Filters { get; set; } = new Filters();
[Required]
public ShopsDisabled Disabled { get; set; } = new ShopsDisabled();
public ShopsDisabled Enabled { get; set; } = new ShopsDisabled();
public sealed class ShopsDisabled : HashSet<string>
{
@@ -68,12 +71,26 @@ namespace Props.Models.Search
return
Id == other.Id &&
Filters.Equals(other.Filters) &&
Disabled.Equals(other.Disabled);
Enabled.Equals(other.Enabled);
}
public override int GetHashCode()
{
return Id;
return HashCode.Combine(Id, Name);
}
public SearchOutline()
{
this.Name = "Default";
this.Filters = new Filters();
this.Enabled = new ShopsDisabled();
}
public SearchOutline(string name, Filters filters, ShopsDisabled disabled)
{
this.Name = name;
this.Filters = filters;
this.Enabled = disabled;
}
}
}