示例#1
0
        public int Compare(QueryMatch x, QueryMatch y)
        {
            if (theSearcer == null)
            {
                throw new InvalidOperationException("Cannot compare without first getting the searcher we are comparing with");
            }

            var xVal = theSearcer.GetTermForDocument(x.DocumentId, fieldNumber);
            var yVal = theSearcer.GetTermForDocument(y.DocumentId, fieldNumber);

            if (xVal == null && yVal == null)
            {
                return(0);
            }


            if (xVal == null)
            {
                return(-1 * _factor);
            }

            if (yVal == null)
            {
                return(1 * _factor);
            }

            var result = xVal.CompareTo(yVal) * _factor;

            return(result);
        }
示例#2
0
        public int Compare(QueryMatch x, QueryMatch y)
        {
            if (theSearcer == null)
                throw new InvalidOperationException("Cannot compare without first getting the searcher we are comparing with");

            var xVal = theSearcer.GetTermForDocument(x.DocumentId, fieldNumber);
            var yVal = theSearcer.GetTermForDocument(y.DocumentId, fieldNumber);

            if (xVal == null && yVal == null)
                return 0;

            if (xVal == null)
                return -1 * _factor;

            if (yVal == null)
                return 1 * _factor;

            var result = xVal.CompareTo(yVal) * _factor;

            return result;
        }
示例#3
0
 public int Compare(QueryMatch x, QueryMatch y)
 {
     return x.Score.CompareTo(y.Score);
 }