Ejemplo n.º 1
0
        public override Query VisitConstantScoreRangeQuery(ConstantScoreRangeQuery constantScoreRangeq)
        {
            var q = (ConstantScoreRangeQuery)base.VisitConstantScoreRangeQuery(constantScoreRangeq);

            _dump.AppendFormat("ConstantScoreRangeQ({0}:{1}{2} TO {3}{4}{5})",
                               q.GetField(), q.IncludesLower() ? "[" : "{",
                               q.GetLowerVal(), q.GetUpperVal(), q.IncludesUpper() ? "]" : "}", BoostToString(q));
            return(q);
        }
        public SearchQueryContext <TFieldNames> GreaterThan(Expression <Func <TFieldNames, string> > searchFilterExpression, DateTime date)
        {
            string searchFieldName = ((ConstantExpression)(searchFilterExpression.Body)).Value.ToString();
//            RangeQuery queryDefinition = new RangeQuery(new Term(searchFieldName, string.Format(SearchIndexer.DateTimeIndexingFormat, date)), new Term(searchFieldName, string.Format(SearchIndexer.DateTimeIndexingFormat, DateTime.MaxValue)), true);
            var queryDefinition = new ConstantScoreRangeQuery(searchFieldName, string.Format(SearchIndexer.DateTimeIndexingFormat, date), string.Format(SearchIndexer.DateTimeIndexingFormat, DateTime.MaxValue), true, true);

            IsUsingDefaultQueryDefinition = false;
            MergeQueryDefinitions(queryDefinition);

            return(this);
        }
Ejemplo n.º 3
0
        public virtual Query VisitConstantScoreRangeQuery(ConstantScoreRangeQuery constantScoreRangeq)
        {
            var field        = constantScoreRangeq.GetField();
            var visitedField = VisitField(field);

            if (field == visitedField)
            {
                return(constantScoreRangeq);
            }
            return(new ConstantScoreRangeQuery(visitedField, constantScoreRangeq.GetLowerVal(), constantScoreRangeq.GetUpperVal(), constantScoreRangeq.IncludesLower(), constantScoreRangeq.IncludesUpper()));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates the query.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        public static Query CreateQuery(string field, RangeValue value)
        {
            Query query = new ConstantScoreRangeQuery(field, value.numeric ? ConvertToSearchable(value.lowerbound) : value.lowerbound, value.numeric ? ConvertToSearchable(value.upperbound) : value.upperbound, value.lowerboundincluded, value.upperboundincluded);

            return(query);
        }
Ejemplo n.º 5
0
 public override Query VisitConstantScoreRangeQuery(ConstantScoreRangeQuery constantScoreRangeq)
 {
     throw new NotSupportedException("Cannot compile ConstantScoreRangeQuery to SQL expression.");
 }