You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/03/17 22:28:35 UTC
[05/33] lucenenet git commit: Lucene.Net.Index.IndexOptions refactor:
Added a NONE option and refactored all types that use IndexOptions to use
NONE instead of null.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.TestFramework/Codecs/Asserting/AssertingPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/Asserting/AssertingPostingsFormat.cs b/src/Lucene.Net.TestFramework/Codecs/Asserting/AssertingPostingsFormat.cs
index c039ceb..840c5bc 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Asserting/AssertingPostingsFormat.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Asserting/AssertingPostingsFormat.cs
@@ -303,7 +303,7 @@ namespace Lucene.Net.Codecs.Asserting
{
Debug.Assert(State == PostingsConsumerState.START);
State = PostingsConsumerState.INITIAL;
- if (fieldInfo.IndexOptions < IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
+ if (fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0)
{
Debug.Assert(PositionCount == 0); // we should not have fed any positions!
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosReader.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosReader.cs
index 458951e..623b53b 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosReader.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosReader.cs
@@ -70,10 +70,10 @@ namespace Lucene.Net.Codecs.Lucene3x
bool storeTermVector = (bits & PreFlexRWFieldInfosWriter.STORE_TERMVECTOR) != 0;
bool omitNorms = (bits & PreFlexRWFieldInfosWriter.OMIT_NORMS) != 0;
bool storePayloads = (bits & PreFlexRWFieldInfosWriter.STORE_PAYLOADS) != 0;
- IndexOptions? indexOptions;
+ IndexOptions indexOptions;
if (!isIndexed)
{
- indexOptions = null;
+ indexOptions = IndexOptions.NONE;
}
else if ((bits & PreFlexRWFieldInfosWriter.OMIT_TERM_FREQ_AND_POSITIONS) != 0)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldsWriter.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldsWriter.cs
index b0c8174..e30744e 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldsWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldsWriter.cs
@@ -88,7 +88,7 @@ namespace Lucene.Net.Codecs.Lucene3x
public override TermsConsumer AddField(FieldInfo field)
{
Debug.Assert(field.Number != -1);
- if (field.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
+ if (field.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0)
{
throw new System.NotSupportedException("this codec cannot index offsets");
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40FieldInfosWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40FieldInfosWriter.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40FieldInfosWriter.cs
index 688e365..443fb7d 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40FieldInfosWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40FieldInfosWriter.cs
@@ -57,7 +57,7 @@ namespace Lucene.Net.Codecs.Lucene40
output.WriteVInt32(infos.Count);
foreach (FieldInfo fi in infos)
{
- IndexOptions? indexOptions = fi.IndexOptions;
+ IndexOptions indexOptions = fi.IndexOptions;
sbyte bits = 0x0;
if (fi.HasVectors)
{
@@ -74,7 +74,7 @@ namespace Lucene.Net.Codecs.Lucene40
if (fi.IsIndexed)
{
bits |= Lucene40FieldInfosFormat.IS_INDEXED;
- Debug.Assert(indexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS || !fi.HasPayloads);
+ Debug.Assert(indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 || !fi.HasPayloads);
if (indexOptions == IndexOptions.DOCS_ONLY)
{
bits |= Lucene40FieldInfosFormat.OMIT_TERM_FREQ_AND_POSITIONS;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40PostingsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40PostingsWriter.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40PostingsWriter.cs
index 7a565dd..1068ab4 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40PostingsWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40PostingsWriter.cs
@@ -71,7 +71,7 @@ namespace Lucene.Net.Codecs.Lucene40
internal readonly int TotalNumDocs;
- internal IndexOptions? IndexOptions;
+ internal IndexOptions IndexOptions;
internal bool StorePayloads;
internal bool StoreOffsets;
@@ -192,7 +192,7 @@ namespace Lucene.Net.Codecs.Lucene40
this.FieldInfo = fieldInfo;
IndexOptions = fieldInfo.IndexOptions;
- StoreOffsets = IndexOptions >= Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+ StoreOffsets = IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
StorePayloads = fieldInfo.HasPayloads;
LastState = EmptyState;
//System.out.println(" set init blockFreqStart=" + freqStart);
@@ -223,7 +223,7 @@ namespace Lucene.Net.Codecs.Lucene40
Debug.Assert(docID < TotalNumDocs, "docID=" + docID + " totalNumDocs=" + TotalNumDocs);
LastDocID = docID;
- if (IndexOptions == Index.IndexOptions.DOCS_ONLY)
+ if (IndexOptions == IndexOptions.DOCS_ONLY)
{
FreqOut.WriteVInt32(delta);
}
@@ -246,7 +246,7 @@ namespace Lucene.Net.Codecs.Lucene40
public override void AddPosition(int position, BytesRef payload, int startOffset, int endOffset)
{
//if (DEBUG) System.out.println("SPW: addPos pos=" + position + " payload=" + (payload == null ? "null" : (payload.Length + " bytes")) + " proxFP=" + proxOut.getFilePointer());
- Debug.Assert(IndexOptions >= Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS, "invalid indexOptions: " + IndexOptions);
+ Debug.Assert(IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0, "invalid indexOptions: " + IndexOptions);
Debug.Assert(ProxOut != null);
int delta = position - LastPosition;
@@ -352,7 +352,7 @@ namespace Lucene.Net.Codecs.Lucene40
Debug.Assert(state.SkipOffset > 0);
@out.WriteVInt64(state.SkipOffset);
}
- if (IndexOptions >= Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
+ if (IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
{
@out.WriteVInt64(state.ProxStart - LastState.ProxStart);
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42FieldInfosWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42FieldInfosWriter.cs b/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42FieldInfosWriter.cs
index acdae7b..707b195 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42FieldInfosWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42FieldInfosWriter.cs
@@ -56,7 +56,7 @@ namespace Lucene.Net.Codecs.Lucene42
output.WriteVInt32(infos.Count);
foreach (FieldInfo fi in infos)
{
- IndexOptions? indexOptions = fi.IndexOptions;
+ IndexOptions indexOptions = fi.IndexOptions;
sbyte bits = 0x0;
if (fi.HasVectors)
{
@@ -73,7 +73,7 @@ namespace Lucene.Net.Codecs.Lucene42
if (fi.IsIndexed)
{
bits |= Lucene42FieldInfosFormat.IS_INDEXED;
- Debug.Assert(indexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS || !fi.HasPayloads);
+ Debug.Assert(indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 || !fi.HasPayloads);
if (indexOptions == IndexOptions.DOCS_ONLY)
{
bits |= Lucene42FieldInfosFormat.OMIT_TERM_FREQ_AND_POSITIONS;
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs b/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs
index 1b5dffc..766e218 100644
--- a/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/RAMOnly/RAMOnlyPostingsFormat.cs
@@ -221,17 +221,17 @@ namespace Lucene.Net.Codecs.RAMOnly
public override bool HasFreqs
{
- get { return Info.IndexOptions >= IndexOptions.DOCS_AND_FREQS; }
+ get { return Info.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0; }
}
public override bool HasOffsets
{
- get { return Info.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS; }
+ get { return Info.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0; }
}
public override bool HasPositions
{
- get { return Info.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; }
+ get { return Info.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; }
}
public override bool HasPayloads
@@ -307,7 +307,7 @@ namespace Lucene.Net.Codecs.RAMOnly
public override TermsConsumer AddField(FieldInfo field)
{
- if (field.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
+ if (field.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0)
{
throw new System.NotSupportedException("this codec cannot index offsets");
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
index f7038f9..5980ce8 100644
--- a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
@@ -395,7 +395,9 @@ namespace Lucene.Net.Index
continue;
}
- fieldInfoArray[fieldUpto] = new FieldInfo(field, true, fieldUpto, false, false, true, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS, null, DocValuesType.NUMERIC, null);
+ fieldInfoArray[fieldUpto] = new FieldInfo(field, true, fieldUpto, false, false, true,
+ IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS,
+ null, DocValuesType.NUMERIC, null);
fieldUpto++;
SortedDictionary<BytesRef, long> postings = new SortedDictionary<BytesRef, long>();
@@ -538,7 +540,7 @@ namespace Lucene.Net.Index
// Randomly picked the IndexOptions to index this
// field with:
- IndexOptions indexOptions = Enum.GetValues(typeof(IndexOptions)).Cast<IndexOptions>().ToArray()[alwaysTestMax ? fieldMaxIndexOption : Random().Next(1 + fieldMaxIndexOption)];
+ IndexOptions indexOptions = Enum.GetValues(typeof(IndexOptions)).Cast<IndexOptions>().ToArray()[alwaysTestMax ? fieldMaxIndexOption : Random().Next(1, 1 + fieldMaxIndexOption)]; // LUCENENET: Skipping NONE option
bool doPayloads = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 && allowPayloads;
newFieldInfoArray[fieldUpto] = new FieldInfo(oldFieldInfo.Name, true, fieldUpto, false, false, doPayloads, indexOptions, null, DocValuesType.NUMERIC, null);
@@ -560,17 +562,17 @@ namespace Lucene.Net.Index
FieldInfo fieldInfo = newFieldInfos.FieldInfo(field);
- IndexOptions? indexOptions = fieldInfo.IndexOptions;
+ IndexOptions indexOptions = fieldInfo.IndexOptions;
if (VERBOSE)
{
Console.WriteLine("field=" + field + " indexOtions=" + indexOptions);
}
- bool doFreq = indexOptions >= IndexOptions.DOCS_AND_FREQS;
- bool doPos = indexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
- bool doPayloads = indexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS && allowPayloads;
- bool doOffsets = indexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+ bool doFreq = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
+ bool doPos = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
+ bool doPayloads = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 && allowPayloads;
+ bool doOffsets = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
TermsConsumer termsConsumer = fieldsConsumer.AddField(fieldInfo);
long sumTotalTF = 0;
@@ -663,8 +665,18 @@ namespace Lucene.Net.Index
public DocsAndPositionsEnum ReuseDocsAndPositionsEnum;
}
- private void VerifyEnum(ThreadState threadState, string field, BytesRef term, TermsEnum termsEnum, IndexOptions maxTestOptions, IndexOptions maxIndexOptions, ISet<Option> options, bool alwaysTestMax)
- // Maximum options (docs/freqs/positions/offsets) to test:
+ private void VerifyEnum(ThreadState threadState,
+ string field,
+ BytesRef term,
+ TermsEnum termsEnum,
+
+ // Maximum options (docs/freqs/positions/offsets) to test:
+ IndexOptions maxTestOptions,
+
+ IndexOptions maxIndexOptions,
+ ISet<Option> options,
+ bool alwaysTestMax)
+
{
if (VERBOSE)
{
@@ -698,16 +710,22 @@ namespace Lucene.Net.Index
FieldInfo fieldInfo = CurrentFieldInfos.FieldInfo(field);
// NOTE: can be empty list if we are using liveDocs:
- SeedPostings expected = GetSeedPostings(term.Utf8ToString(), Fields[field][term], useLiveDocs, maxIndexOptions);
+ SeedPostings expected = GetSeedPostings(term.Utf8ToString(),
+ Fields[field][term],
+ useLiveDocs,
+ maxIndexOptions);
Assert.AreEqual(expected.DocFreq, termsEnum.DocFreq);
- bool allowFreqs = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS && maxTestOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
+ bool allowFreqs = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0 &&
+ maxTestOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
bool doCheckFreqs = allowFreqs && (alwaysTestMax || Random().Next(3) <= 2);
- bool allowPositions = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS && maxTestOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
+ bool allowPositions = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 &&
+ maxTestOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
bool doCheckPositions = allowPositions && (alwaysTestMax || Random().Next(3) <= 2);
- bool allowOffsets = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS && maxTestOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
+ bool allowOffsets = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >=0 &&
+ maxTestOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
bool doCheckOffsets = allowOffsets && (alwaysTestMax || Random().Next(3) <= 2);
bool doCheckPayloads = options.Contains(Option.PAYLOADS) && allowPositions && fieldInfo.HasPayloads && (alwaysTestMax || Random().Next(3) <= 2);
@@ -1035,7 +1053,7 @@ namespace Lucene.Net.Index
}
}
}
- else if (fieldInfo.IndexOptions < IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
+ else if (fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) < 0)
{
if (VERBOSE)
{
@@ -1089,7 +1107,10 @@ namespace Lucene.Net.Index
}
}
- private void TestTerms(Fields fieldsSource, ISet<Option> options, IndexOptions maxTestOptions, IndexOptions maxIndexOptions, bool alwaysTestMax)
+ private void TestTerms(Fields fieldsSource, ISet<Option> options,
+ IndexOptions maxTestOptions,
+ IndexOptions maxIndexOptions,
+ bool alwaysTestMax)
{
if (options.Contains(Option.THREADS))
{
@@ -1111,7 +1132,10 @@ namespace Lucene.Net.Index
}
}
- private void TestTermsOneThread(Fields fieldsSource, ISet<Option> options, IndexOptions maxTestOptions, IndexOptions maxIndexOptions, bool alwaysTestMax)
+ private void TestTermsOneThread(Fields fieldsSource, ISet<Option> options,
+ IndexOptions maxTestOptions,
+ IndexOptions maxIndexOptions,
+ bool alwaysTestMax)
{
ThreadState threadState = new ThreadState();
@@ -1173,7 +1197,14 @@ namespace Lucene.Net.Index
savedTermState = true;
}
- VerifyEnum(threadState, fieldAndTerm.Field, fieldAndTerm.Term, termsEnum, maxTestOptions, maxIndexOptions, options, alwaysTestMax);
+ VerifyEnum(threadState,
+ fieldAndTerm.Field,
+ fieldAndTerm.Term,
+ termsEnum,
+ maxTestOptions,
+ maxIndexOptions,
+ options,
+ alwaysTestMax);
// Sometimes save term state after pulling the enum:
if (options.Contains(Option.TERM_STATE) && !useTermState && !savedTermState && Random().Next(5) == 1)
@@ -1194,7 +1225,14 @@ namespace Lucene.Net.Index
Console.WriteLine("TEST: try enum again on same term");
}
- VerifyEnum(threadState, fieldAndTerm.Field, fieldAndTerm.Term, termsEnum, maxTestOptions, maxIndexOptions, options, alwaysTestMax);
+ VerifyEnum(threadState,
+ fieldAndTerm.Field,
+ fieldAndTerm.Term,
+ termsEnum,
+ maxTestOptions,
+ maxIndexOptions,
+ options,
+ alwaysTestMax);
}
}
}
@@ -1226,7 +1264,7 @@ namespace Lucene.Net.Index
TestFields(fieldsProducer);
- var allOptions = (IndexOptions[]) Enum.GetValues(typeof (IndexOptions));
+ var allOptions = ((IndexOptions[])Enum.GetValues(typeof(IndexOptions))).Skip(1).ToArray(); // LUCENENET: Skip our NONE option
//IndexOptions_e.values();
int maxIndexOption = Arrays.AsList(allOptions).IndexOf(options);
@@ -1301,7 +1339,12 @@ namespace Lucene.Net.Index
// NOTE: you can also test "weaker" index options than
// you indexed with:
- TestTerms(fieldsProducer, new HashSet<Option>(Enum.GetValues(typeof(Option)).Cast<Option>()), IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS, false);
+ TestTerms(fieldsProducer,
+ // LUCENENET: Skip our NONE option
+ new HashSet<Option>(Enum.GetValues(typeof(Option)).Cast<Option>().Skip(1)),
+ IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS,
+ IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS,
+ false);
fieldsProducer.Dispose();
fieldsProducer = null;
@@ -1313,8 +1356,15 @@ namespace Lucene.Net.Index
protected internal override void AddRandomFields(Document doc)
{
+
foreach (IndexOptions opts in Enum.GetValues(typeof(IndexOptions)))
{
+ // LUCENENET: Skip our NONE option
+ if (opts == IndexOptions.NONE)
+ {
+ continue;
+ }
+
string field = "f_" + opts;
string pf = TestUtil.GetPostingsFormat(Codec.Default, field);
if (opts == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS && DoesntSupportOffsets.Contains(pf))
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Tests/Codecs/Lucene41/TestBlockPostingsFormat2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Codecs/Lucene41/TestBlockPostingsFormat2.cs b/src/Lucene.Net.Tests/Codecs/Lucene41/TestBlockPostingsFormat2.cs
index 5be2897..509f0cd 100644
--- a/src/Lucene.Net.Tests/Codecs/Lucene41/TestBlockPostingsFormat2.cs
+++ b/src/Lucene.Net.Tests/Codecs/Lucene41/TestBlockPostingsFormat2.cs
@@ -79,6 +79,12 @@ namespace Lucene.Net.Codecs.Lucene41
Document doc = new Document();
foreach (IndexOptions option in Enum.GetValues(typeof(IndexOptions)))
{
+ // LUCENENET: skip the "NONE" option that we added
+ if (option == IndexOptions.NONE)
+ {
+ continue;
+ }
+
var ft = new FieldType(TextField.TYPE_NOT_STORED)
{
StoreTermVectors = true,