Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Keyword.cs
1using System.Collections.Generic;
2using System.Threading.Tasks;
4
6{
10 public abstract class Keyword
11 {
15 public Keyword()
16 {
17 }
18
22 public virtual bool Optional => true;
23
27 public virtual bool Required => false;
28
32 public virtual bool Prohibited => false;
33
37 public virtual int OrderCategory => 0;
38
42 public virtual int OrderComplexity => 0;
43
47 public virtual bool Ignore => false;
48
50 public new abstract bool Equals(object obj);
51
53 public new abstract string ToString();
54
60 public abstract Task<IEnumerable<KeyValuePair<string, TokenReferences>>> GetTokenReferences(SearchProcess Process);
61
67 public virtual async Task<bool> Process(SearchProcess Process)
68 {
69 IEnumerable<KeyValuePair<string, TokenReferences>> Records = await this.GetTokenReferences(Process);
70
71 foreach (KeyValuePair<string, TokenReferences> Rec in Records)
72 {
73 string Token = Rec.Key;
74 TokenReferences References = Rec.Value;
75
76 int j, d = References.ObjectReferences.Length;
77
78 for (j = 0; j < d; j++)
79 {
80 ulong ObjectReference = References.ObjectReferences[j];
81
82 if (!Process.ReferencesByObject.TryGetValue(ObjectReference, out MatchInformation ByObjectReference))
83 {
84 if (Process.IsRestricted)
85 continue;
86
87 ByObjectReference = new MatchInformation();
88 Process.ReferencesByObject[ObjectReference] = ByObjectReference;
89 }
90
91 ByObjectReference.AddTokenReference(new TokenReference()
92 {
93 Count = References.Counts[j],
94 LastBlock = References.LastBlock,
96 Timestamp = References.Timestamps[j],
97 Token = Token
98 });
99 }
100 }
101
102 return true;
103 }
104
105 }
106}
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
virtual bool Prohibited
If keyword is prohibited
Definition: Keyword.cs:32
virtual bool Ignore
If keyword should be ignored.
Definition: Keyword.cs:47
virtual bool Required
If keyword is required
Definition: Keyword.cs:27
virtual int OrderCategory
Order category of keyword
Definition: Keyword.cs:37
virtual int OrderComplexity
Order complexity (within category) of keyword
Definition: Keyword.cs:42
virtual bool Optional
If keyword is optional
Definition: Keyword.cs:22
Keyword()
Abstract base class for keywords.
Definition: Keyword.cs:15
abstract Task< IEnumerable< KeyValuePair< string, TokenReferences > > > GetTokenReferences(SearchProcess Process)
Gets available token references.
Contains information about a search process.
Contains a reference to an indexed object.
Contains matching information about a document in a search.
Contains a sequence of object references that include the token in its indexed text properties.
DateTime[] Timestamps
Timestamps when corresponding object refernces were indexed.
uint[] Counts
Token counts for respective object reference.
ulong[] ObjectReferences
References to objects containing the token.
uint LastBlock
Index to last block in index representing the same token.