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.Collections.Generic;
2using System.Threading.Tasks;
7
9{
14 {
23 {
24 }
25
33 public GetFtsCollections(ScriptNode IndexCollection,
35 : base(new ScriptNode[] { IndexCollection }, argumentTypes1Scalar,
37 {
38 }
39
43 public override string FunctionName => nameof(GetFtsCollections);
44
48 public override string[] DefaultArgumentNames => new string[]
49 {
50 "Index"
51 };
52
57 public override bool IsAsynchronous => true;
58
66 {
67 return this.EvaluateAsync(Arguments, Variables).Result;
68 }
69
76 public override async Task<IElement> EvaluateAsync(IElement[] Arguments, Variables Variables)
77 {
78 if (Arguments.Length == 0)
79 {
80 Dictionary<string, string[]> Collections = await Waher.Persistence.FullTextSearch.Search.GetCollectionNames();
81 Dictionary<string, IElement> Result = new Dictionary<string, IElement>();
82
83 foreach (KeyValuePair<string, string[]> Rec in Collections)
84 Result[Rec.Key] = new ObjectVector(Rec.Value);
85
86 return new ObjectValue(Result);
87 }
88 else
89 {
90 string Index = Arguments[0].AssociatedObjectValue?.ToString() ?? string.Empty;
91 string[] Collections = await Waher.Persistence.FullTextSearch.Search.GetCollectionNames(Index);
92
93 return new ObjectVector(Collections);
94 }
95 }
96 }
97}
Static class for access to Full-Text-Search
Definition: Search.cs:68
static Task< Dictionary< string, string[]> > GetCollectionNames()
Gets the database collections that get indexed into a given index colltion.
Definition: Search.cs:292
Class managing a script expression.
Definition: Expression.cs:39
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:20
Definition: App.xaml.cs:4