示例#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);
        }
示例#2
0
 /// <summary>Returns the lower term of this range query. </summary>
 public virtual Term GetLowerTerm()
 {
     System.String term = delegate_Renamed.GetLowerTerm();
     return((term == null)?null:new Term(GetField(), term));
 }
示例#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());
 }