Beispiel #1
0
 public IQuery Accept(IQueryVisitor visitor)
 {
     return(visitor.Visit(this));
 }
Beispiel #2
0
 public T Accept <T>(IQueryVisitor <IDetailQueryAtom, T> visitor) => visitor.Visit(this);
 /// <summary>
 /// Dispatches to the specific visit method for this node type.
 /// </summary>
 /// <param name="visitor">The visitor to visit this node with.</param>
 /// <returns>The result of visiting this node.</returns>
 protected abstract Expression AcceptSql(IQueryVisitor visitor);
Beispiel #4
0
        public void Walk(IQueryContainer qd, IQueryVisitor visitor)
        {
            visitor.Visit(qd);
            VisitQuery(qd.MatchAll, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.MatchNone, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.MoreLikeThis, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.MultiMatch, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.CommonTerms, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Fuzzy, visitor, (v, d) =>
            {
                v.Visit(d);
                VisitQuery(d as IFuzzyStringQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as IFuzzyNumericQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as IFuzzyDateQuery, visitor, (vv, dd) => v.Visit(dd));
            });
            VisitQuery(qd.Range, visitor, (v, d) =>
            {
                v.Visit(d);
                VisitQuery(d as IDateRangeQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as INumericRangeQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as ILongRangeQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as ITermRangeQuery, visitor, (vv, dd) => v.Visit(dd));
            });
            VisitQuery(qd.GeoShape, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Ids, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Intervals, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Prefix, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.QueryString, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Range, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.RankFeature, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Regexp, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.SimpleQueryString, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Term, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Terms, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Wildcard, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Match, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.MatchPhrase, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.MatchPhrasePrefix, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Script, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.ScriptScore, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Exists, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.GeoPolygon, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.GeoDistance, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.GeoBoundingBox, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.RawQuery, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Percolate, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.ParentId, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.TermsSet, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Pinned, visitor, (v, d) => v.Visit(d));

            VisitQuery(qd.Bool, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Filter, VisitorScope.Filter);
                Accept(v, d.Must, VisitorScope.Must);
                Accept(v, d.MustNot, VisitorScope.MustNot);
                Accept(v, d.Should, VisitorScope.Should);
            });

            VisitSpan(qd, visitor);

            VisitQuery(qd.Boosting, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.PositiveQuery, VisitorScope.PositiveQuery);
                Accept(v, d.NegativeQuery, VisitorScope.NegativeQuery);
            });
            VisitQuery(qd.ConstantScore, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Filter);
            });
            VisitQuery(qd.DisMax, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Queries);
            });
            VisitQuery(qd.DistanceFeature, visitor, (v, d) =>
            {
                v.Visit(d);
            });
            VisitQuery(qd.FunctionScore, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Query);
            });
            VisitQuery(qd.HasChild, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Query);
            });
            VisitQuery(qd.HasParent, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Query);
            });
            VisitQuery(qd.Nested, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Query);
            });
        }
Beispiel #5
0
 public void Walk(IQueryContainer qd, IQueryVisitor visitor)
 {
     visitor.Visit(qd);
     AcceptQuery(qd.MatchAllQuery, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.MoreLikeThis, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.MultiMatch, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.CommonTerms, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.Fuzzy, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.FuzzyLikeThis, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.GeoShape, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.Ids, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.Prefix, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.QueryString, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.Range, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.Regexp, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.SimpleQueryString, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.SpanFirst, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.SpanNear, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.SpanNot, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.SpanOr, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.SpanTerm, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.Term, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.Terms, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.Wildcard, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.Match, visitor, (v, d) => v.Visit(d));
     AcceptQuery(qd.Bool, visitor, (v, d) =>
     {
         v.Visit(d);
         this.Accept(v, d.Must, VisitorScope.Must);
         this.Accept(v, d.MustNot, VisitorScope.MustNot);
         this.Accept(v, d.Should, VisitorScope.Should);
     });
     AcceptQuery(qd.Boosting, visitor, (v, d) =>
     {
         v.Visit(d);
         this.Accept(v, d.PositiveQuery, VisitorScope.PositiveQuery);
         this.Accept(v, d.NegativeQuery, VisitorScope.NegativeQuery);
     });
     AcceptQuery(qd.ConstantScore, visitor, (v, d) =>
     {
         v.Visit(d);
         this.Accept(v, d.Query);
         this.Accept(v, d.Filter);
     });
     AcceptQuery(qd.CustomBoostFactor, visitor, (v, d) =>
     {
         v.Visit(d);
         this.Accept(v, d.Query);
     });
     AcceptQuery(qd.CustomFiltersScore, visitor, (v, d) =>
     {
         v.Visit(d);
         this.Accept(v, d.Query);
         //TODO loop over filters or implement accept on them individually
     });
     AcceptQuery(qd.CustomScore, visitor, (v, d) =>
     {
         v.Visit(d);
         this.Accept(v, d.Query);
     });
     AcceptQuery(qd.DisMax, visitor, (v, d) =>
     {
         v.Visit(d);
         this.Accept(v, d.Queries);
     });
     AcceptQuery(qd.Filtered, visitor, (v, d) =>
     {
         visitor.Visit(d);
         this.Accept(v, d.Query);
         this.Accept(v, d.Filter);
     });
     AcceptQuery(qd.FunctionScore, visitor, (v, d) =>
     {
         v.Visit(d);
         this.Accept(v, d.Query);
         //TODO loop over qd.FunctionScore.Functions;
     });
     AcceptQuery(qd.HasChild, visitor, (v, d) =>
     {
         v.Visit(d);
         this.Accept(v, d.Query);
     });
     AcceptQuery(qd.HasParent, visitor, (v, d) =>
     {
         v.Visit(d);
         this.Accept(v, d.Query);
     });
     AcceptQuery(qd.Indices, visitor, (v, d) =>
     {
         v.Visit(d);
         this.Accept(v, d.Query);
         this.Accept(v, d.NoMatchQuery, VisitorScope.NoMatchQuery);
     });
     AcceptQuery(qd.Nested, visitor, (v, d) =>
     {
         v.Visit(d);
         this.Accept(v, d.Query);
         this.Accept(v, d.Filter);
     });
     AcceptQuery(qd.TopChildren, visitor, (v, d) =>
     {
         v.Visit(d);
         this.Accept(v, d.Query);
     });
 }
