Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
FtsFile.cs
1using System.Threading.Tasks;
6
8{
13 {
22 public FtsFile(ScriptNode IndexCollection, ScriptNode FileName,
24 : base(new ScriptNode[] { IndexCollection, FileName }, argumentTypes2Scalar,
26 {
27 }
28
32 public override string FunctionName => nameof(FtsFile);
33
37 public override string[] DefaultArgumentNames => new string[] { "IndexCollection", "FileName" };
38
43 public override bool IsAsynchronous => true;
44
52 {
53 return this.EvaluateAsync(Arguments, Variables).Result;
54 }
55
62 public override async Task<IElement> EvaluateAsync(IElement[] Arguments, Variables Variables)
63 {
64 int i = 0;
65 string Index = ToString(Arguments[i++]) ?? string.Empty;
66 string FileName = ToString(Arguments[i++]) ?? string.Empty;
67
68 if (string.IsNullOrEmpty(FileName))
69 throw new ScriptRuntimeException("Empty filename.", this);
70
71 bool Result = await Waher.Persistence.FullTextSearch.Search.IndexFile(Index, FileName);
72
73 return Result ? BooleanValue.True : BooleanValue.False;
74 }
75 }
76}
Static class for access to Full-Text-Search
Definition: Search.cs:67
static Task< bool > IndexFile(string IndexCollection, string FileName)
Indexes or reindexes a file.
Definition: Search.cs:310
Class managing a script expression.
Definition: Expression.cs:41
FtsFile(ScriptNode IndexCollection, ScriptNode FileName, int Start, int Length, Expression Expression)
Indexes a specific file.
Definition: FtsFile.cs:22
override string[] DefaultArgumentNames
Default Argument names
Definition: FtsFile.cs:37
override string FunctionName
Name of the function
Definition: FtsFile.cs:32
override async Task< IElement > EvaluateAsync(IElement[] Arguments, Variables Variables)
Evaluates the function.
Definition: FtsFile.cs:62
override bool IsAsynchronous
If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluat...
Definition: FtsFile.cs:43
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
Definition: FtsFile.cs:51
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
static readonly ArgumentType[] argumentTypes2Scalar
Two scalar parameters.
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
Boolean-valued number.
Definition: BooleanValue.cs:12
static readonly BooleanValue False
Constant false value.
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:21
Definition: App.xaml.cs:4