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); }
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; }
public int Compare(QueryMatch x, QueryMatch y) { return x.Score.CompareTo(y.Score); }