private string CompileMaxValue(PropertyLiteral literal) { //<##> //return ValueFormatter.GetMaxValue(literal.DataType); return(null); //</##> }
private Query CompileBinaryExpression(PropertyLiteral left, Operator op, Literal right) { //PropertyLiteral left = expression.BinExp.LeftValue; //Operator op = expression.BinExp.Operator; //Literal right = expression.BinExp.RightValue; if (!right.IsValue) { throw new NotSupportedException(); } var formatterName = left.DataType.ToString(); if (left.Name == "Path" && op == Operator.StartsWith) { return(CompileInTreeQuery((string)right.Value)); } var leftName = CompileLeftValue(left); var rightValue = CompileLiteralValue(right.Value, formatterName); Term rightTerm = CreateRightTerm(leftName, op, rightValue); Term minTerm; Term maxTerm; switch (op) { case Operator.StartsWith: // left:right* return(new PrefixQuery(rightTerm)); case Operator.EndsWith: // left:*right case Operator.Contains: // left:*right* return(new WildcardQuery(rightTerm)); case Operator.Equal: // left:right return(new TermQuery(rightTerm)); case Operator.NotEqual: // -(left:right) throw new NotSupportedException("##Wrong optimizer"); case Operator.LessThan: // left:{minValue TO right} minTerm = new Term(leftName, CompileMinValue(left)); return(new RangeQuery(minTerm, rightTerm, false)); case Operator.GreaterThan: // left:{right TO maxValue} maxTerm = new Term(leftName, CompileMaxValue(left)); return(new RangeQuery(rightTerm, maxTerm, false)); case Operator.LessThanOrEqual: // left:[minValue TO right] minTerm = new Term(leftName, CompileMinValue(left)); return(new RangeQuery(minTerm, rightTerm, true)); case Operator.GreaterThanOrEqual: // left:[right TO maxValue] maxTerm = new Term(leftName, CompileMaxValue(left)); return(new RangeQuery(rightTerm, maxTerm, true)); default: throw new NotImplementedException(); } }
public SearchOrder(PropertyType propertyToOrder, OrderDirection direction) { if (propertyToOrder == null) { throw new ArgumentNullException("propertyToOrder"); } _propertyToOrder = new PropertyLiteral(propertyToOrder); _direction = direction; }
public ReferenceExpression(ReferenceAttribute referrerProperty, Expression expression) { if (expression == null) { throw new ArgumentNullException("expression"); } _referrerProperty = new PropertyLiteral((NodeAttribute)referrerProperty); _expression = expression; }
private string CompileLeftValue(PropertyLiteral propLit) { if (propLit.IsSlot) { return(CompilePropertySlot(propLit.PropertySlot)); } else { return(CompileNodeAttribute(propLit.NodeAttribute)); } }
public ReferenceExpression(PropertyType referrerProperty) { if (referrerProperty == null) { throw new ArgumentNullException("referrerProperty"); } if (referrerProperty.DataType != DataType.Reference) { throw new ArgumentOutOfRangeException("referrerProperty", "The DataType of 'referrerProperty' must be Reference"); } _referrerProperty = new PropertyLiteral(referrerProperty); _existenceOnly = true; }
private Query CompileBinaryExpression(PropertyLiteral left, Operator op, Literal right) { if (!right.IsValue) { throw new NotSupportedException(); } var formatterName = left.DataType.ToString(); if (left.Name == "Path" && op == Operator.StartsWith) { return(CompileInTreeQuery((string)right.Value)); } var leftName = CompileLeftValue(left); var rightValue = CompileLiteralValue(right.Value, formatterName); Term rightTerm = CreateRightTerm(leftName, op, rightValue); switch (op) { case Operator.StartsWith: // left:right* return(new PrefixQuery(rightTerm)); case Operator.EndsWith: // left:*right case Operator.Contains: // left:*right* return(new WildcardQuery(rightTerm)); case Operator.Equal: // left:right return(new TermQuery(rightTerm)); case Operator.NotEqual: // -(left:right) throw new NotSupportedException("##Wrong optimizer"); case Operator.LessThan: // left:{minValue TO right} return(new TermRangeQuery(leftName, CompileMinValue(left), rightValue, false, false)); case Operator.GreaterThan: // left:{right TO maxValue} return(new TermRangeQuery(leftName, rightValue, CompileMaxValue(left), false, false)); case Operator.LessThanOrEqual: // left:[minValue TO right] return(new TermRangeQuery(leftName, CompileMinValue(left), rightValue, true, true)); case Operator.GreaterThanOrEqual: // left:[right TO maxValue] return(new TermRangeQuery(leftName, rightValue, CompileMaxValue(left), true, true)); default: throw new SenseNet.ContentRepository.Storage.SnNotSupportedException(); } }
public ReferenceExpression(PropertyType referrerProperty, Expression expression) { if (referrerProperty == null) { throw new ArgumentNullException("referrerProperty"); } if (referrerProperty.DataType != DataType.Reference) { throw new ArgumentOutOfRangeException("referrerProperty", "The DataType of ''referrerProperty'' must be Reference"); } if (expression == null) { throw new ArgumentNullException("expression"); } _referrerProperty = new PropertyLiteral(referrerProperty); _expression = expression; }
public ReferenceExpression(ReferenceAttribute referrerProperty, Node referencedNode) { _referrerProperty = new PropertyLiteral((NodeAttribute)referrerProperty); _referencedNode = referencedNode; //_existenceOnly = false; }
public ReferenceExpression(ReferenceAttribute referrerProperty) { _referrerProperty = new PropertyLiteral((NodeAttribute)referrerProperty); _existenceOnly = true; }
internal SearchOrder(NodeAttribute propertyToOrder, OrderDirection direction) { _propertyToOrder = new PropertyLiteral(propertyToOrder); _direction = direction; }
private string CompileMaxValue(PropertyLiteral literal) { return(null); }