Beispiel #1
0
        private static string VisitQuery(QueryStringClause queryStringClause)
        {
            var visitor = VisitorTestsUtils.CreateAndVisitRootVisitor();

            visitor.Visit(queryStringClause);
            return(queryStringClause.KustoQL);
        }
        private static string RangeClauseToKQL(RangeClause rangeClause)
        {
            var visitor = VisitorTestsUtils.CreateAndVisitRootVisitor("MyField", "long");

            visitor.Visit(rangeClause);
            return(rangeClause.KustoQL);
        }
        private static string VisitRangeClause(RangeClause clause, string fieldName = "MyField", string type = "string")
        {
            var visitor = VisitorTestsUtils.CreateAndVisitRootVisitor(fieldName, type);

            visitor.Visit(clause);
            return(clause.KustoQL);
        }
Beispiel #4
0
        public string Visit_WithValidRangeQuery_ReturnsValidResponse()
        {
            var rangeQuery = new LuceneRangeQuery
            {
                LuceneQuery =
                    new Lucene.Net.Search.TermRangeQuery(
                        "days",
                        "2",
                        "6",
                        true,
                        true),
            };

            var luceneVisitor = new LuceneVisitor();

            rangeQuery.Accept(luceneVisitor);

            var es = rangeQuery.ESQuery;

            Assert.NotNull(es);

            var visitor = VisitorTestsUtils.CreateAndVisitRootVisitor("days", "long");

            visitor.Visit((RangeClause)es);

            return(((RangeClause)es).KustoQL);
        }
Beispiel #5
0
        public string Visit_WithValidTermPhraseQuery_ReturnsValidReponse()
        {
            var query = new Lucene.Net.Search.PhraseQuery();

            query.Add(new Lucene.Net.Index.Term("City", "TelAviv"));

            var phraseQuery = new LucenePhraseQuery
            {
                LuceneQuery = query,
            };

            var luceneVisitor = new LuceneVisitor();

            phraseQuery.Accept(luceneVisitor);

            var es = phraseQuery.ESQuery;

            Assert.NotNull(es);

            var visitor = VisitorTestsUtils.CreateAndVisitRootVisitor();

            visitor.Visit((QueryStringClause)es);

            return(((QueryStringClause)es).KustoQL);
        }
Beispiel #6
0
        private string TestRangeClause(string queryString, string field = "MyField", string type = "string")
        {
            var query   = JsonConvert.DeserializeObject <Query>(queryString);
            var visitor = VisitorTestsUtils.CreateAndVisitRootVisitor(field, type);

            query.Accept(visitor);
            return(query.KustoQL);
        }
Beispiel #7
0
        public string TestPrefixQuery(string queryString)
        {
            var query   = JsonConvert.DeserializeObject <Query>(queryString);
            var visitor = VisitorTestsUtils.CreateAndVisitRootVisitor();

            query.Accept(visitor);
            return(query.KustoQL);
        }
        public string Visit_WithValidWildcardTermQuery_ReturnsValidResponse()
        {
            var termQuery = new LuceneTermQuery
            {
                LuceneQuery =
                    new Lucene.Net.Search.TermQuery(
                        new Lucene.Net.Index.Term("*", "Kfar-Saba")),
            };

            var luceneVisitor = new LuceneVisitor();

            luceneVisitor.Visit(termQuery);

            var es = termQuery.ESQuery;

            Assert.NotNull(es);

            var visitor = VisitorTestsUtils.CreateAndVisitRootVisitor();

            visitor.Visit((QueryStringClause)es);

            return(((QueryStringClause)es).KustoQL);
        }