Beispiel #6
0
 internal abstract void Accept(IQueryVisitor visitor);
Beispiel #7
0
 public void Accept(IQueryVisitor visitor) => new QueryWalker().Walk(this, visitor);
Beispiel #8
0
 public void Visit(IQueryVisitor visitor)
 {
     visitor.Visit(Content);
     visitor.Visit(OrderModifier);
 }
Beispiel #9
0
 public IQuery Accept(IQueryVisitor visitor)
 {
     return(this);
 }
Beispiel #10
0
 public void Visit(IQueryVisitor visitor)
 {
     visitor.Visit((LimitModifierNode)this);
 }
Beispiel #11
0
 public void Visit(IQueryVisitor visitor)
 {
     visitor.Visit(this);
 }
Beispiel #12
0
 public void Visit(IQueryVisitor visitor)
 {
     visitor.Visit(Content);
     visitor.Visit(LimitModifier);
 }
 /// <summary>
 /// Dispatches to the specific visit method for this node type.
 /// </summary>
 /// <param name="visitor">The visitor to visit this node with.</param>
 /// <returns>The result of visiting this node.</returns>
 protected override Expression AcceptSql(IQueryVisitor visitor)
 {  
     return visitor.VisitAggregate(this);
 }
 /// <summary>
 /// Dispatches to the specific visit method for this node type.
 /// </summary>
 /// <param name="visitor">The visitor to visit this node with.</param>
 /// <returns>The result of visiting this node.</returns>
 public virtual Expression AcceptDeclarationSql(IQueryVisitor visitor)
 {
     return(visitor.VisitFieldDeclaration(this));
 }
Beispiel #15
0
        public void Walk(IQueryContainer qd, IQueryVisitor visitor)
        {
            visitor.Visit(qd);
            VisitQuery(qd.MatchAll, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.MoreLikeThis, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.MultiMatch, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.CommonTerms, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Fuzzy, visitor, (v, d) =>
            {
                v.Visit(d);
                VisitQuery(d as IFuzzyStringQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as IFuzzyNumericQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as IFuzzyDateQuery, visitor, (vv, dd) => v.Visit(dd));
            });
            VisitQuery(qd.Range, visitor, (v, d) =>
            {
                v.Visit(d);
                VisitQuery(d as IDateRangeQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as INumericRangeQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as ITermRangeQuery, visitor, (vv, dd) => v.Visit(dd));
            });
            VisitQuery(qd.GeoShape, visitor, (v, d) =>
            {
                v.Visit(d);
                VisitQuery(d as IGeoIndexedShapeQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as IGeoShapeMultiPointQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as IGeoShapeMultiPolygonQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as IGeoShapePolygonQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as IGeoShapePointQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as IGeoShapeMultiLineStringQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as IGeoShapeLineStringQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as IGeoShapeEnvelopeQuery, visitor, (vv, dd) => v.Visit(dd));
                VisitQuery(d as IGeoShapeCircleQuery, visitor, (vv, dd) => v.Visit(dd));
            });
            VisitQuery(qd.Ids, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Prefix, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.QueryString, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Range, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Regexp, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.SimpleQueryString, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Term, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Terms, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Wildcard, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Match, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Type, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Script, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Missing, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Exists, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.GeoPolygon, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.GeoDistanceRange, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.GeoDistance, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.GeoBoundingBox, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.GeoHashCell, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Limit, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.Template, visitor, (v, d) => v.Visit(d));
            VisitQuery(qd.RawQuery, visitor, (v, d) => v.Visit(d));

            VisitQuery(qd.Not, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Filters);
            });
            VisitQuery(qd.And, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Filters);
            });
            VisitQuery(qd.Or, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Filters);
            });
            VisitQuery(qd.Bool, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Must, VisitorScope.Must);
                Accept(v, d.MustNot, VisitorScope.MustNot);
                Accept(v, d.Should, VisitorScope.Should);
            });

            VisitSpan(qd, visitor);

            VisitQuery(qd.Boosting, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.PositiveQuery, VisitorScope.PositiveQuery);
                Accept(v, d.NegativeQuery, VisitorScope.NegativeQuery);
            });
            VisitQuery(qd.ConstantScore, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Filter);
            });
            VisitQuery(qd.DisMax, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Queries);
            });
            VisitQuery(qd.Filtered, visitor, (v, d) =>
            {
                visitor.Visit(d);
                Accept(v, d.Query);
                Accept(v, d.Filter);
            });
            VisitQuery(qd.FunctionScore, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Query);
            });
            VisitQuery(qd.HasChild, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Query);
            });
            VisitQuery(qd.HasParent, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Query);
            });
            VisitQuery(qd.Indices, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Query);
                Accept(v, d.NoMatchQuery, VisitorScope.NoMatchQuery);
            });
            VisitQuery(qd.Nested, visitor, (v, d) =>
            {
                v.Visit(d);
                Accept(v, d.Query);
            });
        }
		public void Accept(IQueryVisitor visitor)
		{
			if (visitor.Scope == VisitorScope.Unknown) visitor.Scope = VisitorScope.Query;
			new QueryWalker().Walk(this, visitor);
		}
		public void Accept(IQueryVisitor visitor)
		{
			var walker = new QueryFilterWalker();
			if (visitor.Scope == VisitorScope.Unknown) visitor.Scope = VisitorScope.Filter;
			walker.Walk(this, visitor);
		}
 public T Accept <T>(IQueryVisitor <TAtom, T> visitor) => visitor.Visit(this);
