private string VisitQuery(MatchPhraseClause clause) { var visitor = new ElasticSearchDSLVisitor(SchemaRetrieverMock.CreateMockSchemaRetriever()); visitor.Visit(clause); return(clause.KustoQL); }
/// <inheritdoc/> public override object ReadJson( JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var jo = JObject.Load(reader); var first = (JProperty)jo.First; if (first.First.GetType() == typeof(JObject)) { var obj = new MatchPhraseClause { FieldName = first.Name, Phrase = (string)first.First["query"], }; return(obj); } else { var obj = new MatchPhraseClause { FieldName = first.Name, Phrase = (string)((JValue)first.First).Value, }; return(obj); } }
/// <inheritdoc/> public void Visit(MatchPhraseClause matchPhraseClause) { Ensure.IsNotNull(matchPhraseClause, nameof(matchPhraseClause)); // Must have a field name EnsureClause.StringIsNotNullOrEmpty(matchPhraseClause.FieldName, nameof(matchPhraseClause.FieldName)); matchPhraseClause.KustoQL = $"{matchPhraseClause.FieldName} {KustoQLOperators.Equal} \"{matchPhraseClause.Phrase}\""; }
/// <inheritdoc/> public void Visit(MatchPhraseClause matchPhraseClause) { Ensure.IsNotNull(matchPhraseClause, nameof(matchPhraseClause)); // Must have a field name EnsureClause.StringIsNotNullOrEmpty(matchPhraseClause.FieldName, nameof(matchPhraseClause.FieldName)); if (matchPhraseClause.Phrase != null) { matchPhraseClause.KustoQL = $"{matchPhraseClause.FieldName} {KustoQLOperators.Equal} \"{matchPhraseClause.Phrase.EscapeSlashes()}\""; return; } matchPhraseClause.KustoQL = $"{matchPhraseClause.FieldName} {KustoQLOperators.Equal} \"\""; }