Added primitive search mechanism in backend.
Began implementing search mechanism for frontend.
This commit is contained in:
@@ -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; }
|
||||
|
||||
|
34
Props/Models/Search/QueryWordInfo.cs
Normal file
34
Props/Models/Search/QueryWordInfo.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user