Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5783B200C39 for ; Wed, 8 Feb 2017 15:31:49 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 564B8160B6D; Wed, 8 Feb 2017 14:31:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E3CB1160B4E for ; Wed, 8 Feb 2017 15:31:46 +0100 (CET) Received: (qmail 54291 invoked by uid 500); 8 Feb 2017 14:31:43 -0000 Mailing-List: contact commits-help@lucenenet.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucene-net-dev@lucenenet.apache.org Delivered-To: mailing list commits@lucenenet.apache.org Received: (qmail 53312 invoked by uid 99); 8 Feb 2017 14:31:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2017 14:31:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B3340DFE20; Wed, 8 Feb 2017 14:31:42 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: nightowl888@apache.org To: commits@lucenenet.apache.org Date: Wed, 08 Feb 2017 14:32:22 -0000 Message-Id: <909b549c279d4e96bf222321f6aa90e3@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [43/53] [abbrv] lucenenet git commit: SWEEP: Renamed constant and enum value names from Short, Int, Long, and Float to match CLR types Int16, Int32, Int64, and Single, respectively. archived-at: Wed, 08 Feb 2017 14:31:49 -0000 SWEEP: Renamed constant and enum value names from Short, Int, Long, and Float to match CLR types Int16, Int32, Int64, and Single, respectively. Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/73cb5b22 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/73cb5b22 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/73cb5b22 Branch: refs/heads/api-work Commit: 73cb5b22693ffcbbc27059d9e80fa96ccdd8d8d0 Parents: 253382f Author: Shad Storhaug Authored: Wed Feb 8 16:35:27 2017 +0700 Committer: Shad Storhaug Committed: Wed Feb 8 21:08:24 2017 +0700 ---------------------------------------------------------------------- .../Analysis/Synonym/SynonymFilter.cs | 4 +- .../CompressingStoredFieldsReader.cs | 12 ++-- .../CompressingStoredFieldsWriter.cs | 36 ++++++++---- .../Lucene45/Lucene45DocValuesProducer.cs | 6 +- src/Lucene.Net.Core/Document/Field.cs | 6 +- src/Lucene.Net.Core/Document/FieldType.cs | 21 +++++-- src/Lucene.Net.Core/Document/FloatField.cs | 12 ++-- src/Lucene.Net.Core/Document/IntField.cs | 10 ++-- src/Lucene.Net.Core/Document/LongField.cs | 12 ++-- src/Lucene.Net.Core/Index/BufferedUpdates.cs | 19 ++++--- src/Lucene.Net.Core/Index/CoalescedUpdates.cs | 2 +- src/Lucene.Net.Core/Index/DocTermOrds.cs | 2 +- src/Lucene.Net.Core/Index/DocValuesUpdate.cs | 6 +- .../Index/DocumentsWriterDeleteQueue.cs | 6 +- .../Index/DocumentsWriterPerThread.cs | 8 +-- .../Index/FreqProxTermsWriterPerField.cs | 8 +-- .../Index/FrozenBufferedUpdates.cs | 2 +- .../Index/ParallelPostingsArray.cs | 2 +- .../Index/SortedDocValuesWriter.cs | 2 +- .../Index/SortedSetDocValuesWriter.cs | 4 +- .../Index/TermVectorsConsumerPerField.cs | 2 +- src/Lucene.Net.Core/Index/TermsHashPerField.cs | 16 +++--- src/Lucene.Net.Core/Search/CachingCollector.cs | 14 +++-- src/Lucene.Net.Core/Search/FieldCache.cs | 49 +++++++++++----- src/Lucene.Net.Core/Search/FieldCacheImpl.cs | 42 +++++++------- src/Lucene.Net.Core/Search/NumericRangeQuery.cs | 60 ++++++++++++-------- src/Lucene.Net.Core/Search/ScoringRewrite.cs | 2 +- src/Lucene.Net.Core/Search/SortField.cs | 47 ++++++++------- src/Lucene.Net.Core/Util/ArrayUtil.cs | 14 ++--- .../Util/Automaton/SortedIntSet.cs | 2 +- src/Lucene.Net.Core/Util/BytesRefArray.cs | 4 +- src/Lucene.Net.Core/Util/BytesRefHash.cs | 14 ++--- .../Util/FieldCacheSanityChecker.cs | 2 +- src/Lucene.Net.Core/Util/Fst/FST.cs | 34 ++++++----- src/Lucene.Net.Core/Util/IntBlockPool.cs | 53 ++++++++++------- src/Lucene.Net.Core/Util/IntsRef.cs | 17 +++--- src/Lucene.Net.Core/Util/LongsRef.cs | 19 ++++--- src/Lucene.Net.Core/Util/NumericUtils.cs | 48 +++++++++------- .../Util/Packed/AbstractAppendingLongBuffer.cs | 8 +-- .../Util/Packed/AbstractPagedMutable.cs | 2 +- src/Lucene.Net.Core/Util/Packed/Direct16.cs | 2 +- src/Lucene.Net.Core/Util/Packed/Direct32.cs | 2 +- src/Lucene.Net.Core/Util/Packed/Direct64.cs | 2 +- src/Lucene.Net.Core/Util/Packed/Direct8.cs | 2 +- .../Util/Packed/EliasFanoDecoder.cs | 29 +++++----- .../Util/Packed/EliasFanoEncoder.cs | 12 ++-- .../Util/Packed/GrowableWriter.cs | 4 +- .../Util/Packed/Packed16ThreeBlocks.cs | 2 +- src/Lucene.Net.Core/Util/Packed/Packed64.cs | 4 +- .../Util/Packed/Packed64SingleBlock.cs | 2 +- .../Util/Packed/Packed8ThreeBlocks.cs | 2 +- src/Lucene.Net.Core/Util/Packed/PackedInts.cs | 2 +- .../Util/Packed/PagedGrowableWriter.cs | 2 +- src/Lucene.Net.Core/Util/RamUsageEstimator.cs | 42 +++++++++----- .../Util/RecyclingIntBlockAllocator.cs | 14 ++--- src/Lucene.Net.Core/Util/WAH8DocIdSet.cs | 2 +- src/Lucene.Net.Expressions/SimpleBindings.cs | 6 +- src/Lucene.Net.Memory/MemoryIndex.cs | 12 ++-- .../Builders/NumericRangeQueryNodeBuilder.cs | 6 +- .../Standard/Nodes/NumericRangeQueryNode.cs | 6 +- .../Processors/NumericQueryNodeProcessor.cs | 6 +- .../NumericRangeQueryNodeProcessor.cs | 6 +- .../Analyzing/AnalyzingInfixSuggester.cs | 2 +- .../Index/BaseStoredFieldsFormatTestCase.cs | 6 +- .../Util/ApiScanTestBase.cs | 5 ++ src/Lucene.Net.TestFramework/Util/TestUtil.cs | 6 +- .../TestDemoExpressions.cs | 2 +- .../TestExpressionRescorer.cs | 2 +- .../TestExpressionSortField.cs | 10 ++-- .../TestExpressionSorts.cs | 10 ++-- .../TestExpressionValidation.cs | 10 ++-- .../TestExpressionValueSource.cs | 16 +++--- src/Lucene.Net.Tests.Facet/TestDrillSideways.cs | 2 +- .../AllGroupHeadsCollectorTest.cs | 4 +- src/Lucene.Net.Tests.Grouping/TestGrouping.cs | 2 +- src/Lucene.Net.Tests.Join/TestBlockJoin.cs | 2 +- .../Index/Sorter/IndexSortingTest.cs | 4 +- .../Index/Sorter/SortingAtomicReaderTest.cs | 2 +- .../Index/Sorter/TestBlockJoinSorter.cs | 4 +- .../Index/Sorter/TestEarlyTermination.cs | 8 +-- .../Index/Sorter/TestSortingMergePolicy.cs | 2 +- .../Flexible/Standard/TestNumericQueryParser.cs | 32 +++++------ src/Lucene.Net.Tests.Spatial/SpatialExample.cs | 2 +- .../Index/TestDocumentsWriterDeleteQueue.cs | 4 +- .../core/Index/TestIntBlockPool.cs | 10 ++-- .../core/Search/TestFieldCache.cs | 8 +-- .../core/Search/TestNumericRangeQuery32.cs | 4 +- .../core/Search/TestNumericRangeQuery64.cs | 4 +- .../core/Search/TestSearchAfter.cs | 30 +++++----- .../core/Search/TestShardSearching.cs | 2 +- src/Lucene.Net.Tests/core/Search/TestSort.cs | 40 ++++++------- .../core/Search/TestSortDocValues.cs | 28 ++++----- .../core/Search/TestSortRescorer.cs | 4 +- .../core/Search/TestTopDocsMerge.cs | 8 +-- src/Lucene.Net.Tests/core/TestSearch.cs | 2 +- .../core/TestSearchForDuplicates.cs | 2 +- .../core/Util/TestFieldCacheSanityChecker.cs | 4 +- src/Lucene.Net.Tests/core/Util/TestIntsRef.cs | 2 +- .../core/Util/TestNumericUtils.cs | 16 +++--- 99 files changed, 615 insertions(+), 482 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymFilter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymFilter.cs index 647d8ff..052c985 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymFilter.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Synonym/SynonymFilter.cs @@ -213,13 +213,13 @@ namespace Lucene.Net.Analysis.Synonym } if (count == endOffsets.Length) { - int[] next = new int[ArrayUtil.Oversize(1 + count, RamUsageEstimator.NUM_BYTES_INT)]; + int[] next = new int[ArrayUtil.Oversize(1 + count, RamUsageEstimator.NUM_BYTES_INT32)]; Array.Copy(endOffsets, 0, next, 0, count); endOffsets = next; } if (count == posLengths.Length) { - int[] next = new int[ArrayUtil.Oversize(1 + count, RamUsageEstimator.NUM_BYTES_INT)]; + int[] next = new int[ArrayUtil.Oversize(1 + count, RamUsageEstimator.NUM_BYTES_INT32)]; Array.Copy(posLengths, 0, next, 0, count); posLengths = next; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Codecs/Compressing/CompressingStoredFieldsReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Codecs/Compressing/CompressingStoredFieldsReader.cs b/src/Lucene.Net.Core/Codecs/Compressing/CompressingStoredFieldsReader.cs index 6fcb5e9..48d55d8 100644 --- a/src/Lucene.Net.Core/Codecs/Compressing/CompressingStoredFieldsReader.cs +++ b/src/Lucene.Net.Core/Codecs/Compressing/CompressingStoredFieldsReader.cs @@ -203,15 +203,15 @@ namespace Lucene.Net.Codecs.Compressing #pragma warning restore 612, 618 break; - case CompressingStoredFieldsWriter.NUMERIC_INT: + case CompressingStoredFieldsWriter.NUMERIC_INT32: visitor.Int32Field(info, @in.ReadInt32()); break; - case CompressingStoredFieldsWriter.NUMERIC_FLOAT: + case CompressingStoredFieldsWriter.NUMERIC_SINGLE: visitor.SingleField(info, Number.Int32BitsToSingle(@in.ReadInt32())); break; - case CompressingStoredFieldsWriter.NUMERIC_LONG: + case CompressingStoredFieldsWriter.NUMERIC_INT64: visitor.Int64Field(info, @in.ReadInt64()); break; @@ -234,12 +234,12 @@ namespace Lucene.Net.Codecs.Compressing @in.SkipBytes(length); break; - case CompressingStoredFieldsWriter.NUMERIC_INT: - case CompressingStoredFieldsWriter.NUMERIC_FLOAT: + case CompressingStoredFieldsWriter.NUMERIC_INT32: + case CompressingStoredFieldsWriter.NUMERIC_SINGLE: @in.ReadInt32(); break; - case CompressingStoredFieldsWriter.NUMERIC_LONG: + case CompressingStoredFieldsWriter.NUMERIC_INT64: case CompressingStoredFieldsWriter.NUMERIC_DOUBLE: @in.ReadInt64(); break; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Codecs/Compressing/CompressingStoredFieldsWriter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Codecs/Compressing/CompressingStoredFieldsWriter.cs b/src/Lucene.Net.Core/Codecs/Compressing/CompressingStoredFieldsWriter.cs index 1097cb2..6767d26 100644 --- a/src/Lucene.Net.Core/Codecs/Compressing/CompressingStoredFieldsWriter.cs +++ b/src/Lucene.Net.Core/Codecs/Compressing/CompressingStoredFieldsWriter.cs @@ -38,9 +38,21 @@ namespace Lucene.Net.Codecs.Compressing internal const int STRING = 0x00; internal const int BYTE_ARR = 0x01; - internal const int NUMERIC_INT = 0x02; - internal const int NUMERIC_FLOAT = 0x03; - internal const int NUMERIC_LONG = 0x04; + + /// + /// NOTE: This was NUMERIC_INT in Lucene + /// + internal const int NUMERIC_INT32 = 0x02; + + /// + /// NOTE: This was NUMERIC_FLOAT in Lucene + /// + internal const int NUMERIC_SINGLE = 0x03; + + /// + /// NOTE:This was NUMERIC_LONG in Lucene + /// + internal const int NUMERIC_INT64 = 0x04; internal const int NUMERIC_DOUBLE = 0x05; internal static readonly int TYPE_BITS = PackedInt32s.BitsRequired(NUMERIC_DOUBLE); @@ -270,15 +282,15 @@ namespace Lucene.Net.Codecs.Compressing double dummyDouble; if (sbyte.TryParse(numStr, out dummySbyte) || short.TryParse(numStr, out dummyShort) || int.TryParse(numStr, out dummyInt)) { - bits = NUMERIC_INT; + bits = NUMERIC_INT32; } else if (long.TryParse(numStr, out dummyLong)) { - bits = NUMERIC_LONG; + bits = NUMERIC_INT64; } else if (float.TryParse(numStr, out dummyFloat)) { - bits = NUMERIC_FLOAT; + bits = NUMERIC_SINGLE; } else if (double.TryParse(numStr, out dummyDouble)) { @@ -293,15 +305,15 @@ namespace Lucene.Net.Codecs.Compressing { if (number is sbyte || number is short || number is int) { - bits = NUMERIC_INT; + bits = NUMERIC_INT32; } else if (number is long) { - bits = NUMERIC_LONG; + bits = NUMERIC_INT64; } else if (number is float) { - bits = NUMERIC_FLOAT; + bits = NUMERIC_SINGLE; } else if (number is double) { @@ -361,15 +373,15 @@ namespace Lucene.Net.Codecs.Compressing if (sbyte.TryParse(numStr, out dummySbyte) || short.TryParse(numStr, out dummyShort) || int.TryParse(numStr, out dummyInt)) { - bits = NUMERIC_INT; + bits = NUMERIC_INT32; } else if (long.TryParse(numStr, out dummyLong)) { - bits = NUMERIC_LONG; + bits = NUMERIC_INT64; } else if (float.TryParse(numStr, out dummyFloat)) { - bits = NUMERIC_FLOAT; + bits = NUMERIC_SINGLE; } else if (double.TryParse(numStr, out dummyDouble)) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesProducer.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesProducer.cs b/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesProducer.cs index a6f15d4..6626f00 100644 --- a/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesProducer.cs +++ b/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesProducer.cs @@ -515,7 +515,7 @@ namespace Lucene.Net.Codecs.Lucene45 data.Seek(bytes.AddressesOffset); addrInstance = new MonotonicBlockPackedReader(data, bytes.PackedInt32sVersion, bytes.BlockSize, bytes.Count, false); addressInstances[field.Number] = addrInstance; - ramBytesUsed.AddAndGet(addrInstance.RamBytesUsed() + RamUsageEstimator.NUM_BYTES_INT); + ramBytesUsed.AddAndGet(addrInstance.RamBytesUsed() + RamUsageEstimator.NUM_BYTES_INT32); } addresses = addrInstance; } @@ -595,7 +595,7 @@ namespace Lucene.Net.Codecs.Lucene45 } addrInstance = new MonotonicBlockPackedReader(data, bytes.PackedInt32sVersion, bytes.BlockSize, size, false); addressInstances[field.Number] = addrInstance; - ramBytesUsed.AddAndGet(addrInstance.RamBytesUsed() + RamUsageEstimator.NUM_BYTES_INT); + ramBytesUsed.AddAndGet(addrInstance.RamBytesUsed() + RamUsageEstimator.NUM_BYTES_INT32); } addresses = addrInstance; } @@ -697,7 +697,7 @@ namespace Lucene.Net.Codecs.Lucene45 data.Seek(entry.Offset); ordIndexInstance = new MonotonicBlockPackedReader(data, entry.PackedInt32sVersion, entry.BlockSize, entry.Count, false); ordIndexInstances[field.Number] = ordIndexInstance; - ramBytesUsed.AddAndGet(ordIndexInstance.RamBytesUsed() + RamUsageEstimator.NUM_BYTES_INT); + ramBytesUsed.AddAndGet(ordIndexInstance.RamBytesUsed() + RamUsageEstimator.NUM_BYTES_INT32); } ordIndex = ordIndexInstance; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Document/Field.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Document/Field.cs b/src/Lucene.Net.Core/Document/Field.cs index fffd5d1..fb55704 100644 --- a/src/Lucene.Net.Core/Document/Field.cs +++ b/src/Lucene.Net.Core/Document/Field.cs @@ -576,15 +576,15 @@ namespace Lucene.Net.Documents object val = m_fieldsData; switch (numericType) { - case NumericType.INT: + case NumericType.INT32: nts.SetInt32Value(Convert.ToInt32(val)); break; - case NumericType.LONG: + case NumericType.INT64: nts.SetInt64Value(Convert.ToInt64(val)); break; - case NumericType.FLOAT: + case NumericType.SINGLE: nts.SetSingleValue(Convert.ToSingle(val)); break; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Document/FieldType.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Document/FieldType.cs b/src/Lucene.Net.Core/Document/FieldType.cs index 065f28a..24bbc6f 100644 --- a/src/Lucene.Net.Core/Document/FieldType.cs +++ b/src/Lucene.Net.Core/Document/FieldType.cs @@ -406,16 +406,25 @@ namespace Lucene.Net.Documents public enum NumericType { /// - /// 32-bit integer numeric type - INT, + /// 32-bit integer numeric type + /// + /// NOTE: This was INT in Lucene + /// + INT32, /// - /// 64-bit long numeric type - LONG, + /// 64-bit long numeric type + /// + /// NOTE: This was LONG in Lucene + /// + INT64, /// - /// 32-bit float numeric type - FLOAT, + /// 32-bit float numeric type + /// + /// NOTE: This was FLOAT in Lucene + /// + SINGLE, /// /// 64-bit double numeric type http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Document/FloatField.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Document/FloatField.cs b/src/Lucene.Net.Core/Document/FloatField.cs index 57aa6da..aecce21 100644 --- a/src/Lucene.Net.Core/Document/FloatField.cs +++ b/src/Lucene.Net.Core/Document/FloatField.cs @@ -52,7 +52,7 @@ namespace Lucene.Net.Documents /// FloatField, use or {@link /// NumericRangeFilter}. To sort according to a /// FloatField, use the normal numeric sort types, eg - /// . FloatField + /// . FloatField /// values can also be loaded directly from .

/// ///

You may add the same field name as an FloatField to @@ -123,14 +123,14 @@ namespace Lucene.Net.Documents TYPE_NOT_STORED.IsTokenized = true; TYPE_NOT_STORED.OmitNorms = true; TYPE_NOT_STORED.IndexOptions = IndexOptions.DOCS_ONLY; - TYPE_NOT_STORED.NumericType = NumericType.FLOAT; + TYPE_NOT_STORED.NumericType = NumericType.SINGLE; TYPE_NOT_STORED.Freeze(); TYPE_STORED.IsIndexed = true; TYPE_STORED.IsTokenized = true; TYPE_STORED.OmitNorms = true; TYPE_STORED.IndexOptions = IndexOptions.DOCS_ONLY; - TYPE_STORED.NumericType = NumericType.FLOAT; + TYPE_STORED.NumericType = NumericType.SINGLE; TYPE_STORED.IsStored = true; TYPE_STORED.Freeze(); } @@ -159,15 +159,15 @@ namespace Lucene.Net.Documents /// Expert: allows you to customize the {@link /// FieldType}. /// field name - /// 32-bit float value + /// 32-bit value /// customized field type: must have - /// of . + /// of . /// if the field name or type is null, or /// if the field type does not have a FLOAT numericType() public SingleField(string name, float value, FieldType type) : base(name, type) { - if (type.NumericType != NumericType.FLOAT) + if (type.NumericType != NumericType.SINGLE) { throw new System.ArgumentException("type.numericType() must be FLOAT but got " + type.NumericType); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Document/IntField.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Document/IntField.cs b/src/Lucene.Net.Core/Document/IntField.cs index b5f2f54..1bf05f8 100644 --- a/src/Lucene.Net.Core/Document/IntField.cs +++ b/src/Lucene.Net.Core/Document/IntField.cs @@ -52,7 +52,7 @@ namespace Lucene.Net.Documents /// IntField, use or {@link /// NumericRangeFilter}. To sort according to a /// IntField, use the normal numeric sort types, eg - /// . IntField + /// . IntField /// values can also be loaded directly from .

