コード例 #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
ファイル: SortByTerm.cs プロジェクト: votrongdao/Corax
        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
ファイル: Sorter.cs プロジェクト: josephdecock/Corax
 public int Compare(QueryMatch x, QueryMatch y)
 {
     return x.Score.CompareTo(y.Score);
 }