19 using Lucene.Net.Util;
21 namespace Lucene.Net.Search
34 internal volatile SortField[] fields = null;
38 internal volatile System.Globalization.CompareInfo[] collators;
56 internal virtual void SetFields(
SortField[] fields)
61 this.collators = HasCollators(fields);
77 private System.Globalization.CompareInfo[] HasCollators(
SortField[] fields)
81 System.Globalization.CompareInfo[] ret =
new System.Globalization.CompareInfo[fields.Length];
82 for (
int i = 0; i < fields.Length; ++i)
84 System.Globalization.CultureInfo locale = fields[i].
Locale;
86 ret[i] = locale.CompareInfo;
98 int n = fields.Length;
100 for (
int i = 0; i < n && c == 0; ++i)
102 int type = fields[i].
Type;
105 string s1 = (string) docA.
fields[i];
106 string s2 = (
string) docB.
fields[i];
112 c = (s2 == null) ? 0 : -1;
118 else if (fields[i].Locale == null)
120 c = s1.CompareTo(s2);
124 c = collators[i].Compare(s1, s2);
135 if (fields[i].Reverse)
143 return docA.
Doc > docB.
Doc;