/// ///

You may add the same field name as an IntField to @@ -123,14 +123,14 @@ namespace Lucene.Net.Documents TYPE_NOT_STORED.IsTokenized = true; TYPE_NOT_STORED.OmitNorms = true; TYPE_NOT_STORED.IndexOptions = IndexOptions.DOCS_ONLY; - TYPE_NOT_STORED.NumericType = NumericType.INT; + TYPE_NOT_STORED.NumericType = NumericType.INT32; TYPE_NOT_STORED.Freeze(); TYPE_STORED.IsIndexed = true; TYPE_STORED.IsTokenized = true; TYPE_STORED.OmitNorms = true; TYPE_STORED.IndexOptions = IndexOptions.DOCS_ONLY; - TYPE_STORED.NumericType = NumericType.INT; + TYPE_STORED.NumericType = NumericType.INT32; TYPE_STORED.IsStored = true; TYPE_STORED.Freeze(); } @@ -161,13 +161,13 @@ namespace Lucene.Net.Documents /// field name /// 32-bit integer value /// customized field type: must have - /// of . + /// of . /// if the field name or type is null, or /// if the field type does not have a INT numericType() public Int32Field(string name, int value, FieldType type) : base(name, type) { - if (type.NumericType != NumericType.INT) + if (type.NumericType != NumericType.INT32) { throw new System.ArgumentException("type.NumericType must be INT but got " + type.NumericType); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Document/LongField.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Document/LongField.cs b/src/Lucene.Net.Core/Document/LongField.cs index 8296269..b78e633 100644 --- a/src/Lucene.Net.Core/Document/LongField.cs +++ b/src/Lucene.Net.Core/Document/LongField.cs @@ -62,7 +62,7 @@ namespace Lucene.Net.Documents /// LongField, use or {@link /// NumericRangeFilter}. To sort according to a /// LongField, use the normal numeric sort types, eg - /// . LongField + /// . LongField /// values can also be loaded directly from .

