Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
GetFtsCollections.cs
1using System;
3using System.Threading.Tasks;
8
10{
15 {
23 : base(Array.Empty<ScriptNode>(), argumentTypes0, Start, Length, Expression)
24 {
25 }
26
34 public GetFtsCollections(ScriptNode IndexCollection,
36 : base(new ScriptNode[] { IndexCollection }, argumentTypes1Scalar,
38 {
39 }
40
44 public override string FunctionName => nameof(GetFtsCollections);
45
49 public override string[] DefaultArgumentNames => new string[]
50 {
51 "Index"
52 };
53
58 public override bool IsAsynchronous => true;
59
67 {
68 return this.EvaluateAsync(Arguments, Variables).Result;
69 }
70
77 public override async Task<IElement> EvaluateAsync(IElement[] Arguments, Variables Variables)
78 {
79 if (Arguments.Length == 0)
80 {
81 Dictionary<string, string[]> Collections = await Waher.Persistence.FullTextSearch.Search.GetCollectionNames();
82 Dictionary<string, IElement> Result = new Dictionary<string, IElement>();
83
84 foreach (KeyValuePair<string, string[]> Rec in Collections)
85 Result[Rec.Key] = new ObjectVector(Rec.Value);
86
87 return new ObjectValue(Result);
88 }
89 else
90 {
91 string Index = ToString(Arguments[0]) ?? string.Empty;
92 string[] Collections = await Waher.Persistence.FullTextSearch.Search.GetCollectionNames(Index);
93
94 return new ObjectVector(Collections);
95 }
96 }
97 }
98}
Static class for access to Full-Text-Search
Definition: Search.cs:67
static Task< Dictionary< string, string[]> > GetCollectionNames()
Gets the database collections that get indexed into a given index colltion.
Definition: Search.cs:264
Class managing a script expression.
Definition: Expression.cs:41
Gets collections indexed for full-text-search.
override bool IsAsynchronous
If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluat...
GetFtsCollections(ScriptNode IndexCollection, int Start, int Length, Expression Expression)
Gets collections indexed for full-text-search.
override string[] DefaultArgumentNames
Default Argument names
GetFtsCollections(int Start, int Length, Expression Expression)
Gets collections indexed for full-text-search.
override async Task< IElement > EvaluateAsync(IElement[] Arguments, Variables Variables)
Evaluates the function.
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
static readonly ArgumentType[] argumentTypes0
Zero parameters.
static readonly ArgumentType[] argumentTypes1Scalar
One scalar parameter.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
override string ToString()
Definition: ScriptNode.cs:359
Expression Expression
Expression of which the node is a part.
Definition: ScriptNode.cs:177
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:21
Definition: App.xaml.cs:4