Beispiel #1
0
        public override Query VisitTermRangeQuery(TermRangeQuery termRangeq)
        {
            var field = termRangeq.GetField();
            var lowerTerm = GetTermText(termRangeq.GetLowerTerm());
            var upperTerm = GetTermText(termRangeq.GetUpperTerm());
            var includesLower = termRangeq.IncludesLower();
            var includesUpper = termRangeq.IncludesUpper();
            string oneTerm = null;

            _text.Append(field);
            _text.Append(":");

            string op = null;
            if (lowerTerm == null)
            {
                op = includesUpper ? "<=" : "<";
                oneTerm = upperTerm;
            }
            if (upperTerm == null)
            {
                op = includesLower ? ">=" : ">";
                oneTerm = lowerTerm;
            }

            if (op == null)
            {
                _text.Append(includesLower ? '[' : '{');
                _text.Append(lowerTerm);
                _text.Append(" TO ");
                _text.Append(upperTerm);
                _text.Append(includesUpper ? ']' : '}');
            }
            else
            {
                _text.Append(op).Append(oneTerm);
            }

            _text.Append(BoostToString(termRangeq.GetBoost()));

            return base.VisitTermRangeQuery(termRangeq);
        }
Beispiel #2
0
 /// <summary>Returns <code>true</code> if the range query is inclusive </summary>
 public virtual bool IsInclusive()
 {
     return(delegate_Renamed.IncludesLower() && delegate_Renamed.IncludesUpper());
 }
Beispiel #3
0
 // <V2.9.2>
 public virtual Query VisitTermRangeQuery(TermRangeQuery termRangeq)
 {
     var field = termRangeq.GetField();
     var visitedField = VisitField(field);
     if (field == visitedField)
         return termRangeq;
     return new TermRangeQuery(visitedField, termRangeq.GetLowerTerm(), termRangeq.GetUpperTerm(), termRangeq.IncludesLower(), termRangeq.IncludesUpper());
 }