Implemented Fulltext search across tags and linebreaks for letters

This commit is contained in:
schnulller
2022-06-19 00:01:14 +02:00
parent 078c4b75b8
commit 4ef0e260e0
24 changed files with 510 additions and 148 deletions

View File

@@ -4,31 +4,17 @@ using HaDocument.Comparers;
using HaDocument.Interfaces;
using System.Collections.Generic;
public class DocumentSearchResult {
public Meta MetaData { get; }
public List<DocumentResult> Results { get; }
public class SearchResult {
public string Search { get; private set; }
public string Index { get; private set; }
public string? Page { get; set; }
public string? Line { get; set; }
public string? Preview { get; set; }
// TODO:
public string? ParsedPreview { get; set; }
public DocumentSearchResult(Meta meta) {
MetaData = meta;
Results = new List<DocumentResult>(4);
}
}
public class DocumentResult {
public string PreviewString { get; }
public string Page { get; }
public string Line { get; }
public DocumentResult(string previewstring, string page, string line) {
PreviewString = previewstring;
Page = page;
Line = line;
}
}
public class LetterComparer : IComparer<DocumentSearchResult> {
public int Compare(DocumentSearchResult first, DocumentSearchResult second) {
var cmp = new DefaultComparer();
return cmp.Compare(first.MetaData, second.MetaData);
public SearchResult(string search, string index) {
Search = search;
Index = index;
}
}

View File

@@ -1,4 +1,5 @@
namespace HaWeb.Models;
using HaDocument.Models;
public class SucheViewModel {
public List<(int Year, List<BriefeMetaViewModel> LetterList)>? Letters { get; private set; }
@@ -11,6 +12,7 @@ public class SucheViewModel {
public string? ActiveVolume { get; private set; }
public string? ActivePage { get; private set; }
public string? ActiveSearch { get; private set; }
public Dictionary<string, List<SearchResult>>? SearchResults { get; private set; }
public SucheViewModel(
List<(int Year, List<BriefeMetaViewModel> LetterList)>? letters,
@@ -19,7 +21,9 @@ public class SucheViewModel {
List<(string Key, string Name)>? availablePersons,
List<(string Volume, List<string> Pages)>? availablePages,
string? activeVolume,
string? activePage
string? activePage,
string? activeSearch,
Dictionary<string, List<SearchResult>>? searchResults
) {
Letters = letters;
if (letters != null)
@@ -32,5 +36,7 @@ public class SucheViewModel {
AvailablePages = availablePages;
ActiveVolume = activeVolume;
ActivePage = activePage;
ActiveSearch = activeSearch;
SearchResults = searchResults;
}
}