/// ///

You may add the same field name as an LongField to @@ -133,14 +133,14 @@ namespace Lucene.Net.Documents TYPE_NOT_STORED.IsTokenized = true; TYPE_NOT_STORED.OmitNorms = true; TYPE_NOT_STORED.IndexOptions = IndexOptions.DOCS_ONLY; - TYPE_NOT_STORED.NumericType = NumericType.LONG; + TYPE_NOT_STORED.NumericType = NumericType.INT64; TYPE_NOT_STORED.Freeze(); TYPE_STORED.IsIndexed = true; TYPE_STORED.IsTokenized = true; TYPE_STORED.OmitNorms = true; TYPE_STORED.IndexOptions = IndexOptions.DOCS_ONLY; - TYPE_STORED.NumericType = NumericType.LONG; + TYPE_STORED.NumericType = NumericType.INT64; TYPE_STORED.IsStored = true; TYPE_STORED.Freeze(); } @@ -169,15 +169,15 @@ namespace Lucene.Net.Documents /// Expert: allows you to customize the {@link /// FieldType}. /// field name - /// 64-bit long value + /// 64-bit value /// customized field type: must have - /// of . + /// of . /// if the field name or type is null, or /// if the field type does not have a LONG numericType() public Int64Field(string name, long value, FieldType type) : base(name, type) { - if (type.NumericType != NumericType.LONG) + if (type.NumericType != NumericType.INT64) { throw new System.ArgumentException("type.numericType() must be LONG but got " + type.NumericType); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Index/BufferedUpdates.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/BufferedUpdates.cs b/src/Lucene.Net.Core/Index/BufferedUpdates.cs index 3f66ed5..4496998 100644 --- a/src/Lucene.Net.Core/Index/BufferedUpdates.cs +++ b/src/Lucene.Net.Core/Index/BufferedUpdates.cs @@ -49,19 +49,19 @@ namespace Lucene.Net.Index Term's text is String (OBJ_HEADER + 4*INT + POINTER + OBJ_HEADER + string.length*CHAR). Integer is OBJ_HEADER + INT. */ - internal static readonly int BYTES_PER_DEL_TERM = 9 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + 7 * RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + 10 * RamUsageEstimator.NUM_BYTES_INT; + internal static readonly int BYTES_PER_DEL_TERM = 9 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + 7 * RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + 10 * RamUsageEstimator.NUM_BYTES_INT32; /* Rough logic: del docIDs are List. Say list allocates ~2X size (2*POINTER). Integer is OBJ_HEADER + int */ - internal static readonly int BYTES_PER_DEL_DOCID = 2 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + RamUsageEstimator.NUM_BYTES_INT; + internal static readonly int BYTES_PER_DEL_DOCID = 2 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + RamUsageEstimator.NUM_BYTES_INT32; /* Rough logic: HashMap has an array[Entry] w/ varying load factor (say 2 * POINTER). Entry is object w/ Query key, Integer val, int hash, Entry next (OBJ_HEADER + 3*POINTER + INT). Query we often undercount (say 24 bytes). Integer is OBJ_HEADER + INT. */ - internal static readonly int BYTES_PER_DEL_QUERY = 5 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + 2 * RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + 2 * RamUsageEstimator.NUM_BYTES_INT + 24; + internal static readonly int BYTES_PER_DEL_QUERY = 5 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + 2 * RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + 2 * RamUsageEstimator.NUM_BYTES_INT32 + 24; /* Rough logic: NumericUpdate calculates its actual size, * including the update Term and DV field (String). The @@ -77,7 +77,7 @@ namespace Lucene.Net.Index * LinkedHashMap (val) is counted as OBJ_HEADER, array[Entry] ref + header, 4*INT, 1*FLOAT, * Set (entrySet) (2*OBJ_HEADER + ARRAY_HEADER + 2*POINTER + 4*INT + FLOAT) */ - internal static readonly int BYTES_PER_NUMERIC_FIELD_ENTRY = 7 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + 3 * RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + RamUsageEstimator.NUM_BYTES_ARRAY_HEADER + 5 * RamUsageEstimator.NUM_BYTES_INT + RamUsageEstimator.NUM_BYTES_FLOAT; + internal static readonly int BYTES_PER_NUMERIC_FIELD_ENTRY = 7 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + 3 * RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + RamUsageEstimator.NUM_BYTES_ARRAY_HEADER + 5 * RamUsageEstimator.NUM_BYTES_INT32 + RamUsageEstimator.NUM_BYTES_SINGLE; /* Rough logic: Incremented when we see another Term for an already updated * field. @@ -88,7 +88,7 @@ namespace Lucene.Net.Index * Term (key) is counted only as POINTER. * NumericUpdate (val) counts its own size and isn't accounted for here. */ - internal static readonly int BYTES_PER_NUMERIC_UPDATE_ENTRY = 7 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + RamUsageEstimator.NUM_BYTES_INT; + internal static readonly int BYTES_PER_NUMERIC_UPDATE_ENTRY = 7 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + RamUsageEstimator.NUM_BYTES_INT32; /* Rough logic: BinaryUpdate calculates its actual size, * including the update Term and DV field (String). The @@ -104,7 +104,7 @@ namespace Lucene.Net.Index * LinkedHashMap (val) is counted as OBJ_HEADER, array[Entry] ref + header, 4*INT, 1*FLOAT, * Set (entrySet) (2*OBJ_HEADER + ARRAY_HEADER + 2*POINTER + 4*INT + FLOAT) */ - internal static readonly int BYTES_PER_BINARY_FIELD_ENTRY = 7 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + 3 * RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + RamUsageEstimator.NUM_BYTES_ARRAY_HEADER + 5 * RamUsageEstimator.NUM_BYTES_INT + RamUsageEstimator.NUM_BYTES_FLOAT; + internal static readonly int BYTES_PER_BINARY_FIELD_ENTRY = 7 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + 3 * RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + RamUsageEstimator.NUM_BYTES_ARRAY_HEADER + 5 * RamUsageEstimator.NUM_BYTES_INT32 + RamUsageEstimator.NUM_BYTES_SINGLE; /* Rough logic: Incremented when we see another Term for an already updated * field. @@ -115,7 +115,7 @@ namespace Lucene.Net.Index * Term (key) is counted only as POINTER. * BinaryUpdate (val) counts its own size and isn't accounted for here. */ - internal static readonly int BYTES_PER_BINARY_UPDATE_ENTRY = 7 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + RamUsageEstimator.NUM_BYTES_INT; + internal static readonly int BYTES_PER_BINARY_UPDATE_ENTRY = 7 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + RamUsageEstimator.NUM_BYTES_INT32; internal readonly AtomicInt32 numTermDeletes = new AtomicInt32(); internal readonly AtomicInt32 numNumericUpdates = new AtomicInt32(); @@ -143,7 +143,10 @@ namespace Lucene.Net.Index // only once). internal readonly IDictionary> binaryUpdates = new Dictionary>(); - public static readonly int MAX_INT = Convert.ToInt32(int.MaxValue); + ///

