public string Visit_WithValidBoolQuery_ReturnsSuccess() { var luceneNetBoolQuery = new Lucene.Net.Search.BooleanQuery(); luceneNetBoolQuery.Clauses.Add( new Lucene.Net.Search.BooleanClause( new Lucene.Net.Search.WildcardQuery( new Lucene.Net.Index.Term("*", "Lo*d?n")), Lucene.Net.Search.Occur.MUST_NOT)); var boolQuery = new LuceneBoolQuery { LuceneQuery = luceneNetBoolQuery, }; var luceneVisitor = new LuceneVisitor(); luceneVisitor.Visit(boolQuery); var es = boolQuery.ESQuery; Assert.NotNull(es); var visitor = new ElasticSearchDSLVisitor(SchemaRetrieverMock.CreateMockSchemaRetriever()); visitor.Visit((BoolQuery)es); return(((BoolQuery)es).KustoQL); }
internal static ElasticSearchDSLVisitor CreateAndVisitRootVisitor(string name = "dayOfWeek", string type = "string") { var visitor = new ElasticSearchDSLVisitor(SchemaRetrieverMock.CreateMockSchemaRetriever(name, type)); VisitRootDsl(visitor); return(visitor); }
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 = new ElasticSearchDSLVisitor(SchemaRetrieverMock.CreateMockSchemaRetriever()); visitor.Visit((QueryStringClause)es); return(((QueryStringClause)es).KustoQL); }
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 = new ElasticSearchDSLVisitor(SchemaRetrieverMock.CreateMockSchemaRetriever()); visitor.Visit((RangeClause)es); return(((RangeClause)es).KustoQL); }
public string Visit_WithValidWildcardQuery_ReturnsValidReponse() { var prefixQuery = new LucenePrefixQuery { LuceneQuery = new Lucene.Net.Search.PrefixQuery( new Lucene.Net.Index.Term("*", "Kfar-Sa*")), }; var luceneVisitor = new LuceneVisitor(); luceneVisitor.Visit(prefixQuery); var es = prefixQuery.ESQuery; Assert.NotNull(es); var visitor = new ElasticSearchDSLVisitor(SchemaRetrieverMock.CreateMockSchemaRetriever()); visitor.Visit((QueryStringClause)es); return(((QueryStringClause)es).KustoQL); }
public string Visit_WithValidEscapedWildcardQuery_ReturnsValidResponse() { var wildcardQuery = new LuceneWildcardQuery { LuceneQuery = new Lucene.Net.Search.WildcardQuery( new Lucene.Net.Index.Term("*", "L\\o*d?n")), }; var luceneVisitor = new LuceneVisitor(); luceneVisitor.Visit(wildcardQuery); var es = wildcardQuery.ESQuery; Assert.NotNull(es); var visitor = new ElasticSearchDSLVisitor(SchemaRetrieverMock.CreateMockSchemaRetriever()); visitor.Visit((QueryStringClause)es); return(((QueryStringClause)es).KustoQL); }