public SearchDialog(SearchQueryBuilder queryBuilder = null, PromptStyler searchHitStyler = null, bool multipleSelection = false, CanonicalizerDelegate canonicalizer = null) { this.queryBuilder = queryBuilder ?? new SearchQueryBuilder(); this.hitStyler = searchHitStyler ?? new SearchHitStyler(); this.multipleSelection = multipleSelection; this.canonicalizer = canonicalizer; }
public Range Resolve(CanonicalizerDelegate canonicalizer) { var comparison = new Range { Property = canonicalizer(Property.Entity) }; var lower = Lower == null ? double.NegativeInfinity : double.Parse(Lower.Entity); var upper = Upper == null ? double.PositiveInfinity : double.Parse(Upper.Entity); switch (Operator.Entity) { case ">=": break; case "+": case "greater than or equal": case "at least": comparison.IncludeLower = true; comparison.IncludeUpper = true; upper = double.PositiveInfinity; break; case ">": case "greater than": comparison.IncludeLower = false; comparison.IncludeUpper = true; upper = double.PositiveInfinity; break; case "-": case "between": case "and": case "or": comparison.IncludeLower = true; comparison.IncludeUpper = true; break; case "<=": case "no more than": case "less than or equal": comparison.IncludeLower = true; comparison.IncludeUpper = true; upper = lower; lower = double.NegativeInfinity; break; case "<": case "less than": comparison.IncludeLower = true; comparison.IncludeUpper = false; upper = lower; lower = double.NegativeInfinity; break; // This is the case where we just have naked values case "": comparison.IncludeLower = true; comparison.IncludeUpper = true; upper = lower; break; default: throw new ArgumentException($"Unknown operator {Operator.Entity}"); } comparison.Lower = lower; comparison.Upper = upper; return(comparison); }
public SearchLanguageDialog(CanonicalizerDelegate canonicalizer, string defaultProperty = null) { _canonicalizer = canonicalizer; _defaultProperty = defaultProperty; }