Skip to content

Commit

Permalink
Lucene.Net.Codecs.Memory.MemoryPostingsFormat: Added additional comme…
Browse files Browse the repository at this point in the history
…nts for System.Enum.CompareTo() to IndexOptionsComparer change
  • Loading branch information
NightOwl888 committed Nov 5, 2020
1 parent 3c01253 commit 3b13b9e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ public override DocsEnum Docs(IBits liveDocs, DocsEnum reuse, DocsFlags flags)

public override DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags)
{
// LUCENENET specific - to avoid boxing, changed from CompareTo() to IndexOptionsComparer.Compare()
bool hasOffsets = IndexOptionsComparer.Default.Compare(field.IndexOptions, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
if (IndexOptionsComparer.Default.Compare(field.IndexOptions, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0)
{
Expand Down Expand Up @@ -949,6 +950,7 @@ public override TermsEnum GetEnumerator()

public override IComparer<BytesRef> Comparer => BytesRef.UTF8SortedAsUnicodeComparer;

// LUCENENET specific - to avoid boxing, changed from CompareTo() to IndexOptionsComparer.Compare()
public override bool HasFreqs => IndexOptionsComparer.Default.Compare(field.IndexOptions, IndexOptions.DOCS_AND_FREQS) >= 0;

public override bool HasOffsets => IndexOptionsComparer.Default.Compare(field.IndexOptions, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
Expand Down

0 comments on commit 3b13b9e

Please sign in to comment.