diff --git a/src/Lucene.Net/Search/FieldComparator.cs b/src/Lucene.Net/Search/FieldComparator.cs index 67e4edfcc7..6a63151cdc 100644 --- a/src/Lucene.Net/Search/FieldComparator.cs +++ b/src/Lucene.Net/Search/FieldComparator.cs @@ -1452,10 +1452,14 @@ public override int CompareValues(BytesRef val1, BytesRef val2) // TODO: should we remove this? who really uses it? public sealed class TermValComparer : FieldComparer { + // LUCENENET NOTE: We can't use Arrays.Empty() here because + // MISSING_BYTES and NON_MISSING_BYTES are compared for reference + // equality and Arrays.Empty() returns a singleton instance. + // sentinels, just used internally in this comparer - private static readonly byte[] MISSING_BYTES = Arrays.Empty(); + private static readonly byte[] MISSING_BYTES = new byte[0]; - private static readonly byte[] NON_MISSING_BYTES = Arrays.Empty(); + private static readonly byte[] NON_MISSING_BYTES = new byte[0]; private readonly BytesRef[] values; // LUCENENET: marked readonly private BinaryDocValues docTerms; @@ -1577,4 +1581,4 @@ private void SetMissingBytes(int doc, BytesRef br) } } } -} \ No newline at end of file +}