Lucene.Net.Misc.Index.Sorter.SortingAtomicReader refactor: changed IndexOptions enum fields and parameters to be non-nullable
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/375e3b6f Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/375e3b6f Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/375e3b6f Branch: refs/heads/api-work Commit: 375e3b6ffa86b9a0825476a1b432de548a004298 Parents: 366eb42 Author: Shad Storhaug <[email protected]> Authored: Wed Feb 1 13:41:00 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Wed Feb 1 13:41:00 2017 +0700 ---------------------------------------------------------------------- .../Index/Sorter/SortingAtomicReader.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/375e3b6f/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs b/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs index f062fdb..7bce547 100644 --- a/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs +++ b/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs @@ -66,7 +66,7 @@ namespace Lucene.Net.Index.Sorter } else { - return new SortingTerms(terms, infos.FieldInfo(field).IndexOptions, docMap); + return new SortingTerms(terms, infos.FieldInfo(field).IndexOptions.GetValueOrDefault(), docMap); } } } @@ -75,10 +75,9 @@ namespace Lucene.Net.Index.Sorter { internal readonly Sorter.DocMap docMap; - internal readonly IndexOptions? indexOptions; + internal readonly IndexOptions indexOptions; - // LUCENENET TODO: Make the IndexOptions non nullable - public SortingTerms(Terms input, IndexOptions? indexOptions, Sorter.DocMap docMap) : base(input) + public SortingTerms(Terms input, IndexOptions indexOptions, Sorter.DocMap docMap) : base(input) { this.docMap = docMap; this.indexOptions = indexOptions; @@ -99,9 +98,9 @@ namespace Lucene.Net.Index.Sorter { internal readonly Sorter.DocMap docMap; // pkg-protected to avoid synthetic accessor methods - internal readonly IndexOptions? indexOptions; + internal readonly IndexOptions indexOptions; - public SortingTermsEnum(TermsEnum @in, Sorter.DocMap docMap, IndexOptions? indexOptions) + public SortingTermsEnum(TermsEnum @in, Sorter.DocMap docMap, IndexOptions indexOptions) : base(@in) { this.docMap = docMap; @@ -159,7 +158,7 @@ namespace Lucene.Net.Index.Sorter } DocsEnum inDocs = m_input.Docs(NewToOld(liveDocs), inReuse, flags); - bool withFreqs = indexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0 && (flags & DocsEnum.FLAG_FREQS) != 0; + bool withFreqs = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0 && (flags & DocsEnum.FLAG_FREQS) != 0; return new SortingDocsEnum(docMap.Count, wrapReuse, inDocs, withFreqs, docMap); } @@ -190,7 +189,7 @@ namespace Lucene.Net.Index.Sorter // since this code is expected to be used during addIndexes which will // ask for everything. if that assumption changes in the future, we can // factor in whether 'flags' says offsets are not required. - bool storeOffsets = indexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0; + bool storeOffsets = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0; return new SortingDocsAndPositionsEnum(docMap.Count, wrapReuse, inDocsAndPositions, docMap, storeOffsets); } }