+ /// NOTE: This was MAX_INT in Lucene + /// + public static readonly int MAX_INT32 = Convert.ToInt32(int.MaxValue); internal readonly AtomicInt64 bytesUsed; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Index/CoalescedUpdates.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/CoalescedUpdates.cs b/src/Lucene.Net.Core/Index/CoalescedUpdates.cs index 330cdc6..5b27296 100644 --- a/src/Lucene.Net.Core/Index/CoalescedUpdates.cs +++ b/src/Lucene.Net.Core/Index/CoalescedUpdates.cs @@ -48,7 +48,7 @@ namespace Lucene.Net.Index for (int queryIdx = 0; queryIdx < @in.queries.Length; queryIdx++) { Query query = @in.queries[queryIdx]; - queries[query] = BufferedUpdates.MAX_INT; + queries[query] = BufferedUpdates.MAX_INT32; } foreach (NumericDocValuesUpdate nu in @in.numericDVUpdates) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Index/DocTermOrds.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/DocTermOrds.cs b/src/Lucene.Net.Core/Index/DocTermOrds.cs index 6e2e076..0c087ca 100644 --- a/src/Lucene.Net.Core/Index/DocTermOrds.cs +++ b/src/Lucene.Net.Core/Index/DocTermOrds.cs @@ -43,7 +43,7 @@ namespace Lucene.Net.Index /// /// While normally term ords are type long, in this API they are /// int as the internal representation here cannot address - /// more than MAX_INT unique terms. Also, typically this + /// more than MAX_INT32 unique terms. Also, typically this /// class is used on fields with relatively few unique terms /// vs the number of documents. In addition, there is an /// internal limit (16 MB) on how many bytes each chunk of http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Index/DocValuesUpdate.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/DocValuesUpdate.cs b/src/Lucene.Net.Core/Index/DocValuesUpdate.cs index 52aeef5..fa9ac1f 100644 --- a/src/Lucene.Net.Core/Index/DocValuesUpdate.cs +++ b/src/Lucene.Net.Core/Index/DocValuesUpdate.cs @@ -34,7 +34,7 @@ namespace Lucene.Net.Index * String: 2*OBJ_HEADER + 4*INT + PTR + string.length*CHAR * T: OBJ_HEADER */ - private static readonly int RAW_SIZE_IN_BYTES = 8 * RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + 8 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + 8 * RamUsageEstimator.NUM_BYTES_INT; + private static readonly int RAW_SIZE_IN_BYTES = 8 * RamUsageEstimator.NUM_BYTES_OBJECT_HEADER + 8 * RamUsageEstimator.NUM_BYTES_OBJECT_REF + 8 * RamUsageEstimator.NUM_BYTES_INT32; internal readonly DocValuesFieldUpdates.Type type; internal readonly Term term; @@ -78,7 +78,7 @@ namespace Lucene.Net.Index public sealed class BinaryDocValuesUpdate : DocValuesUpdate { /* Size of BytesRef: 2*INT + ARRAY_HEADER + PTR */ - private static readonly long RAW_VALUE_SIZE_IN_BYTES = RamUsageEstimator.NUM_BYTES_ARRAY_HEADER + 2 * RamUsageEstimator.NUM_BYTES_INT + RamUsageEstimator.NUM_BYTES_OBJECT_REF; + private static readonly long RAW_VALUE_SIZE_IN_BYTES = RamUsageEstimator.NUM_BYTES_ARRAY_HEADER + 2 * RamUsageEstimator.NUM_BYTES_INT32 + RamUsageEstimator.NUM_BYTES_OBJECT_REF; internal static readonly BytesRef MISSING = new BytesRef(); @@ -106,7 +106,7 @@ namespace Lucene.Net.Index internal override long ValueSizeInBytes() { - return RamUsageEstimator.NUM_BYTES_LONG; + return RamUsageEstimator.NUM_BYTES_INT64; } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Index/DocumentsWriterDeleteQueue.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/DocumentsWriterDeleteQueue.cs b/src/Lucene.Net.Core/Index/DocumentsWriterDeleteQueue.cs index 634c0c1..4beaf41 100644 --- a/src/Lucene.Net.Core/Index/DocumentsWriterDeleteQueue.cs +++ b/src/Lucene.Net.Core/Index/DocumentsWriterDeleteQueue.cs @@ -224,7 +224,7 @@ namespace Lucene.Net.Index if (UpdateSlice(globalSlice)) { // System.out.println(Thread.currentThread() + ": apply globalSlice"); - globalSlice.Apply(globalBufferedUpdates, BufferedUpdates.MAX_INT); + globalSlice.Apply(globalBufferedUpdates, BufferedUpdates.MAX_INT32); } } finally @@ -255,7 +255,7 @@ namespace Lucene.Net.Index if (globalSlice.sliceTail != currentTail) { globalSlice.sliceTail = currentTail; - globalSlice.Apply(globalBufferedUpdates, BufferedUpdates.MAX_INT); + globalSlice.Apply(globalBufferedUpdates, BufferedUpdates.MAX_INT32); } FrozenBufferedUpdates packet = new FrozenBufferedUpdates(globalBufferedUpdates, false); @@ -496,7 +496,7 @@ namespace Lucene.Net.Index if (globalSlice.sliceTail != currentTail) { globalSlice.sliceTail = currentTail; - globalSlice.Apply(globalBufferedUpdates, BufferedUpdates.MAX_INT); + globalSlice.Apply(globalBufferedUpdates, BufferedUpdates.MAX_INT32); } return globalBufferedUpdates.Any(); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Index/DocumentsWriterPerThread.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/DocumentsWriterPerThread.cs b/src/Lucene.Net.Core/Index/DocumentsWriterPerThread.cs index 56e01ec..a46ecdd 100644 --- a/src/Lucene.Net.Core/Index/DocumentsWriterPerThread.cs +++ b/src/Lucene.Net.Core/Index/DocumentsWriterPerThread.cs @@ -713,7 +713,7 @@ namespace Lucene.Net.Index private readonly Counter bytesUsed; public Int32BlockAllocator(Counter bytesUsed) - : base(Int32BlockPool.INT_BLOCK_SIZE) + : base(Int32BlockPool.INT32_BLOCK_SIZE) { this.bytesUsed = bytesUsed; } @@ -722,14 +722,14 @@ namespace Lucene.Net.Index public override int[] GetInt32Block() { - int[] b = new int[Int32BlockPool.INT_BLOCK_SIZE]; - bytesUsed.AddAndGet(Int32BlockPool.INT_BLOCK_SIZE * RamUsageEstimator.NUM_BYTES_INT); + int[] b = new int[Int32BlockPool.INT32_BLOCK_SIZE]; + bytesUsed.AddAndGet(Int32BlockPool.INT32_BLOCK_SIZE * RamUsageEstimator.NUM_BYTES_INT32); return b; } public override void RecycleInt32Blocks(int[][] blocks, int offset, int length) { - bytesUsed.AddAndGet(-(length * (Int32BlockPool.INT_BLOCK_SIZE * RamUsageEstimator.NUM_BYTES_INT))); + bytesUsed.AddAndGet(-(length * (Int32BlockPool.INT32_BLOCK_SIZE * RamUsageEstimator.NUM_BYTES_INT32))); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Index/FreqProxTermsWriterPerField.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/FreqProxTermsWriterPerField.cs b/src/Lucene.Net.Core/Index/FreqProxTermsWriterPerField.cs index 1ab3f51..b3bfdc5 100644 --- a/src/Lucene.Net.Core/Index/FreqProxTermsWriterPerField.cs +++ b/src/Lucene.Net.Core/Index/FreqProxTermsWriterPerField.cs @@ -364,18 +364,18 @@ namespace Lucene.Net.Index internal override int BytesPerPosting() { - int bytes = ParallelPostingsArray.BYTES_PER_POSTING + 2 * RamUsageEstimator.NUM_BYTES_INT; + int bytes = ParallelPostingsArray.BYTES_PER_POSTING + 2 * RamUsageEstimator.NUM_BYTES_INT32; if (lastPositions != null) { - bytes += RamUsageEstimator.NUM_BYTES_INT; + bytes += RamUsageEstimator.NUM_BYTES_INT32; } if (lastOffsets != null) { - bytes += RamUsageEstimator.NUM_BYTES_INT; + bytes += RamUsageEstimator.NUM_BYTES_INT32; } if (termFreqs != null) { - bytes += RamUsageEstimator.NUM_BYTES_INT; + bytes += RamUsageEstimator.NUM_BYTES_INT32; } return bytes; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Index/FrozenBufferedUpdates.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/FrozenBufferedUpdates.cs b/src/Lucene.Net.Core/Index/FrozenBufferedUpdates.cs index 1d9ecff..571fdb3 100644 --- a/src/Lucene.Net.Core/Index/FrozenBufferedUpdates.cs +++ b/src/Lucene.Net.Core/Index/FrozenBufferedUpdates.cs @@ -39,7 +39,7 @@ namespace Lucene.Net.Index internal class FrozenBufferedUpdates { /* Query we often undercount (say 24 bytes), plus int. */ - internal static readonly int BYTES_PER_DEL_QUERY = RamUsageEstimator.NUM_BYTES_OBJECT_REF + RamUsageEstimator.NUM_BYTES_INT + 24; + internal static readonly int BYTES_PER_DEL_QUERY = RamUsageEstimator.NUM_BYTES_OBJECT_REF + RamUsageEstimator.NUM_BYTES_INT32 + 24; // Terms, in sorted order: internal readonly PrefixCodedTerms terms; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Index/ParallelPostingsArray.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/ParallelPostingsArray.cs b/src/Lucene.Net.Core/Index/ParallelPostingsArray.cs index 6feef8f..dc1b314 100644 --- a/src/Lucene.Net.Core/Index/ParallelPostingsArray.cs +++ b/src/Lucene.Net.Core/Index/ParallelPostingsArray.cs @@ -24,7 +24,7 @@ namespace Lucene.Net.Index internal class ParallelPostingsArray { - internal static readonly int BYTES_PER_POSTING = 3 * RamUsageEstimator.NUM_BYTES_INT; + internal static readonly int BYTES_PER_POSTING = 3 * RamUsageEstimator.NUM_BYTES_INT32; internal readonly int size; internal readonly int[] textStarts; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Index/SortedDocValuesWriter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/SortedDocValuesWriter.cs b/src/Lucene.Net.Core/Index/SortedDocValuesWriter.cs index 881de17..6473a00 100644 --- a/src/Lucene.Net.Core/Index/SortedDocValuesWriter.cs +++ b/src/Lucene.Net.Core/Index/SortedDocValuesWriter.cs @@ -93,7 +93,7 @@ namespace Lucene.Net.Index // 1. when indexing, when hash is 50% full, rehash() suddenly needs 2*size ints. // TODO: can this same OOM happen in THPF? // 2. when flushing, we need 1 int per value (slot in the ordMap). - iwBytesUsed.AddAndGet(2 * RamUsageEstimator.NUM_BYTES_INT); + iwBytesUsed.AddAndGet(2 * RamUsageEstimator.NUM_BYTES_INT32); } pending.Add(termID); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Index/SortedSetDocValuesWriter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/SortedSetDocValuesWriter.cs b/src/Lucene.Net.Core/Index/SortedSetDocValuesWriter.cs index a0515ec..d892a34 100644 --- a/src/Lucene.Net.Core/Index/SortedSetDocValuesWriter.cs +++ b/src/Lucene.Net.Core/Index/SortedSetDocValuesWriter.cs @@ -136,7 +136,7 @@ namespace Lucene.Net.Index // 1. when indexing, when hash is 50% full, rehash() suddenly needs 2*size ints. // TODO: can this same OOM happen in THPF? // 2. when flushing, we need 1 int per value (slot in the ordMap). - iwBytesUsed.AddAndGet(2 * RamUsageEstimator.NUM_BYTES_INT); + iwBytesUsed.AddAndGet(2 * RamUsageEstimator.NUM_BYTES_INT32); } if (currentUpto == currentValues.Length) @@ -144,7 +144,7 @@ namespace Lucene.Net.Index currentValues = ArrayUtil.Grow(currentValues, currentValues.Length + 1); // reserve additional space for max # values per-doc // when flushing, we need an int[] to sort the mapped-ords within the doc - iwBytesUsed.AddAndGet((currentValues.Length - currentUpto) * 2 * RamUsageEstimator.NUM_BYTES_INT); + iwBytesUsed.AddAndGet((currentValues.Length - currentUpto) * 2 * RamUsageEstimator.NUM_BYTES_INT32); } currentValues[currentUpto] = termID; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Index/TermVectorsConsumerPerField.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/TermVectorsConsumerPerField.cs b/src/Lucene.Net.Core/Index/TermVectorsConsumerPerField.cs index bec57fb..13128b3 100644 --- a/src/Lucene.Net.Core/Index/TermVectorsConsumerPerField.cs +++ b/src/Lucene.Net.Core/Index/TermVectorsConsumerPerField.cs @@ -358,7 +358,7 @@ namespace Lucene.Net.Index internal override int BytesPerPosting() { - return base.BytesPerPosting() + 3 * RamUsageEstimator.NUM_BYTES_INT; + return base.BytesPerPosting() + 3 * RamUsageEstimator.NUM_BYTES_INT32; } } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Index/TermsHashPerField.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Index/TermsHashPerField.cs b/src/Lucene.Net.Core/Index/TermsHashPerField.cs index 649be47..dac6c81 100644 --- a/src/Lucene.Net.Core/Index/TermsHashPerField.cs +++ b/src/Lucene.Net.Core/Index/TermsHashPerField.cs @@ -112,8 +112,8 @@ namespace Lucene.Net.Index { Debug.Assert(stream < streamCount); int intStart = postingsArray.intStarts[termID]; - int[] ints = intPool.Buffers[intStart >> Int32BlockPool.INT_BLOCK_SHIFT]; - int upto = intStart & Int32BlockPool.INT_BLOCK_MASK; + int[] ints = intPool.Buffers[intStart >> Int32BlockPool.INT32_BLOCK_SHIFT]; + int upto = intStart & Int32BlockPool.INT32_BLOCK_MASK; reader.Init(bytePool, postingsArray.byteStarts[termID] + stream * ByteBlockPool.FIRST_LEVEL_SIZE, ints[upto + stream]); } @@ -160,7 +160,7 @@ namespace Lucene.Net.Index // First time we are seeing this token since we last // flushed the hash. // Init stream slices - if (numPostingInt + intPool.Int32Upto > Int32BlockPool.INT_BLOCK_SIZE) + if (numPostingInt + intPool.Int32Upto > Int32BlockPool.INT32_BLOCK_SIZE) { intPool.NextBuffer(); } @@ -189,8 +189,8 @@ namespace Lucene.Net.Index { termID = (-termID) - 1; int intStart = postingsArray.intStarts[termID]; - intUptos = intPool.Buffers[intStart >> Int32BlockPool.INT_BLOCK_SHIFT]; - intUptoStart = intStart & Int32BlockPool.INT_BLOCK_MASK; + intUptos = intPool.Buffers[intStart >> Int32BlockPool.INT32_BLOCK_SHIFT]; + intUptoStart = intStart & Int32BlockPool.INT32_BLOCK_MASK; consumer.AddTerm(termID); } } @@ -235,7 +235,7 @@ namespace Lucene.Net.Index { bytesHash.ByteStart(termID); // Init stream slices - if (numPostingInt + intPool.Int32Upto > Int32BlockPool.INT_BLOCK_SIZE) + if (numPostingInt + intPool.Int32Upto > Int32BlockPool.INT32_BLOCK_SIZE) { intPool.NextBuffer(); } @@ -264,8 +264,8 @@ namespace Lucene.Net.Index { termID = (-termID) - 1; int intStart = postingsArray.intStarts[termID]; - intUptos = intPool.Buffers[intStart >> Int32BlockPool.INT_BLOCK_SHIFT]; - intUptoStart = intStart & Int32BlockPool.INT_BLOCK_MASK; + intUptos = intPool.Buffers[intStart >> Int32BlockPool.INT32_BLOCK_SHIFT]; + intUptoStart = intStart & Int32BlockPool.INT32_BLOCK_MASK; consumer.AddTerm(termID); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Search/CachingCollector.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/CachingCollector.cs b/src/Lucene.Net.Core/Search/CachingCollector.cs index dff66c6..ebce3e4 100644 --- a/src/Lucene.Net.Core/Search/CachingCollector.cs +++ b/src/Lucene.Net.Core/Search/CachingCollector.cs @@ -52,7 +52,11 @@ namespace Lucene.Net.Search private const int MAX_ARRAY_SIZE = 512 * 1024; private const int INITIAL_ARRAY_SIZE = 128; - private static readonly int[] EMPTY_INT_ARRAY = new int[0]; + + /// + /// NOTE: This was EMPTY_INT_ARRAY in Lucene + /// + private static readonly int[] EMPTY_INT32_ARRAY = new int[0]; private class SegStart { @@ -202,7 +206,7 @@ namespace Lucene.Net.Search int curUpto = 0; int curBase = 0; int chunkUpto = 0; - m_curDocs = EMPTY_INT_ARRAY; + m_curDocs = EMPTY_INT32_ARRAY; foreach (SegStart seg in m_cachedSegs) { other.SetNextReader(seg.ReaderContext); @@ -309,7 +313,7 @@ namespace Lucene.Net.Search int curUpto = 0; int curbase = 0; int chunkUpto = 0; - m_curDocs = EMPTY_INT_ARRAY; + m_curDocs = EMPTY_INT32_ARRAY; foreach (SegStart seg in m_cachedSegs) { other.SetNextReader(seg.ReaderContext); @@ -448,10 +452,10 @@ namespace Lucene.Net.Search m_curDocs = new int[INITIAL_ARRAY_SIZE]; m_cachedDocs.Add(m_curDocs); - int bytesPerDoc = RamUsageEstimator.NUM_BYTES_INT; + int bytesPerDoc = RamUsageEstimator.NUM_BYTES_INT32; if (cacheScores) { - bytesPerDoc += RamUsageEstimator.NUM_BYTES_FLOAT; + bytesPerDoc += RamUsageEstimator.NUM_BYTES_SINGLE; } m_maxDocsToCache = (int)((maxRAMMB * 1024 * 1024) / bytesPerDoc); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Search/FieldCache.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/FieldCache.cs b/src/Lucene.Net.Core/Search/FieldCache.cs index 4e082ea..bb34675 100644 --- a/src/Lucene.Net.Core/Search/FieldCache.cs +++ b/src/Lucene.Net.Core/Search/FieldCache.cs @@ -572,7 +572,10 @@ namespace Lucene.Net.Search } } - public static readonly IInt16Parser DEFAULT_SHORT_PARSER = new AnonymousInt16Parser(); // LUCENENET TODO: Rename DEFAULT_INT16_PARSER + /// + /// NOTE: This was DEFAULT_SHORT_PARSER in Lucene + /// + public static readonly IInt16Parser DEFAULT_INT16_PARSER = new AnonymousInt16Parser(); private sealed class AnonymousInt16Parser : IInt16Parser @@ -591,7 +594,7 @@ namespace Lucene.Net.Search public override string ToString() { - return typeof(IFieldCache).FullName + ".DEFAULT_SHORT_PARSER"; // LUCENENET TODO: Rename DEFAULT_INT16_PARSER + return typeof(IFieldCache).FullName + ".DEFAULT_INT16_PARSER"; } public TermsEnum TermsEnum(Terms terms) @@ -600,7 +603,10 @@ namespace Lucene.Net.Search } } - public static readonly IInt32Parser DEFAULT_INT_PARSER = new AnonymousInt32Parser(); // LUCENENET TODO: Rename DEFAULT_INT32_PARSER + /// + /// NOTE: This was DEFAULT_INT_PARSER in Lucene + /// + public static readonly IInt32Parser DEFAULT_INT32_PARSER = new AnonymousInt32Parser(); private sealed class AnonymousInt32Parser : IInt32Parser { @@ -623,11 +629,14 @@ namespace Lucene.Net.Search public override string ToString() { - return typeof(IFieldCache).FullName + ".DEFAULT_INT_PARSER"; // LUCENENET TODO: Rename DEFAULT_INT32_PARSER + return typeof(IFieldCache).FullName + ".DEFAULT_INT32_PARSER"; } } - public static readonly ISingleParser DEFAULT_FLOAT_PARSER = new AnonymousSingleParser(); // LUCENENET TODO: Rename DEFAULT_SINGLE_PARSER + /// + /// NOTE: This was DEFAULT_FLOAT_PARSER in Lucene + /// + public static readonly ISingleParser DEFAULT_SINGLE_PARSER = new AnonymousSingleParser(); private sealed class AnonymousSingleParser : ISingleParser { @@ -654,11 +663,14 @@ namespace Lucene.Net.Search public override string ToString() { - return typeof(IFieldCache).FullName + ".DEFAULT_FLOAT_PARSER"; // LUCENENET TODO: Rename DEFAULT_SINGLE_PARSER + return typeof(IFieldCache).FullName + ".DEFAULT_SINGLE_PARSER"; } } - public static readonly IInt64Parser DEFAULT_LONG_PARSER = new AnonymousInt64Parser(); // LUCENENET TODO: Rename DEFAULT_INT64_PARSER + /// + /// NOTE: This was DEFAULT_LONG_PARSER in Lucene + /// + public static readonly IInt64Parser DEFAULT_INT64_PARSER = new AnonymousInt64Parser(); private sealed class AnonymousInt64Parser : IInt64Parser { @@ -681,7 +693,7 @@ namespace Lucene.Net.Search public override string ToString() { - return typeof(IFieldCache).FullName + ".DEFAULT_LONG_PARSER"; // LUCENENET TODO: Rename DEFAULT_INT64_PARSER + return typeof(IFieldCache).FullName + ".DEFAULT_INT64_PARSER"; } } @@ -709,7 +721,10 @@ namespace Lucene.Net.Search } } - public static readonly IInt32Parser NUMERIC_UTILS_INT_PARSER = new AnonymousNumericUtilsInt32Parser(); // LUCENENET TODO: Rename NUMERIC_UTILS_INT32_PARSER + /// + /// NOTE: This was NUMERIC_UTILS_INT_PARSER in Lucene + /// + public static readonly IInt32Parser NUMERIC_UTILS_INT32_PARSER = new AnonymousNumericUtilsInt32Parser(); private sealed class AnonymousNumericUtilsInt32Parser : IInt32Parser { @@ -728,11 +743,14 @@ namespace Lucene.Net.Search public override string ToString() { - return typeof(IFieldCache).FullName + ".NUMERIC_UTILS_INT_PARSER"; + return typeof(IFieldCache).FullName + ".NUMERIC_UTILS_INT32_PARSER"; } } - public static readonly ISingleParser NUMERIC_UTILS_FLOAT_PARSER = new AnonymousNumericUtilsSingleParser(); // LUCENENET TODO: Rename NUMERIC_UTILS_SINGLE_PARSER + /// + /// NOTE: This was NUMERIC_UTILS_FLOAT_PARSER in Lucene + /// + public static readonly ISingleParser NUMERIC_UTILS_SINGLE_PARSER = new AnonymousNumericUtilsSingleParser(); private sealed class AnonymousNumericUtilsSingleParser : ISingleParser { @@ -746,7 +764,7 @@ namespace Lucene.Net.Search public override string ToString() { - return typeof(IFieldCache).FullName + ".NUMERIC_UTILS_FLOAT_PARSER"; + return typeof(IFieldCache).FullName + ".NUMERIC_UTILS_SINGLE_PARSER"; } public TermsEnum TermsEnum(Terms terms) @@ -755,7 +773,10 @@ namespace Lucene.Net.Search } } - public static readonly IInt64Parser NUMERIC_UTILS_LONG_PARSER = new AnonymousNumericUtilsInt64Parser(); // LUCENENET TODO: Rename NUMERIC_UTILS_INT64_PARSER + /// + /// NOTE: This was NUMERIC_UTILS_LONG_PARSER in Lucene + /// + public static readonly IInt64Parser NUMERIC_UTILS_INT64_PARSER = new AnonymousNumericUtilsInt64Parser(); private sealed class AnonymousNumericUtilsInt64Parser : IInt64Parser { @@ -769,7 +790,7 @@ namespace Lucene.Net.Search public override string ToString() { - return typeof(IFieldCache).FullName + ".NUMERIC_UTILS_LONG_PARSER"; + return typeof(IFieldCache).FullName + ".NUMERIC_UTILS_INT64_PARSER"; } public TermsEnum TermsEnum(Terms terms) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Search/FieldCacheImpl.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/FieldCacheImpl.cs b/src/Lucene.Net.Core/Search/FieldCacheImpl.cs index 8891e73..d2857c0 100644 --- a/src/Lucene.Net.Core/Search/FieldCacheImpl.cs +++ b/src/Lucene.Net.Core/Search/FieldCacheImpl.cs @@ -555,8 +555,8 @@ namespace Lucene.Net.Search if (parser == null) { // Confusing: must delegate to wrapper (vs simply - // setting parser = DEFAULT_SHORT_PARSER) so cache - // key includes DEFAULT_SHORT_PARSER: + // setting parser = DEFAULT_INT16_PARSER) so cache + // key includes DEFAULT_INT16_PARSER: return wrapper.GetBytes(reader, key.field, FieldCache.DEFAULT_BYTE_PARSER, setDocsWithField); } @@ -699,9 +699,9 @@ namespace Lucene.Net.Search if (parser == null) { // Confusing: must delegate to wrapper (vs simply - // setting parser = DEFAULT_SHORT_PARSER) so cache - // key includes DEFAULT_SHORT_PARSER: - return wrapper.GetInt16s(reader, key.field, FieldCache.DEFAULT_SHORT_PARSER, setDocsWithField); + // setting parser = DEFAULT_INT16_PARSER) so cache + // key includes DEFAULT_INT16_PARSER: + return wrapper.GetInt16s(reader, key.field, FieldCache.DEFAULT_INT16_PARSER, setDocsWithField); } values = new short[maxDoc]; @@ -873,16 +873,16 @@ namespace Lucene.Net.Search { // Confusing: must delegate to wrapper (vs simply // setting parser = - // DEFAULT_INT_PARSER/NUMERIC_UTILS_INT_PARSER) so + // DEFAULT_INT32_PARSER/NUMERIC_UTILS_INT32_PARSER) so // cache key includes - // DEFAULT_INT_PARSER/NUMERIC_UTILS_INT_PARSER: + // DEFAULT_INT32_PARSER/NUMERIC_UTILS_INT32_PARSER: try { - return wrapper.GetInt32s(reader, key.field, FieldCache.DEFAULT_INT_PARSER, setDocsWithField); + return wrapper.GetInt32s(reader, key.field, FieldCache.DEFAULT_INT32_PARSER, setDocsWithField); } catch (System.FormatException) { - return wrapper.GetInt32s(reader, key.field, FieldCache.NUMERIC_UTILS_INT_PARSER, setDocsWithField); + return wrapper.GetInt32s(reader, key.field, FieldCache.NUMERIC_UTILS_INT32_PARSER, setDocsWithField); } } @@ -931,7 +931,7 @@ namespace Lucene.Net.Search { // Lazy alloc so for the numeric field case // (which will hit a System.FormatException - // when we first try the DEFAULT_INT_PARSER), + // when we first try the DEFAULT_INT32_PARSER), // we don't double-alloc: int startBitsPerValue; // Make sure than missing values (0) can be stored without resizing @@ -1144,16 +1144,16 @@ namespace Lucene.Net.Search { // Confusing: must delegate to wrapper (vs simply // setting parser = - // DEFAULT_FLOAT_PARSER/NUMERIC_UTILS_FLOAT_PARSER) so + // DEFAULT_SINGLE_PARSER/NUMERIC_UTILS_SINGLE_PARSER) so // cache key includes - // DEFAULT_FLOAT_PARSER/NUMERIC_UTILS_FLOAT_PARSER: + // DEFAULT_SINGLE_PARSER/NUMERIC_UTILS_SINGLE_PARSER: try { - return wrapper.GetSingles(reader, key.field, FieldCache.DEFAULT_FLOAT_PARSER, setDocsWithField); + return wrapper.GetSingles(reader, key.field, FieldCache.DEFAULT_SINGLE_PARSER, setDocsWithField); } catch (System.FormatException) { - return wrapper.GetSingles(reader, key.field, FieldCache.NUMERIC_UTILS_FLOAT_PARSER, setDocsWithField); + return wrapper.GetSingles(reader, key.field, FieldCache.NUMERIC_UTILS_SINGLE_PARSER, setDocsWithField); } } @@ -1202,7 +1202,7 @@ namespace Lucene.Net.Search { // Lazy alloc so for the numeric field case // (which will hit a System.FormatException - // when we first try the DEFAULT_INT_PARSER), + // when we first try the DEFAULT_INT32_PARSER), // we don't double-alloc: values = new float[reader.MaxDoc]; valuesRef.Set(values); @@ -1315,16 +1315,16 @@ namespace Lucene.Net.Search { // Confusing: must delegate to wrapper (vs simply // setting parser = - // DEFAULT_LONG_PARSER/NUMERIC_UTILS_LONG_PARSER) so + // DEFAULT_INT64_PARSER/NUMERIC_UTILS_INT64_PARSER) so // cache key includes - // DEFAULT_LONG_PARSER/NUMERIC_UTILS_LONG_PARSER: + // DEFAULT_INT64_PARSER/NUMERIC_UTILS_INT64_PARSER: try { - return wrapper.GetInt64s(reader, key.field, FieldCache.DEFAULT_LONG_PARSER, setDocsWithField); + return wrapper.GetInt64s(reader, key.field, FieldCache.DEFAULT_INT64_PARSER, setDocsWithField); } catch (System.FormatException) { - return wrapper.GetInt64s(reader, key.field, FieldCache.NUMERIC_UTILS_LONG_PARSER, setDocsWithField); + return wrapper.GetInt64s(reader, key.field, FieldCache.NUMERIC_UTILS_INT64_PARSER, setDocsWithField); } } @@ -1373,7 +1373,7 @@ namespace Lucene.Net.Search { // Lazy alloc so for the numeric field case // (which will hit a System.FormatException - // when we first try the DEFAULT_INT_PARSER), + // when we first try the DEFAULT_INT32_PARSER), // we don't double-alloc: int startBitsPerValue; // Make sure than missing values (0) can be stored without resizing @@ -1545,7 +1545,7 @@ namespace Lucene.Net.Search { // Lazy alloc so for the numeric field case // (which will hit a System.FormatException - // when we first try the DEFAULT_INT_PARSER), + // when we first try the DEFAULT_INT32_PARSER), // we don't double-alloc: values = new double[reader.MaxDoc]; valuesRef.Set(values); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Search/NumericRangeQuery.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/NumericRangeQuery.cs b/src/Lucene.Net.Core/Search/NumericRangeQuery.cs index 08a86c4..684f07d 100644 --- a/src/Lucene.Net.Core/Search/NumericRangeQuery.cs +++ b/src/Lucene.Net.Core/Search/NumericRangeQuery.cs @@ -287,11 +287,25 @@ namespace Lucene.Net.Search internal readonly bool minInclusive, maxInclusive; // used to handle float/double infinity correcty - internal static readonly long LONG_NEGATIVE_INFINITY = NumericUtils.DoubleToSortableInt64(double.NegativeInfinity); + /// + /// NOTE: This was LONG_NEGATIVE_INFINITY in Lucene + /// + internal static readonly long INT64_NEGATIVE_INFINITY = NumericUtils.DoubleToSortableInt64(double.NegativeInfinity); + + /// + /// NOTE: This was LONG_NEGATIVE_INFINITY in Lucene + /// + internal static readonly long INT64_POSITIVE_INFINITY = NumericUtils.DoubleToSortableInt64(double.PositiveInfinity); - internal static readonly long LONG_POSITIVE_INFINITY = NumericUtils.DoubleToSortableInt64(double.PositiveInfinity); - internal static readonly int INT_NEGATIVE_INFINITY = NumericUtils.SingleToSortableInt32(float.NegativeInfinity); - internal static readonly int INT_POSITIVE_INFINITY = NumericUtils.SingleToSortableInt32(float.PositiveInfinity); + /// + /// NOTE: This was INT_NEGATIVE_INFINITY in Lucene + /// + internal static readonly int INT32_NEGATIVE_INFINITY = NumericUtils.SingleToSortableInt32(float.NegativeInfinity); + + /// + /// NOTE: This was INT_POSITIVE_INFINITY in Lucene + /// + internal static readonly int INT32_POSITIVE_INFINITY = NumericUtils.SingleToSortableInt32(float.PositiveInfinity); /// /// Subclass of FilteredTermsEnum for enumerating all terms that match the @@ -318,19 +332,19 @@ namespace Lucene.Net.Search this.outerInstance = outerInstance; switch (this.outerInstance.dataType) { - case NumericType.LONG: + case NumericType.INT64: case NumericType.DOUBLE: { // lower long minBound; - if (this.outerInstance.dataType == NumericType.LONG) + if (this.outerInstance.dataType == NumericType.INT64) { minBound = (this.outerInstance.min == null) ? long.MinValue : Convert.ToInt64(this.outerInstance.min.Value); } else { Debug.Assert(this.outerInstance.dataType == NumericType.DOUBLE); - minBound = (this.outerInstance.min == null) ? LONG_NEGATIVE_INFINITY : NumericUtils.DoubleToSortableInt64(Convert.ToDouble(this.outerInstance.min.Value)); + minBound = (this.outerInstance.min == null) ? INT64_NEGATIVE_INFINITY : NumericUtils.DoubleToSortableInt64(Convert.ToDouble(this.outerInstance.min.Value)); } if (!this.outerInstance.minInclusive && this.outerInstance.min != null) { @@ -343,14 +357,14 @@ namespace Lucene.Net.Search // upper long maxBound; - if (this.outerInstance.dataType == NumericType.LONG) + if (this.outerInstance.dataType == NumericType.INT64) { maxBound = (this.outerInstance.max == null) ? long.MaxValue : Convert.ToInt64(this.outerInstance.max); } else { Debug.Assert(this.outerInstance.dataType == NumericType.DOUBLE); - maxBound = (this.outerInstance.max == null) ? LONG_POSITIVE_INFINITY : NumericUtils.DoubleToSortableInt64(Convert.ToDouble(this.outerInstance.max)); + maxBound = (this.outerInstance.max == null) ? INT64_POSITIVE_INFINITY : NumericUtils.DoubleToSortableInt64(Convert.ToDouble(this.outerInstance.max)); } if (!this.outerInstance.maxInclusive && this.outerInstance.max != null) { @@ -365,19 +379,19 @@ namespace Lucene.Net.Search break; } - case NumericType.INT: - case NumericType.FLOAT: + case NumericType.INT32: + case NumericType.SINGLE: { // lower int minBound; - if (this.outerInstance.dataType == NumericType.INT) + if (this.outerInstance.dataType == NumericType.INT32) { minBound = (this.outerInstance.min == null) ? int.MinValue : Convert.ToInt32(this.outerInstance.min); } else { - Debug.Assert(this.outerInstance.dataType == NumericType.FLOAT); - minBound = (this.outerInstance.min == null) ? INT_NEGATIVE_INFINITY : NumericUtils.SingleToSortableInt32(Convert.ToSingle(this.outerInstance.min)); + Debug.Assert(this.outerInstance.dataType == NumericType.SINGLE); + minBound = (this.outerInstance.min == null) ? INT32_NEGATIVE_INFINITY : NumericUtils.SingleToSortableInt32(Convert.ToSingle(this.outerInstance.min)); } if (!this.outerInstance.minInclusive && this.outerInstance.min != null) { @@ -390,14 +404,14 @@ namespace Lucene.Net.Search // upper int maxBound; - if (this.outerInstance.dataType == NumericType.INT) + if (this.outerInstance.dataType == NumericType.INT32) { maxBound = (this.outerInstance.max == null) ? int.MaxValue : Convert.ToInt32(this.outerInstance.max); } else { - Debug.Assert(this.outerInstance.dataType == NumericType.FLOAT); - maxBound = (this.outerInstance.max == null) ? INT_POSITIVE_INFINITY : NumericUtils.SingleToSortableInt32(Convert.ToSingle(this.outerInstance.max)); + Debug.Assert(this.outerInstance.dataType == NumericType.SINGLE); + maxBound = (this.outerInstance.max == null) ? INT32_POSITIVE_INFINITY : NumericUtils.SingleToSortableInt32(Convert.ToSingle(this.outerInstance.max)); } if (!this.outerInstance.maxInclusive && this.outerInstance.max != null) { @@ -519,7 +533,7 @@ namespace Lucene.Net.Search /// public static NumericRangeQuery NewInt64Range(string field, int precisionStep, long? min, long? max, bool minInclusive, bool maxInclusive) { - return new NumericRangeQuery(field, precisionStep, NumericType.LONG, min, max, minInclusive, maxInclusive); + return new NumericRangeQuery(field, precisionStep, NumericType.INT64, min, max, minInclusive, maxInclusive); } /// @@ -533,7 +547,7 @@ namespace Lucene.Net.Search /// public static NumericRangeQuery NewInt64Range(string field, long? min, long? max, bool minInclusive, bool maxInclusive) { - return new NumericRangeQuery(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.LONG, min, max, minInclusive, maxInclusive); + return new NumericRangeQuery(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.INT64, min, max, minInclusive, maxInclusive); } /// @@ -547,7 +561,7 @@ namespace Lucene.Net.Search /// public static NumericRangeQuery NewInt32Range(string field, int precisionStep, int? min, int? max, bool minInclusive, bool maxInclusive) { - return new NumericRangeQuery(field, precisionStep, NumericType.INT, min, max, minInclusive, maxInclusive); + return new NumericRangeQuery(field, precisionStep, NumericType.INT32, min, max, minInclusive, maxInclusive); } /// @@ -561,7 +575,7 @@ namespace Lucene.Net.Search /// public static NumericRangeQuery NewInt32Range(string field, int? min, int? max, bool minInclusive, bool maxInclusive) { - return new NumericRangeQuery(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.INT, min, max, minInclusive, maxInclusive); + return new NumericRangeQuery(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.INT32, min, max, minInclusive, maxInclusive); } /// @@ -605,7 +619,7 @@ namespace Lucene.Net.Search /// public static NumericRangeQuery NewSingleRange(string field, int precisionStep, float? min, float? max, bool minInclusive, bool maxInclusive) { - return new NumericRangeQuery(field, precisionStep, NumericType.FLOAT, min, max, minInclusive, maxInclusive); + return new NumericRangeQuery(field, precisionStep, NumericType.SINGLE, min, max, minInclusive, maxInclusive); } /// @@ -621,7 +635,7 @@ namespace Lucene.Net.Search /// public static NumericRangeQuery NewSingleRange(string field, float? min, float? max, bool minInclusive, bool maxInclusive) { - return new NumericRangeQuery(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.FLOAT, min, max, minInclusive, maxInclusive); + return new NumericRangeQuery(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.SINGLE, min, max, minInclusive, maxInclusive); } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Search/ScoringRewrite.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/ScoringRewrite.cs b/src/Lucene.Net.Core/Search/ScoringRewrite.cs index 480209d..17d7c56 100644 --- a/src/Lucene.Net.Core/Search/ScoringRewrite.cs +++ b/src/Lucene.Net.Core/Search/ScoringRewrite.cs @@ -207,7 +207,7 @@ namespace Lucene.Net.Search public override int[] Init() { int[] ord = base.Init(); - boost = new float[ArrayUtil.Oversize(ord.Length, RamUsageEstimator.NUM_BYTES_FLOAT)]; + boost = new float[ArrayUtil.Oversize(ord.Length, RamUsageEstimator.NUM_BYTES_SINGLE)]; termState = new TermContext[ArrayUtil.Oversize(ord.Length, RamUsageEstimator.NUM_BYTES_OBJECT_REF)]; Debug.Assert(termState.Length >= ord.Length && boost.Length >= ord.Length); return ord; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Search/SortField.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Search/SortField.cs b/src/Lucene.Net.Core/Search/SortField.cs index f0c9d7a..46ddb35 100644 --- a/src/Lucene.Net.Core/Search/SortField.cs +++ b/src/Lucene.Net.Core/Search/SortField.cs @@ -67,9 +67,9 @@ namespace Lucene.Net.Search } } #pragma warning disable 612, 618 - else if (type != SortFieldType.BYTE && type != SortFieldType.SHORT + else if (type != SortFieldType.BYTE && type != SortFieldType.INT16 #pragma warning restore 612, 618 - && type != SortFieldType.INT && type != SortFieldType.FLOAT && type != SortFieldType.LONG && type != SortFieldType.DOUBLE) + && type != SortFieldType.INT32 && type != SortFieldType.SINGLE && type != SortFieldType.INT64 && type != SortFieldType.DOUBLE) { throw new System.ArgumentException("Missing value only works for numeric or STRING types"); } @@ -132,16 +132,16 @@ namespace Lucene.Net.Search { if (parser is FieldCache.IInt32Parser) { - InitFieldType(field, SortFieldType.INT); + InitFieldType(field, SortFieldType.INT32); } else if (parser is FieldCache.ISingleParser) { - InitFieldType(field, SortFieldType.FLOAT); + InitFieldType(field, SortFieldType.SINGLE); } else if (parser is FieldCache.IInt16Parser) { #pragma warning disable 612, 618 - InitFieldType(field, SortFieldType.SHORT); + InitFieldType(field, SortFieldType.INT16); } else if (parser is FieldCache.IByteParser) { @@ -150,7 +150,7 @@ namespace Lucene.Net.Search } else if (parser is FieldCache.IInt64Parser) { - InitFieldType(field, SortFieldType.LONG); + InitFieldType(field, SortFieldType.INT64); } else if (parser is FieldCache.IDoubleParser) { @@ -272,7 +272,8 @@ namespace Lucene.Net.Search /// /// Returns the type of contents in the field. - /// One of the constants SCORE, DOC, STRING, INT or FLOAT. + /// One of , , + /// , or . public virtual SortFieldType Type { get @@ -342,20 +343,20 @@ namespace Lucene.Net.Search buffer.Append(""); break; - case SortFieldType.SHORT: + case SortFieldType.INT16: #pragma warning restore 612, 618 buffer.Append(""); break; - case SortFieldType.INT: + case SortFieldType.INT32: buffer.Append(""); break; - case SortFieldType.LONG: + case SortFieldType.INT64: buffer.Append(""); break; - case SortFieldType.FLOAT: + case SortFieldType.SINGLE: buffer.Append(""); break; @@ -466,13 +467,13 @@ namespace Lucene.Net.Search case SortFieldType.DOC: return new FieldComparer.DocComparer(numHits); - case SortFieldType.INT: + case SortFieldType.INT32: return new FieldComparer.Int32Comparer(numHits, field, parser, (int?)m_missingValue); - case SortFieldType.FLOAT: + case SortFieldType.SINGLE: return new FieldComparer.SingleComparer(numHits, field, parser, (float?)m_missingValue); - case SortFieldType.LONG: + case SortFieldType.INT64: return new FieldComparer.Int64Comparer(numHits, field, parser, (long?)m_missingValue); case SortFieldType.DOUBLE: @@ -482,7 +483,7 @@ namespace Lucene.Net.Search case SortFieldType.BYTE: return new FieldComparer.ByteComparer(numHits, field, parser, (sbyte?)m_missingValue); - case SortFieldType.SHORT: + case SortFieldType.INT16: return new FieldComparer.Int16Comparer(numHits, field, parser, (short?)m_missingValue); #pragma warning restore 612, 618 @@ -553,20 +554,26 @@ namespace Lucene.Net.Search /// /// Sort using term values as encoded Integers. Sort values are Integer and /// lower values are at the front. + /// + /// NOTE: This was INT in Lucene /// - INT, // LUCENENET TODO: Rename to INT32 ? + INT32, /// /// Sort using term values as encoded Floats. Sort values are Float and /// lower values are at the front. + /// + /// NOTE: This was FLOAT in Lucene /// - FLOAT, // LUCENENET TODO: Rename to SINGLE ? + SINGLE, /// /// Sort using term values as encoded Longs. Sort values are Long and /// lower values are at the front. + /// + /// NOTE: This was LONG in Lucene /// - LONG, // LUCENENET TODO: Rename to INT64 ? + INT64, /// /// Sort using term values as encoded Doubles. Sort values are Double and @@ -577,9 +584,11 @@ namespace Lucene.Net.Search /// /// Sort using term values as encoded Shorts. Sort values are Short and /// lower values are at the front. + /// + /// NOTE: This was SHORT in Lucene /// [System.Obsolete] - SHORT, // LUCENENET TODO: Rename to INT16 ? + INT16, /// /// Sort using a custom Comparer. Sort values are any Comparable and http://git-wip-us.apache.org/repos/asf/lucenenet/blob/73cb5b22/src/Lucene.Net.Core/Util/ArrayUtil.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/ArrayUtil.cs b/src/Lucene.Net.Core/Util/ArrayUtil.cs index 474bb64..9fc79e0 100644 --- a/src/Lucene.Net.Core/Util/ArrayUtil.cs +++ b/src/Lucene.Net.Core/Util/ArrayUtil.cs @@ -278,7 +278,7 @@ namespace Lucene.Net.Util Debug.Assert(minSize >= 0, "size must be positive (got " + minSize + "): likely integer overflow?"); if (array.Length < minSize) { - short[] newArray = new short[Oversize(minSize, RamUsageEstimator.NUM_BYTES_SHORT)]; + short[] newArray = new short[Oversize(minSize, RamUsageEstimator.NUM_BYTES_INT16)]; Array.Copy(array, 0, newArray, 0, array.Length); return newArray; } @@ -298,7 +298,7 @@ namespace Lucene.Net.Util Debug.Assert(minSize >= 0, "size must be positive (got " + minSize + "): likely integer overflow?"); if (array.Length < minSize) { - float[] newArray = new float[Oversize(minSize, RamUsageEstimator.NUM_BYTES_FLOAT)]; + float[] newArray = new float[Oversize(minSize, RamUsageEstimator.NUM_BYTES_SINGLE)]; Array.Copy(array, 0, newArray, 0, array.Length); return newArray; } @@ -336,7 +336,7 @@ namespace Lucene.Net.Util public static short[] Shrink(short[] array, int targetSize) { Debug.Assert(targetSize >= 0, "size must be positive (got " + targetSize + "): likely integer overflow?"); - int newSize = GetShrinkSize(array.Length, targetSize, RamUsageEstimator.NUM_BYTES_SHORT); + int newSize = GetShrinkSize(array.Length, targetSize, RamUsageEstimator.NUM_BYTES_INT16); if (newSize != array.Length) { short[] newArray = new short[newSize]; @@ -354,7 +354,7 @@ namespace Lucene.Net.Util Debug.Assert(minSize >= 0, "size must be positive (got " + minSize + "): likely integer overflow?"); if (array.Length < minSize) { - int[] newArray = new int[Oversize(minSize, RamUsageEstimator.NUM_BYTES_INT)]; + int[] newArray = new int[Oversize(minSize, RamUsageEstimator.NUM_BYTES_INT32)]; Array.Copy(array, 0, newArray, 0, array.Length); return newArray; } @@ -372,7 +372,7 @@ namespace Lucene.Net.Util public static int[] Shrink(int[] array, int targetSize) { Debug.Assert(targetSize >= 0, "size must be positive (got " + targetSize + "): likely integer overflow?"); - int newSize = GetShrinkSize(array.Length, targetSize, RamUsageEstimator.NUM_BYTES_INT); + int newSize = GetShrinkSize(array.Length, targetSize, RamUsageEstimator.NUM_BYTES_INT32); if (newSize != array.Length) { int[] newArray = new int[newSize]; @@ -390,7 +390,7 @@ namespace Lucene.Net.Util Debug.Assert(minSize >= 0, "size must be positive (got " + minSize + "): likely integer overflow?"); if (array.Length < minSize) { - long[] newArray = new long[Oversize(minSize, RamUsageEstimator.NUM_BYTES_LONG)]; + long[] newArray = new long[Oversize(minSize, RamUsageEstimator.NUM_BYTES_INT64)]; Array.Copy(array, 0, newArray, 0, array.Length); return newArray; } @@ -408,7 +408,7 @@ namespace Lucene.Net.Util public static long[] Shrink(long[] array, int targetSize) { Debug.Assert(targetSize >= 0, "size must be positive (got " + targetSize + "): likely integer overflow?"); - int newSize = GetShrinkSize(array.Length, targetSize, RamUsageEstimator.NUM_BYTES_LONG); + int newSize = GetShrinkSize(array.Length, targetSize, RamUsageEstimator.NUM_BYTES_INT64); if (newSize != array.Length) { long[] newArray = new long[newSize];