Beispiel #19
0
 internal void Accept(IQueryVisitor visitor)
 {
     visitor.Visit(this);
 }
 internal override void Accept(IQueryVisitor visitor)
 {
     visitor.Visit(this);
 }
Beispiel #21
0
 void ISpanQuery.Accept(IQueryVisitor visitor) => new QueryWalker().Walk(this, visitor);
		public virtual void Visit(IQueryVisitor visitor) { }
 public virtual void Visit(IQueryVisitor visitor)
 {
 }
 /// <summary>
 /// Dispatches to the specific visit method for this node type.
 /// </summary>
 /// <param name="visitor">The visitor to visit this node with.</param>
 /// <returns>The result of visiting this node.</returns>
 protected override Expression AcceptSql(IQueryVisitor visitor)
 {
     return(visitor.VisitBoolean(this));
 }
 public T Accept <T>(IQueryVisitor <IVoucherQueryAtom, T> visitor) => visitor.Visit(this);
 /// <inheritdoc />
 public T Accept <T>(IQueryVisitor <IDistributedQueryAtom, T> visitor) => visitor.Visit(this);
 /// <summary>
 /// Dispatches to the specific visit method for this node type.
 /// </summary>
 /// <param name="visitor">The visitor to visit this node with.</param>
 /// <returns>The result of visiting this node.</returns>
 protected override Expression AcceptSql(IQueryVisitor visitor)
 {
     return(visitor.VisitContains(this));
 }
Beispiel #28
0
        internal static System.Linq.Expressions.Expression TransformPredicateExpression(this IQueryVisitor visitor, System.Linq.Expressions.Expression expression)
        {
            System.Linq.Expressions.Expression result = expression;
            if (expression is System.Linq.Expressions.MethodCallExpression)
            {
                System.Linq.Expressions.MethodCallExpression methodCallExpression = (System.Linq.Expressions.MethodCallExpression)expression;
                if ((methodCallExpression.Method == typeof(EntityExtensions).GetMethod("Predicate")) && (methodCallExpression.Arguments.Count > 1) &&
                    (methodCallExpression.Arguments[1] != null) && (methodCallExpression.Arguments[1] is System.Linq.Expressions.ConstantExpression))
                {
                    object item;
                    if (!TransformedExpressionsCache.TryGetValue(expression, out item))
                    {
                        object objectValue = ((System.Linq.Expressions.ConstantExpression)methodCallExpression.Arguments[1]).Value;
                        Uri    predicate   = (Uri)objectValue;
                        Type   type;
                        string name;
                        visitor.GetMappingDetails(predicate, methodCallExpression.Arguments[0].Type, out type, out name);
                        System.Linq.Expressions.MemberExpression memberExpression = System.Linq.Expressions.Expression.MakeMemberAccess(methodCallExpression.Arguments[0], type.GetProperty(name));
                        TransformedExpressionsCache[expression] = result = memberExpression;
                    }
                    else
                    {
                        result = (System.Linq.Expressions.MemberExpression)item;
                    }
                }
            }

            return(result);
        }