/// <summary> /// Creates a sort, possibly in reverse, with a custom comparison function. </summary> /// <param name="field"> Name of field to sort by; cannot be <c>null</c>. </param> /// <param name="comparer"> Returns a comparer for sorting hits. </param> /// <param name="reverse"> <c>True</c> if natural order should be reversed. </param> public SortField(string field, FieldComparerSource comparer, bool reverse) { InitFieldType(field, SortFieldType.CUSTOM); this.reverse = reverse; this.comparerSource = comparer; }
// LUCENENET NOTE: Made this into a property setter above //public virtual void SetMissingValue(object value) //{ // if (type == SortFieldType.STRING) // { // if (value != STRING_FIRST && value != STRING_LAST) // { // throw new System.ArgumentException("For STRING type, missing value must be either STRING_FIRST or STRING_LAST"); // } // } // else if (type != SortFieldType.BYTE && type != SortFieldType.SHORT && type != SortFieldType.INT && type != SortFieldType.FLOAT && type != SortFieldType.LONG && type != SortFieldType.DOUBLE) // { // throw new System.ArgumentException("Missing value only works for numeric or STRING types"); // } // this.missingValue = value; //} /// <summary> /// Creates a sort with a custom comparison function. </summary> /// <param name="field"> Name of field to sort by; cannot be <c>null</c>. </param> /// <param name="comparer"> Returns a comparer for sorting hits. </param> public SortField(string field, FieldComparerSource comparer) { InitFieldType(field, SortFieldType.CUSTOM); this.comparerSource = comparer; }