Lucene.Net.Core.Index.IndexableFieldType refactor: Removed setters and the NumericType field (weren't in the original)
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/bd5b34d9 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/bd5b34d9 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/bd5b34d9 Branch: refs/heads/api-work Commit: bd5b34d9fa1bdafad07c678c1e069e8662943e87 Parents: 17ec8e0 Author: Shad Storhaug <[email protected]> Authored: Fri Mar 17 00:03:05 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Fri Mar 17 00:03:05 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net.Core/Index/IndexableFieldType.cs | 22 ++++++++++---------- src/Lucene.Net.TestFramework/Util/TestUtil.cs | 2 +- src/Lucene.Net.Tests/Index/TestCodecs.cs | 18 +--------------- .../Index/TestIndexableField.cs | 18 +--------------- 4 files changed, 14 insertions(+), 46 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bd5b34d9/src/Lucene.Net.Core/Index/IndexableFieldType.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/IndexableFieldType.cs b/src/Lucene.Net.Core/Index/IndexableFieldType.cs index b5fa64d..5cb4e66 100644 --- a/src/Lucene.Net.Core/Index/IndexableFieldType.cs +++ b/src/Lucene.Net.Core/Index/IndexableFieldType.cs @@ -27,11 +27,11 @@ namespace Lucene.Net.Index { /// <summary> /// True if this field should be indexed (inverted) </summary> - bool IsIndexed { get; set; } + bool IsIndexed { get; } /// <summary> /// True if the field's value should be stored </summary> - bool IsStored { get; set; } + bool IsStored { get; } /// <summary> /// True if this field's value should be analyzed by the @@ -39,7 +39,7 @@ namespace Lucene.Net.Index /// <p> /// this has no effect if <seealso cref="#indexed()"/> returns false. /// </summary> - bool IsTokenized { get; set; } + bool IsTokenized { get; } /// <summary> /// True if this field's indexed form should be also stored @@ -51,7 +51,7 @@ namespace Lucene.Net.Index /// <p> /// this option is illegal if <seealso cref="#indexed()"/> returns false. /// </summary> - bool StoreTermVectors { get; set; } + bool StoreTermVectors { get; } /// <summary> /// True if this field's token character offsets should also @@ -60,7 +60,7 @@ namespace Lucene.Net.Index /// this option is illegal if term vectors are not enabled for the field /// (<seealso cref="#storeTermVectors()"/> is false) /// </summary> - bool StoreTermVectorOffsets { get; set; } + bool StoreTermVectorOffsets { get; } /// <summary> /// True if this field's token positions should also be stored @@ -69,7 +69,7 @@ namespace Lucene.Net.Index /// this option is illegal if term vectors are not enabled for the field /// (<seealso cref="#storeTermVectors()"/> is false). /// </summary> - bool StoreTermVectorPositions { get; set; } + bool StoreTermVectorPositions { get; } /// <summary> /// True if this field's token payloads should also be stored @@ -78,7 +78,7 @@ namespace Lucene.Net.Index /// this option is illegal if term vector positions are not enabled /// for the field (<seealso cref="#storeTermVectors()"/> is false). /// </summary> - bool StoreTermVectorPayloads { get; set; } + bool StoreTermVectorPayloads { get; } /// <summary> /// True if normalization values should be omitted for the field. @@ -86,20 +86,20 @@ namespace Lucene.Net.Index /// this saves memory, but at the expense of scoring quality (length normalization /// will be disabled), and if you omit norms, you cannot use index-time boosts. /// </summary> - bool OmitNorms { get; set; } + bool OmitNorms { get; } /// <summary> /// <seealso cref="IndexOptions"/>, describing what should be /// recorded into the inverted index /// </summary> - IndexOptions? IndexOptions { get; set; } // LUCENENET TODO: Can we remove the nullable? + IndexOptions IndexOptions { get; } - NumericType? NumericType { get; set; } + //NumericType? NumericType { get; } /// <summary> /// DocValues <seealso cref="DocValuesType"/>: if non-null then the field's value /// will be indexed into docValues. /// </summary> - DocValuesType? DocValueType { get; set; } + DocValuesType? DocValueType { get; } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bd5b34d9/src/Lucene.Net.TestFramework/Util/TestUtil.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Util/TestUtil.cs b/src/Lucene.Net.TestFramework/Util/TestUtil.cs index 82db342..c511dc9 100644 --- a/src/Lucene.Net.TestFramework/Util/TestUtil.cs +++ b/src/Lucene.Net.TestFramework/Util/TestUtil.cs @@ -1036,7 +1036,7 @@ namespace Lucene.Net.Util Field field1 = (Field)f; Field field2; DocValuesType? dvType = field1.FieldType.DocValueType; - Documents.NumericType? numType = field1.FieldType.NumericType; + Documents.NumericType? numType = ((FieldType)field1.FieldType).NumericType; if (dvType != null) { switch (dvType) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bd5b34d9/src/Lucene.Net.Tests/Index/TestCodecs.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Index/TestCodecs.cs b/src/Lucene.Net.Tests/Index/TestCodecs.cs index fcc4093..8feaf0b 100644 --- a/src/Lucene.Net.Tests/Index/TestCodecs.cs +++ b/src/Lucene.Net.Tests/Index/TestCodecs.cs @@ -139,67 +139,51 @@ namespace Lucene.Net.Index public bool IsIndexed { get { return true; } - set { } } public bool IsStored { get { return false; } - set { } } public bool IsTokenized { get { return false; } - set { } } public bool StoreTermVectors { get { return false; } - set { } } public bool StoreTermVectorOffsets { get { return false; } - set { } } public bool StoreTermVectorPositions { get { return false; } - set { } } public bool StoreTermVectorPayloads { get { return false; } - set { } } public bool OmitNorms { get { return false; } - set { } } - public IndexOptions? IndexOptions + public IndexOptions IndexOptions { get { return OmitTF ? Index.IndexOptions.DOCS_ONLY : Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; } - set { } - } - - public NumericType? NumericType - { - get { throw new NotImplementedException(); } - set { } } public DocValuesType? DocValueType { get { return null; } - set { } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bd5b34d9/src/Lucene.Net.Tests/Index/TestIndexableField.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Index/TestIndexableField.cs b/src/Lucene.Net.Tests/Index/TestIndexableField.cs index b05dd77..e7780d8 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexableField.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexableField.cs @@ -71,37 +71,31 @@ namespace Lucene.Net.Index public bool IsIndexed { get { return (OuterInstance.Counter % 10) != 3; } - set { } } public bool IsStored { get { return (OuterInstance.Counter & 1) == 0 || (OuterInstance.Counter % 10) == 3; } - set { } } public bool IsTokenized { get { return true; } - set { } } public bool StoreTermVectors { get { return IsIndexed && OuterInstance.Counter % 2 == 1 && OuterInstance.Counter % 10 != 9; } - set { } } public bool StoreTermVectorOffsets { get { return StoreTermVectors && OuterInstance.Counter % 10 != 9; } - set { } } public bool StoreTermVectorPositions { get { return StoreTermVectors && OuterInstance.Counter % 10 != 9; } - set { } } public bool StoreTermVectorPayloads @@ -119,31 +113,21 @@ namespace Lucene.Net.Index return StoreTermVectors && OuterInstance.Counter % 10 != 9; } } - set { } } public bool OmitNorms { get { return false; } - set { } } - public IndexOptions? IndexOptions + public IndexOptions IndexOptions { get { return Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; } - set { } - } - - public NumericType? NumericType - { - get { throw new NotImplementedException(); } - set { } } public DocValuesType? DocValueType { get { return null; } - set { } } }
