Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PlainKeyword.cs
1using System.Collections.Generic;
2using System.Threading.Tasks;
3
5{
9 public class PlainKeyword : Keyword
10 {
15 public PlainKeyword(string Keyword)
16 {
17 this.Keyword = Keyword;
18 this.Ignore = string.IsNullOrEmpty(Keyword) ||
19 FullTextSearchModule.IsStopWord(Keyword);
20 }
21
25 public string Keyword { get; }
26
30 public override bool Ignore { get; }
31
35 public override int OrderComplexity => this.Keyword.Length;
36
38 public override bool Equals(object obj)
39 {
40 return obj is PlainKeyword k && this.Keyword == k.Keyword;
41 }
42
44 public override string ToString()
45 {
46 return this.Keyword;
47 }
48
54 public override async Task<IEnumerable<KeyValuePair<string, TokenReferences>>> GetTokenReferences(SearchProcess Process)
55 {
56 LinkedList<KeyValuePair<string, TokenReferences>> Result = new LinkedList<KeyValuePair<string, TokenReferences>>();
57 KeyValuePair<string, object>[] Records = await Process.Index.GetEntriesAsync(this.Keyword, this.Keyword + "!");
58
59 foreach (KeyValuePair<string, object> Rec in Records)
60 {
61 if (Rec.Value is TokenReferences References)
62 Result.AddLast(new KeyValuePair<string, TokenReferences>(this.Keyword, References));
63 }
64
65 return Result;
66 }
67 }
68}
Full-text search module, controlling the life-cycle of the full-text-search engine.
Abstract base class for keywords.
Definition: Keyword.cs:11
virtual async Task< bool > Process(SearchProcess Process)
Processes the keyword in a search process.
Definition: Keyword.cs:67
PlainKeyword(string Keyword)
Represents a plain text keyword.
Definition: PlainKeyword.cs:15
override bool Ignore
If keyword should be ignored.
Definition: PlainKeyword.cs:30
override async Task< IEnumerable< KeyValuePair< string, TokenReferences > > > GetTokenReferences(SearchProcess Process)
Gets available token references.
Definition: PlainKeyword.cs:54
override int OrderComplexity
Order complexity (within category) of keyword
Definition: PlainKeyword.cs:35
Contains information about a search process.
Contains a sequence of object references that include the token in its indexed text properties.