Added collection classes. Will not do extra collection for subcomments rn.

This commit is contained in:
schnulller
2022-06-26 22:48:25 +02:00
parent 056ab77888
commit 0fa0ff6a88
22 changed files with 490 additions and 226 deletions

View File

@@ -1,3 +1,5 @@
using System.Reflection.Emit;
using System.Collections;
namespace HaWeb.Models;
using HaWeb.SearchHelpers;
using HaWeb.XMLParser;
@@ -5,25 +7,30 @@ using System.Xml.Linq;
public class CollectedItem : ISearchable {
public string Index { get; private set; }
public string Collection { get; private set; }
public string? SearchText { get; private set; }
public Dictionary<string, string[]>? Fields { get; private set; }
public IDictionary<string, string>? Fields { get; private set; }
public XElement ELement { get; private set; }
public IXMLRoot Root { get; private set; }
public IXMLCollection Collection { get; private set; }
public CollectedItem(
string index,
XElement element,
IXMLRoot root,
string collection,
Dictionary<string, string[]>? fields,
IXMLCollection collection,
IDictionary<string, string>? fields,
string? searchtext = null
) {
this.Index = index;
this.SearchText = searchtext;
this.Collection = collection;
this.Root = root;
this.ELement = element;
this.Fields = fields;
}
public string? this[string v] {
get {
if (Fields != null && Fields.ContainsKey(v))
return Fields[v];
return null;
}
}
}