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/02/08 14:31:47 UTC
[08/53] [abbrv] lucenenet git commit: Lucene.Net.Core: Renamed all
type-derived properties and methods from Short, Int, Long,
and Float to match CLR types Int16, Int32, Int64, and Single, respectively.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Index/SegmentInfos.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SegmentInfos.cs b/src/Lucene.Net.Core/Index/SegmentInfos.cs
index 2d97137..4f5700d 100644
--- a/src/Lucene.Net.Core/Index/SegmentInfos.cs
+++ b/src/Lucene.Net.Core/Index/SegmentInfos.cs
@@ -286,9 +286,9 @@ namespace Lucene.Net.Index
IndexOutput genOutput = dir.CreateOutput(IndexFileNames.SEGMENTS_GEN, IOContext.READ_ONCE);
try
{
- genOutput.WriteInt(FORMAT_SEGMENTS_GEN_CURRENT);
- genOutput.WriteLong(generation);
- genOutput.WriteLong(generation);
+ genOutput.WriteInt32(FORMAT_SEGMENTS_GEN_CURRENT);
+ genOutput.WriteInt64(generation);
+ genOutput.WriteInt64(generation);
CodecUtil.WriteFooter(genOutput);
}
finally
@@ -353,15 +353,15 @@ namespace Lucene.Net.Index
var input = directory.OpenChecksumInput(segmentFileName, IOContext.READ);
try
{
- int format = input.ReadInt();
+ int format = input.ReadInt32();
int actualFormat;
if (format == CodecUtil.CODEC_MAGIC)
{
// 4.0+
actualFormat = CodecUtil.CheckHeaderNoMagic(input, "segments", VERSION_40, VERSION_48);
- Version = input.ReadLong();
- Counter = input.ReadInt();
- int numSegments = input.ReadInt();
+ Version = input.ReadInt64();
+ Counter = input.ReadInt32();
+ int numSegments = input.ReadInt32();
if (numSegments < 0)
{
throw new CorruptIndexException("invalid segment count: " + numSegments + " (resource: " + input + ")");
@@ -373,8 +373,8 @@ namespace Lucene.Net.Index
//System.out.println("SIS.read seg=" + seg + " codec=" + codec);
var info = codec.SegmentInfoFormat.SegmentInfoReader.Read(directory, segName, IOContext.READ);
info.Codec = codec;
- long delGen = input.ReadLong();
- int delCount = input.ReadInt();
+ long delGen = input.ReadInt64();
+ int delCount = input.ReadInt32();
if (delCount < 0 || delCount > info.DocCount)
{
throw new CorruptIndexException("invalid deletion count: " + delCount + " vs docCount=" + info.DocCount + " (resource: " + input + ")");
@@ -382,12 +382,12 @@ namespace Lucene.Net.Index
long fieldInfosGen = -1;
if (actualFormat >= VERSION_46)
{
- fieldInfosGen = input.ReadLong();
+ fieldInfosGen = input.ReadInt64();
}
var siPerCommit = new SegmentCommitInfo(info, delCount, delGen, fieldInfosGen);
if (actualFormat >= VERSION_46)
{
- int numGensUpdatesFiles = input.ReadInt();
+ int numGensUpdatesFiles = input.ReadInt32();
IDictionary<long, ISet<string>> genUpdatesFiles;
if (numGensUpdatesFiles == 0)
{
@@ -398,7 +398,7 @@ namespace Lucene.Net.Index
genUpdatesFiles = new Dictionary<long, ISet<string>>(numGensUpdatesFiles);
for (int i = 0; i < numGensUpdatesFiles; i++)
{
- genUpdatesFiles[input.ReadLong()] = input.ReadStringSet();
+ genUpdatesFiles[input.ReadInt64()] = input.ReadStringSet();
}
}
siPerCommit.SetGenUpdatesFiles(genUpdatesFiles);
@@ -425,7 +425,7 @@ namespace Lucene.Net.Index
else
{
long checksumNow = input.Checksum;
- long checksumThen = input.ReadLong();
+ long checksumThen = input.ReadInt64();
if (checksumNow != checksumThen)
{
throw new CorruptIndexException("checksum mismatch in segments file (resource: " + input + ")");
@@ -511,27 +511,27 @@ namespace Lucene.Net.Index
{
segnOutput = directory.CreateOutput(segmentsFileName, IOContext.DEFAULT);
CodecUtil.WriteHeader(segnOutput, "segments", VERSION_48);
- segnOutput.WriteLong(Version);
- segnOutput.WriteInt(Counter); // write counter
- segnOutput.WriteInt(Count); // write infos
+ segnOutput.WriteInt64(Version);
+ segnOutput.WriteInt32(Counter); // write counter
+ segnOutput.WriteInt32(Count); // write infos
foreach (SegmentCommitInfo siPerCommit in segments)
{
SegmentInfo si = siPerCommit.Info;
segnOutput.WriteString(si.Name);
segnOutput.WriteString(si.Codec.Name);
- segnOutput.WriteLong(siPerCommit.DelGen);
+ segnOutput.WriteInt64(siPerCommit.DelGen);
int delCount = siPerCommit.DelCount;
if (delCount < 0 || delCount > si.DocCount)
{
throw new InvalidOperationException("cannot write segment: invalid docCount segment=" + si.Name + " docCount=" + si.DocCount + " delCount=" + delCount);
}
- segnOutput.WriteInt(delCount);
- segnOutput.WriteLong(siPerCommit.FieldInfosGen);
+ segnOutput.WriteInt32(delCount);
+ segnOutput.WriteInt64(siPerCommit.FieldInfosGen);
IDictionary<long, ISet<string>> genUpdatesFiles = siPerCommit.UpdatesFiles;
- segnOutput.WriteInt(genUpdatesFiles.Count);
+ segnOutput.WriteInt32(genUpdatesFiles.Count);
foreach (KeyValuePair<long, ISet<string>> e in genUpdatesFiles)
{
- segnOutput.WriteLong(e.Key);
+ segnOutput.WriteInt64(e.Key);
segnOutput.WriteStringSet(e.Value);
}
Debug.Assert(si.Dir == directory);
@@ -659,7 +659,7 @@ namespace Lucene.Net.Index
CodecUtil.WriteHeader(output, Lucene3xSegmentInfoFormat.UPGRADED_SI_CODEC_NAME, Lucene3xSegmentInfoFormat.UPGRADED_SI_VERSION_CURRENT);
// Write the Lucene version that created this segment, since 3.1
output.WriteString(si.Version);
- output.WriteInt(si.DocCount);
+ output.WriteInt32(si.DocCount);
output.WriteStringStringMap(si.Attributes);
@@ -915,11 +915,11 @@ namespace Lucene.Net.Index
{
try
{
- int version = genInput.ReadInt();
+ int version = genInput.ReadInt32();
if (version == FORMAT_SEGMENTS_GEN_47 || version == FORMAT_SEGMENTS_GEN_CHECKSUM)
{
- long gen0 = genInput.ReadLong();
- long gen1 = genInput.ReadLong();
+ long gen0 = genInput.ReadInt64();
+ long gen1 = genInput.ReadInt64();
if (infoStream != null)
{
Message("fallback check: " + gen0 + "; " + gen1);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 1fc4d59..bec57fb 100644
--- a/src/Lucene.Net.Core/Index/TermVectorsConsumerPerField.cs
+++ b/src/Lucene.Net.Core/Index/TermVectorsConsumerPerField.cs
@@ -261,8 +261,8 @@ namespace Lucene.Net.Index
int startOffset = fieldState.Offset + offsetAttribute.StartOffset;
int endOffset = fieldState.Offset + offsetAttribute.EndOffset;
- termsHashPerField.WriteVInt(1, startOffset - postings.lastOffsets[termID]);
- termsHashPerField.WriteVInt(1, endOffset - startOffset);
+ termsHashPerField.WriteVInt32(1, startOffset - postings.lastOffsets[termID]);
+ termsHashPerField.WriteVInt32(1, endOffset - startOffset);
postings.lastOffsets[termID] = endOffset;
}
@@ -281,14 +281,14 @@ namespace Lucene.Net.Index
int pos = fieldState.Position - postings.lastPositions[termID];
if (payload != null && payload.Length > 0)
{
- termsHashPerField.WriteVInt(0, (pos << 1) | 1);
- termsHashPerField.WriteVInt(0, payload.Length);
+ termsHashPerField.WriteVInt32(0, (pos << 1) | 1);
+ termsHashPerField.WriteVInt32(0, payload.Length);
termsHashPerField.WriteBytes(0, payload.Bytes, payload.Offset, payload.Length);
hasPayloads = true;
}
else
{
- termsHashPerField.WriteVInt(0, pos << 1);
+ termsHashPerField.WriteVInt32(0, pos << 1);
}
postings.lastPositions[termID] = fieldState.Position;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 997e64c..3b451f6 100644
--- a/src/Lucene.Net.Core/Index/TermsHashPerField.cs
+++ b/src/Lucene.Net.Core/Index/TermsHashPerField.cs
@@ -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.IntUpto > IntBlockPool.INT_BLOCK_SIZE)
+ if (numPostingInt + intPool.Int32Upto > IntBlockPool.INT_BLOCK_SIZE)
{
intPool.NextBuffer();
}
@@ -171,10 +171,10 @@ namespace Lucene.Net.Index
}
intUptos = intPool.Buffer;
- intUptoStart = intPool.IntUpto;
- intPool.IntUpto += streamCount;
+ intUptoStart = intPool.Int32Upto;
+ intPool.Int32Upto += streamCount;
- postingsArray.intStarts[termID] = intUptoStart + intPool.IntOffset;
+ postingsArray.intStarts[termID] = intUptoStart + intPool.Int32Offset;
for (int i = 0; i < streamCount; i++)
{
@@ -235,7 +235,7 @@ namespace Lucene.Net.Index
{
bytesHash.ByteStart(termID);
// Init stream slices
- if (numPostingInt + intPool.IntUpto > IntBlockPool.INT_BLOCK_SIZE)
+ if (numPostingInt + intPool.Int32Upto > IntBlockPool.INT_BLOCK_SIZE)
{
intPool.NextBuffer();
}
@@ -246,10 +246,10 @@ namespace Lucene.Net.Index
}
intUptos = intPool.Buffer;
- intUptoStart = intPool.IntUpto;
- intPool.IntUpto += streamCount;
+ intUptoStart = intPool.Int32Upto;
+ intPool.Int32Upto += streamCount;
- postingsArray.intStarts[termID] = intUptoStart + intPool.IntOffset;
+ postingsArray.intStarts[termID] = intUptoStart + intPool.Int32Offset;
for (int i = 0; i < streamCount; i++)
{
@@ -310,7 +310,10 @@ namespace Lucene.Net.Index
}
}
- internal void WriteVInt(int stream, int i)
+ /// <summary>
+ /// NOTE: This was writeVInt() in Lucene
+ /// </summary>
+ internal void WriteVInt32(int stream, int i)
{
Debug.Assert(stream < streamCount);
while ((i & ~0x7F) != 0)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/BooleanQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/BooleanQuery.cs b/src/Lucene.Net.Core/Search/BooleanQuery.cs
index 2a5d6a2..7debdff 100644
--- a/src/Lucene.Net.Core/Search/BooleanQuery.cs
+++ b/src/Lucene.Net.Core/Search/BooleanQuery.cs
@@ -675,7 +675,7 @@ namespace Lucene.Net.Search
/// Returns a hash code value for this object. </summary>
public override int GetHashCode()
{
- return Number.FloatToIntBits(Boost) ^ (clauses.Count == 0 ? 0 : HashHelpers.CombineHashCodes(clauses.First().GetHashCode(), clauses.Last().GetHashCode(), clauses.Count)) + MinimumNumberShouldMatch + (disableCoord ? 17 : 0);
+ return Number.SingleToInt32Bits(Boost) ^ (clauses.Count == 0 ? 0 : HashHelpers.CombineHashCodes(clauses.First().GetHashCode(), clauses.Last().GetHashCode(), clauses.Count)) + MinimumNumberShouldMatch + (disableCoord ? 17 : 0);
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/DisjunctionMaxQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/DisjunctionMaxQuery.cs b/src/Lucene.Net.Core/Search/DisjunctionMaxQuery.cs
index 8b27c55..69da69e 100644
--- a/src/Lucene.Net.Core/Search/DisjunctionMaxQuery.cs
+++ b/src/Lucene.Net.Core/Search/DisjunctionMaxQuery.cs
@@ -363,8 +363,8 @@ namespace Lucene.Net.Search
/// <returns> the hash code </returns>
public override int GetHashCode()
{
- return Number.FloatToIntBits(Boost)
- + Number.FloatToIntBits(tieBreakerMultiplier)
+ return Number.SingleToInt32Bits(Boost)
+ + Number.SingleToInt32Bits(tieBreakerMultiplier)
+ disjuncts.GetHashCode();
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 d4c36d5..ea165c9 100644
--- a/src/Lucene.Net.Core/Search/FieldCache.cs
+++ b/src/Lucene.Net.Core/Search/FieldCache.cs
@@ -86,7 +86,10 @@ namespace Lucene.Net.Search
/// Checks the internal cache for an appropriate entry, and if none is
/// found, reads the terms in <code>field</code> as shorts and returns an array
/// of size <code>reader.maxDoc()</code> of the value each document
- /// has in the given field. </summary>
+ /// has in the given field.
+ /// <para/>
+ /// NOTE: this was getShorts() in Lucene
+ /// </summary>
/// <param name="reader"> Used to get field values. </param>
/// <param name="field"> Which field contains the shorts. </param>
/// <param name="setDocsWithField"> If true then <seealso cref="#getDocsWithField"/> will
@@ -94,14 +97,17 @@ namespace Lucene.Net.Search
/// <returns> The values in the given field for each document. </returns>
/// <exception cref="IOException"> If any error occurs. </exception>
/// @deprecated (4.4) Index as a numeric field using <seealso cref="IntField"/> and then use <seealso cref="#getInts(AtomicReader, String, boolean)"/> instead.
- [Obsolete("(4.4) Index as a numeric field using IntField and then use GetInt32s(AtomicReader, string, bool) instead.")]
- FieldCache.Shorts GetShorts(AtomicReader reader, string field, bool setDocsWithField);
+ [Obsolete("(4.4) Index as a numeric field using Int32Field and then use GetInt32s(AtomicReader, string, bool) instead.")]
+ FieldCache.Shorts GetInt16s(AtomicReader reader, string field, bool setDocsWithField);
/// <summary>
/// Checks the internal cache for an appropriate entry, and if none is found,
/// reads the terms in <code>field</code> as shorts and returns an array of
/// size <code>reader.maxDoc()</code> of the value each document has in the
- /// given field. </summary>
+ /// given field.
+ /// <para/>
+ /// NOTE: this was getShorts() in Lucene
+ /// </summary>
/// <param name="reader"> Used to get field values. </param>
/// <param name="field"> Which field contains the shorts. </param>
/// <param name="parser"> Computes short for string values. </param>
@@ -110,15 +116,17 @@ namespace Lucene.Net.Search
/// <returns> The values in the given field for each document. </returns>
/// <exception cref="IOException"> If any error occurs. </exception>
/// @deprecated (4.4) Index as a numeric field using <seealso cref="IntField"/> and then use <seealso cref="#getInts(AtomicReader, String, boolean)"/> instead.
- [Obsolete("(4.4) Index as a numeric field using IntField and then use GetInt32s(AtomicReader, string, bool) instead.")]
- FieldCache.Shorts GetShorts(AtomicReader reader, string field, FieldCache.IShortParser parser, bool setDocsWithField); // LUCENENET TODO: Rename GetInt16s
+ [Obsolete("(4.4) Index as a numeric field using Int32Field and then use GetInt32s(AtomicReader, string, bool) instead.")]
+ FieldCache.Shorts GetInt16s(AtomicReader reader, string field, FieldCache.IShortParser parser, bool setDocsWithField);
/// <summary>
/// Returns an <seealso cref="FieldCache.Ints"/> over the values found in documents in the given
/// field.
+ /// <para/>
+ /// NOTE: this was getInts() in Lucene
/// </summary>
/// <seealso cref= #getInts(AtomicReader, String, IntParser, boolean) </seealso>
- FieldCache.Ints GetInts(AtomicReader reader, string field, bool setDocsWithField); // LUCENENET TODO: Rename GetInt32s
+ FieldCache.Ints GetInt32s(AtomicReader reader, string field, bool setDocsWithField);
/// <summary>
/// Returns an <seealso cref="FieldCache.Ints"/> over the values found in documents in the given
@@ -128,6 +136,8 @@ namespace Lucene.Net.Search
/// none is found, reads the terms in <code>field</code> as ints and returns
/// an array of size <code>reader.maxDoc()</code> of the value each document
/// has in the given field.
+ /// <para/>
+ /// NOTE: this was getInts() in Lucene
/// </summary>
/// <param name="reader">
/// Used to get field values. </param>
@@ -143,14 +153,16 @@ namespace Lucene.Net.Search
/// <returns> The values in the given field for each document. </returns>
/// <exception cref="IOException">
/// If any error occurs. </exception>
- FieldCache.Ints GetInts(AtomicReader reader, string field, FieldCache.IIntParser parser, bool setDocsWithField); // LUCENENET TODO: Rename GetInt32s
+ FieldCache.Ints GetInt32s(AtomicReader reader, string field, FieldCache.IIntParser parser, bool setDocsWithField);
/// <summary>
/// Returns a <seealso cref="Floats"/> over the values found in documents in the given
/// field.
+ /// <para/>
+ /// NOTE: this was getFloats() in Lucene
/// </summary>
/// <seealso cref= #getFloats(AtomicReader, String, FloatParser, boolean) </seealso>
- FieldCache.Floats GetFloats(AtomicReader reader, string field, bool setDocsWithField); // LUCENENET TODO: Rename GetSingles
+ FieldCache.Floats GetSingles(AtomicReader reader, string field, bool setDocsWithField);
/// <summary>
/// Returns a <seealso cref="Floats"/> over the values found in documents in the given
@@ -160,6 +172,8 @@ namespace Lucene.Net.Search
/// none is found, reads the terms in <code>field</code> as floats and returns
/// an array of size <code>reader.maxDoc()</code> of the value each document
/// has in the given field.
+ /// <para/>
+ /// NOTE: this was getFloats() in Lucene
/// </summary>
/// <param name="reader">
/// Used to get field values. </param>
@@ -175,14 +189,16 @@ namespace Lucene.Net.Search
/// <returns> The values in the given field for each document. </returns>
/// <exception cref="IOException">
/// If any error occurs. </exception>
- FieldCache.Floats GetFloats(AtomicReader reader, string field, FieldCache.IFloatParser parser, bool setDocsWithField); // LUCENENET TODO: Rename GetSingles
+ FieldCache.Floats GetSingles(AtomicReader reader, string field, FieldCache.IFloatParser parser, bool setDocsWithField);
/// <summary>
/// Returns a <seealso cref="Longs"/> over the values found in documents in the given
/// field.
+ /// <para/>
+ /// NOTE: this was getLongs() in Lucene
/// </summary>
/// <seealso cref= #getLongs(AtomicReader, String, LongParser, boolean) </seealso>
- FieldCache.Longs GetLongs(AtomicReader reader, string field, bool setDocsWithField); // LUCENENET TODO: Rename GetInt64s
+ FieldCache.Longs GetInt64s(AtomicReader reader, string field, bool setDocsWithField);
/// <summary>
/// Returns a <seealso cref="Longs"/> over the values found in documents in the given
@@ -192,6 +208,8 @@ namespace Lucene.Net.Search
/// none is found, reads the terms in <code>field</code> as longs and returns
/// an array of size <code>reader.maxDoc()</code> of the value each document
/// has in the given field.
+ /// <para/>
+ /// NOTE: this was getLongs() in Lucene
/// </summary>
/// <param name="reader">
/// Used to get field values. </param>
@@ -207,7 +225,7 @@ namespace Lucene.Net.Search
/// <returns> The values in the given field for each document. </returns>
/// <exception cref="IOException">
/// If any error occurs. </exception>
- FieldCache.Longs GetLongs(AtomicReader reader, string field, FieldCache.ILongParser parser, bool setDocsWithField); // LUCENENET TODO: Rename GetInt64s
+ FieldCache.Longs GetInt64s(AtomicReader reader, string field, FieldCache.ILongParser parser, bool setDocsWithField);
/// <summary>
/// Returns a <seealso cref="Doubles"/> over the values found in documents in the given
@@ -348,7 +366,7 @@ namespace Lucene.Net.Search
// LUCENENET TODO: Copy documentation from Lucene
- public static class FieldCache
+ public static class FieldCache // LUCENENET TODO: Make this a partial class, so we can use the name FieldCache instead of FieldCacheImpl for the rest
{
public abstract class Bytes
{
@@ -365,13 +383,13 @@ namespace Lucene.Net.Search
}
}
- public abstract class Shorts
+ public abstract class Shorts // LUCENENET TODO: Rename Int16s
{
public abstract short Get(int docID);
public static readonly Shorts EMPTY = new EmptyShorts();
- public sealed class EmptyShorts : Shorts
+ public sealed class EmptyShorts : Shorts // LUCENENET TODO: Rename EmptyInt16s
{
public override short Get(int docID)
{
@@ -380,13 +398,13 @@ namespace Lucene.Net.Search
}
}
- public abstract class Ints
+ public abstract class Ints // LUCENENET TODO: Rename Int32s
{
public abstract int Get(int docID);
public static readonly Ints EMPTY = new EmptyInts();
- public sealed class EmptyInts : Ints
+ public sealed class EmptyInts : Ints // LUCENENET TODO: Rename EmptyInt32s
{
public override int Get(int docID)
{
@@ -395,13 +413,13 @@ namespace Lucene.Net.Search
}
}
- public abstract class Longs
+ public abstract class Longs // LUCENENET TODO: Rename Int64s
{
public abstract long Get(int docID);
public static readonly Longs EMPTY = new EmptyLongs();
- public sealed class EmptyLongs : Longs
+ public sealed class EmptyLongs : Longs // LUCENENET TODO: Rename EmptyInt64s
{
public override long Get(int docID)
{
@@ -410,13 +428,13 @@ namespace Lucene.Net.Search
}
}
- public abstract class Floats
+ public abstract class Floats // LUCENENET TODO: Rename Singles
{
public abstract float Get(int docID);
public static readonly Floats EMPTY = new EmptyFloats();
- public sealed class EmptyFloats : Floats
+ public sealed class EmptyFloats : Floats // LUCENENET TODO: Rename EmptySingles
{
public override float Get(int docID)
{
@@ -455,24 +473,36 @@ namespace Lucene.Net.Search
sbyte ParseByte(BytesRef term); // LUCENENET TODO: can this be byte?
}
- public interface IShortParser : IParser
+ public interface IShortParser : IParser // LUCENENET TODO: Rename IInt16Parser
{
- short ParseShort(BytesRef term); // LUCENENET TODO: Rename ParseInt16
+ /// <summary>
+ /// NOTE: This was parseShort() in Lucene
+ /// </summary>
+ short ParseInt16(BytesRef term);
}
- public interface IIntParser : IParser
+ public interface IIntParser : IParser // LUCENENET TODO: Rename IInt32Parser
{
- int ParseInt(BytesRef term); // LUCENENET TODO: Rename ParseInt32
+ /// <summary>
+ /// NOTE: This was parseInt() in Lucene
+ /// </summary>
+ int ParseInt32(BytesRef term);
}
- public interface IFloatParser : IParser
+ public interface IFloatParser : IParser // LUCENENET TODO: Rename ISingleParser
{
- float ParseFloat(BytesRef term); // LUCENENET TODO: Rename ParseSingle
+ /// <summary>
+ /// NOTE: This was parseFloat() in Lucene
+ /// </summary>
+ float ParseSingle(BytesRef term);
}
- public interface ILongParser : IParser
+ public interface ILongParser : IParser // LUCENENET TODO: Rename IInt64Parser
{
- long ParseLong(BytesRef term); // LUCENENET TODO: Rename ParseInt64
+ /// <summary>
+ /// NOTE: This was parseLong() in Lucene
+ /// </summary>
+ long ParseInt64(BytesRef term);
}
public interface IDoubleParser : IParser
@@ -506,11 +536,14 @@ namespace Lucene.Net.Search
}
}
- public static readonly IShortParser DEFAULT_SHORT_PARSER = new AnonymousShortParser();
+ public static readonly IShortParser DEFAULT_SHORT_PARSER = new AnonymousShortParser(); // LUCENENET TODO: Rename DEFAULT_INT16_PARSER
private sealed class AnonymousShortParser : IShortParser
{
- public short ParseShort(BytesRef term)
+ /// <summary>
+ /// NOTE: This was parseShort() in Lucene
+ /// </summary>
+ public short ParseInt16(BytesRef term)
{
// TODO: would be far better to directly parse from
// UTF8 bytes... but really users should use
@@ -521,7 +554,7 @@ namespace Lucene.Net.Search
public override string ToString()
{
- return typeof(IFieldCache).FullName + ".DEFAULT_SHORT_PARSER";
+ return typeof(IFieldCache).FullName + ".DEFAULT_SHORT_PARSER"; // LUCENENET TODO: Rename DEFAULT_INT16_PARSER
}
public TermsEnum TermsEnum(Terms terms)
@@ -530,11 +563,14 @@ namespace Lucene.Net.Search
}
}
- public static readonly IIntParser DEFAULT_INT_PARSER = new AnonymousIntParser();
+ public static readonly IIntParser DEFAULT_INT_PARSER = new AnonymousIntParser(); // LUCENENET TODO: Rename DEFAULT_INT32_PARSER
private sealed class AnonymousIntParser : IIntParser
{
- public int ParseInt(BytesRef term)
+ /// <summary>
+ /// NOTE: This was parseInt() in Lucene
+ /// </summary>
+ public int ParseInt32(BytesRef term)
{
// TODO: would be far better to directly parse from
// UTF8 bytes... but really users should use
@@ -550,15 +586,18 @@ namespace Lucene.Net.Search
public override string ToString()
{
- return typeof(IFieldCache).FullName + ".DEFAULT_INT_PARSER";
+ return typeof(IFieldCache).FullName + ".DEFAULT_INT_PARSER"; // LUCENENET TODO: Rename DEFAULT_INT32_PARSER
}
}
- public static readonly IFloatParser DEFAULT_FLOAT_PARSER = new AnonymousFloatParser();
+ public static readonly IFloatParser DEFAULT_FLOAT_PARSER = new AnonymousFloatParser(); // LUCENENET TODO: Rename DEFAULT_SINGLE_PARSER
private sealed class AnonymousFloatParser : IFloatParser
{
- public float ParseFloat(BytesRef term)
+ /// <summary>
+ /// NOTE: This was parseFloat() in Lucene
+ /// </summary>
+ public float ParseSingle(BytesRef term)
{
// TODO: would be far better to directly parse from
// UTF8 bytes... but really users should use
@@ -578,15 +617,18 @@ namespace Lucene.Net.Search
public override string ToString()
{
- return typeof(IFieldCache).FullName + ".DEFAULT_FLOAT_PARSER";
+ return typeof(IFieldCache).FullName + ".DEFAULT_FLOAT_PARSER"; // LUCENENET TODO: Rename DEFAULT_SINGLE_PARSER
}
}
- public static readonly ILongParser DEFAULT_LONG_PARSER = new AnonymousLongParser();
+ public static readonly ILongParser DEFAULT_LONG_PARSER = new AnonymousLongParser(); // LUCENENET TODO: Rename DEFAULT_INT64_PARSER
private sealed class AnonymousLongParser : ILongParser
{
- public long ParseLong(BytesRef term)
+ /// <summary>
+ /// NOTE: This was parseLong() in Lucene
+ /// </summary>
+ public long ParseInt64(BytesRef term)
{
// TODO: would be far better to directly parse from
// UTF8 bytes... but really users should use
@@ -602,7 +644,7 @@ namespace Lucene.Net.Search
public override string ToString()
{
- return typeof(IFieldCache).FullName + ".DEFAULT_LONG_PARSER";
+ return typeof(IFieldCache).FullName + ".DEFAULT_LONG_PARSER"; // LUCENENET TODO: Rename DEFAULT_INT64_PARSER
}
}
@@ -634,14 +676,17 @@ namespace Lucene.Net.Search
private sealed class AnonymousNumericUtilsIntParser : IIntParser
{
- public int ParseInt(BytesRef term)
+ /// <summary>
+ /// NOTE: This was parseInt() in Lucene
+ /// </summary>
+ public int ParseInt32(BytesRef term)
{
- return NumericUtils.PrefixCodedToInt(term);
+ return NumericUtils.PrefixCodedToInt32(term);
}
public TermsEnum TermsEnum(Terms terms)
{
- return NumericUtils.FilterPrefixCodedInts(terms.GetIterator(null));
+ return NumericUtils.FilterPrefixCodedInt32s(terms.GetIterator(null));
}
public override string ToString()
@@ -654,9 +699,12 @@ namespace Lucene.Net.Search
private sealed class AnonymousNumericUtilsFloatParser : IFloatParser
{
- public float ParseFloat(BytesRef term)
+ /// <summary>
+ /// NOTE: This was parseFloat() in Lucene
+ /// </summary>
+ public float ParseSingle(BytesRef term)
{
- return NumericUtils.SortableIntToFloat(NumericUtils.PrefixCodedToInt(term));
+ return NumericUtils.SortableInt32ToSingle(NumericUtils.PrefixCodedToInt32(term));
}
public override string ToString()
@@ -666,7 +714,7 @@ namespace Lucene.Net.Search
public TermsEnum TermsEnum(Terms terms)
{
- return NumericUtils.FilterPrefixCodedInts(terms.GetIterator(null));
+ return NumericUtils.FilterPrefixCodedInt32s(terms.GetIterator(null));
}
}
@@ -674,9 +722,12 @@ namespace Lucene.Net.Search
private sealed class AnonymousNumericUtilsLongParser : ILongParser
{
- public long ParseLong(BytesRef term)
+ /// <summary>
+ /// NOTE: This was parseLong() in Lucene
+ /// </summary>
+ public long ParseInt64(BytesRef term)
{
- return NumericUtils.PrefixCodedToLong(term);
+ return NumericUtils.PrefixCodedToInt64(term);
}
public override string ToString()
@@ -686,7 +737,7 @@ namespace Lucene.Net.Search
public TermsEnum TermsEnum(Terms terms)
{
- return NumericUtils.FilterPrefixCodedLongs(terms.GetIterator(null));
+ return NumericUtils.FilterPrefixCodedInt64s(terms.GetIterator(null));
}
}
@@ -696,7 +747,7 @@ namespace Lucene.Net.Search
{
public double ParseDouble(BytesRef term)
{
- return NumericUtils.SortableLongToDouble(NumericUtils.PrefixCodedToLong(term));
+ return NumericUtils.SortableInt64ToDouble(NumericUtils.PrefixCodedToInt64(term));
}
public override string ToString()
@@ -706,7 +757,7 @@ namespace Lucene.Net.Search
public TermsEnum TermsEnum(Terms terms)
{
- return NumericUtils.FilterPrefixCodedLongs(terms.GetIterator(null));
+ return NumericUtils.FilterPrefixCodedInt64s(terms.GetIterator(null));
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 455836d..e1e7c21 100644
--- a/src/Lucene.Net.Core/Search/FieldCacheImpl.cs
+++ b/src/Lucene.Net.Core/Search/FieldCacheImpl.cs
@@ -605,13 +605,19 @@ namespace Lucene.Net.Search
}
// inherit javadocs
- public virtual FieldCache.Shorts GetShorts(AtomicReader reader, string field, bool setDocsWithField)
+ /// <summary>
+ /// NOTE: this was getShorts() in Lucene
+ /// </summary>
+ public virtual FieldCache.Shorts GetInt16s(AtomicReader reader, string field, bool setDocsWithField)
{
- return GetShorts(reader, field, null, setDocsWithField);
+ return GetInt16s(reader, field, null, setDocsWithField);
}
// inherit javadocs
- public virtual FieldCache.Shorts GetShorts(AtomicReader reader, string field, FieldCache.IShortParser parser, bool setDocsWithField)
+ /// <summary>
+ /// NOTE: this was getShorts() in Lucene
+ /// </summary>
+ public virtual FieldCache.Shorts GetInt16s(AtomicReader reader, string field, FieldCache.IShortParser parser, bool setDocsWithField)
{
NumericDocValues valuesIn = reader.GetNumericDocValues(field);
if (valuesIn != null)
@@ -689,7 +695,7 @@ namespace Lucene.Net.Search
// Confusing: must delegate to wrapper (vs simply
// setting parser = DEFAULT_SHORT_PARSER) so cache
// key includes DEFAULT_SHORT_PARSER:
- return wrapper.GetShorts(reader, key.field, FieldCache.DEFAULT_SHORT_PARSER, setDocsWithField);
+ return wrapper.GetInt16s(reader, key.field, FieldCache.DEFAULT_SHORT_PARSER, setDocsWithField);
}
values = new short[maxDoc];
@@ -722,7 +728,7 @@ namespace Lucene.Net.Search
protected override void VisitTerm(BytesRef term)
{
- currentValue = parser.ParseShort(term);
+ currentValue = parser.ParseInt16(term);
}
protected override void VisitDoc(int docID)
@@ -738,12 +744,18 @@ namespace Lucene.Net.Search
}
// inherit javadocs
- public virtual FieldCache.Ints GetInts(AtomicReader reader, string field, bool setDocsWithField)
+ /// <summary>
+ /// NOTE: this was getInts() in Lucene
+ /// </summary>
+ public virtual FieldCache.Ints GetInt32s(AtomicReader reader, string field, bool setDocsWithField)
{
- return GetInts(reader, field, null, setDocsWithField);
+ return GetInt32s(reader, field, null, setDocsWithField);
}
- public virtual FieldCache.Ints GetInts(AtomicReader reader, string field, FieldCache.IIntParser parser, bool setDocsWithField)
+ /// <summary>
+ /// NOTE: this was getInts() in Lucene
+ /// </summary>
+ public virtual FieldCache.Ints GetInt32s(AtomicReader reader, string field, FieldCache.IIntParser parser, bool setDocsWithField)
{
NumericDocValues valuesIn = reader.GetNumericDocValues(field);
if (valuesIn != null)
@@ -854,11 +866,11 @@ namespace Lucene.Net.Search
// DEFAULT_INT_PARSER/NUMERIC_UTILS_INT_PARSER:
try
{
- return wrapper.GetInts(reader, key.field, FieldCache.DEFAULT_INT_PARSER, setDocsWithField);
+ return wrapper.GetInt32s(reader, key.field, FieldCache.DEFAULT_INT_PARSER, setDocsWithField);
}
catch (System.FormatException)
{
- return wrapper.GetInts(reader, key.field, FieldCache.NUMERIC_UTILS_INT_PARSER, setDocsWithField);
+ return wrapper.GetInt32s(reader, key.field, FieldCache.NUMERIC_UTILS_INT_PARSER, setDocsWithField);
}
}
@@ -902,7 +914,7 @@ namespace Lucene.Net.Search
protected override void VisitTerm(BytesRef term)
{
- currentValue = parser.ParseInt(term);
+ currentValue = parser.ParseInt32(term);
if (values == null)
{
// Lazy alloc so for the numeric field case
@@ -1028,12 +1040,18 @@ namespace Lucene.Net.Search
}
}
- public virtual FieldCache.Floats GetFloats(AtomicReader reader, string field, bool setDocsWithField)
+ /// <summary>
+ /// NOTE: this was getFloats() in Lucene
+ /// </summary>
+ public virtual FieldCache.Floats GetSingles(AtomicReader reader, string field, bool setDocsWithField)
{
- return GetFloats(reader, field, null, setDocsWithField);
+ return GetSingles(reader, field, null, setDocsWithField);
}
- public virtual FieldCache.Floats GetFloats(AtomicReader reader, string field, FieldCache.IFloatParser parser, bool setDocsWithField)
+ /// <summary>
+ /// NOTE: this was getFloats() in Lucene
+ /// </summary>
+ public virtual FieldCache.Floats GetSingles(AtomicReader reader, string field, FieldCache.IFloatParser parser, bool setDocsWithField)
{
NumericDocValues valuesIn = reader.GetNumericDocValues(field);
if (valuesIn != null)
@@ -1075,7 +1093,7 @@ namespace Lucene.Net.Search
public override float Get(int docID)
{
- return Number.IntBitsToFloat((int)valuesIn.Get(docID));
+ return Number.Int32BitsToSingle((int)valuesIn.Get(docID));
}
}
@@ -1113,11 +1131,11 @@ namespace Lucene.Net.Search
// DEFAULT_FLOAT_PARSER/NUMERIC_UTILS_FLOAT_PARSER:
try
{
- return wrapper.GetFloats(reader, key.field, FieldCache.DEFAULT_FLOAT_PARSER, setDocsWithField);
+ return wrapper.GetSingles(reader, key.field, FieldCache.DEFAULT_FLOAT_PARSER, setDocsWithField);
}
catch (System.FormatException)
{
- return wrapper.GetFloats(reader, key.field, FieldCache.NUMERIC_UTILS_FLOAT_PARSER, setDocsWithField);
+ return wrapper.GetSingles(reader, key.field, FieldCache.NUMERIC_UTILS_FLOAT_PARSER, setDocsWithField);
}
}
@@ -1161,7 +1179,7 @@ namespace Lucene.Net.Search
protected override void VisitTerm(BytesRef term)
{
- currentValue = parser.ParseFloat(term);
+ currentValue = parser.ParseSingle(term);
if (values == null)
{
// Lazy alloc so for the numeric field case
@@ -1185,12 +1203,18 @@ namespace Lucene.Net.Search
}
}
- public virtual FieldCache.Longs GetLongs(AtomicReader reader, string field, bool setDocsWithField)
+ /// <summary>
+ /// NOTE: this was getLongs() in Lucene
+ /// </summary>
+ public virtual FieldCache.Longs GetInt64s(AtomicReader reader, string field, bool setDocsWithField)
{
- return GetLongs(reader, field, null, setDocsWithField);
+ return GetInt64s(reader, field, null, setDocsWithField);
}
- public virtual FieldCache.Longs GetLongs(AtomicReader reader, string field, FieldCache.ILongParser parser, bool setDocsWithField)
+ /// <summary>
+ /// NOTE: this was getLongs() in Lucene
+ /// </summary>
+ public virtual FieldCache.Longs GetInt64s(AtomicReader reader, string field, FieldCache.ILongParser parser, bool setDocsWithField)
{
NumericDocValues valuesIn = reader.GetNumericDocValues(field);
if (valuesIn != null)
@@ -1272,11 +1296,11 @@ namespace Lucene.Net.Search
// DEFAULT_LONG_PARSER/NUMERIC_UTILS_LONG_PARSER:
try
{
- return wrapper.GetLongs(reader, key.field, FieldCache.DEFAULT_LONG_PARSER, setDocsWithField);
+ return wrapper.GetInt64s(reader, key.field, FieldCache.DEFAULT_LONG_PARSER, setDocsWithField);
}
catch (System.FormatException)
{
- return wrapper.GetLongs(reader, key.field, FieldCache.NUMERIC_UTILS_LONG_PARSER, setDocsWithField);
+ return wrapper.GetInt64s(reader, key.field, FieldCache.NUMERIC_UTILS_LONG_PARSER, setDocsWithField);
}
}
@@ -1320,7 +1344,7 @@ namespace Lucene.Net.Search
protected override void VisitTerm(BytesRef term)
{
- currentValue = parser.ParseLong(term);
+ currentValue = parser.ParseInt64(term);
if (values == null)
{
// Lazy alloc so for the numeric field case
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs b/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs
index 404f226..b48805e 100644
--- a/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs
+++ b/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs
@@ -371,7 +371,7 @@ namespace Lucene.Net.Search
return null;
#pragma warning disable 612, 618
- FieldCache.Shorts values = FieldCache.DEFAULT.GetShorts(context.AtomicReader, field, (FieldCache.IShortParser)parser, false);
+ FieldCache.Shorts values = FieldCache.DEFAULT.GetInt16s(context.AtomicReader, field, (FieldCache.IShortParser)parser, false);
#pragma warning restore 612, 618
// we only request the usage of termDocs, if the range contains 0
@@ -440,7 +440,7 @@ namespace Lucene.Net.Search
if (inclusiveLowerPoint > inclusiveUpperPoint)
return null;
- FieldCache.Ints values = FieldCache.DEFAULT.GetInts(context.AtomicReader, field, (FieldCache.IIntParser)parser, false);
+ FieldCache.Ints values = FieldCache.DEFAULT.GetInt32s(context.AtomicReader, field, (FieldCache.IIntParser)parser, false);
// we only request the usage of termDocs, if the range contains 0
return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader.MaxDoc, acceptDocs);
}
@@ -507,7 +507,7 @@ namespace Lucene.Net.Search
if (inclusiveLowerPoint > inclusiveUpperPoint)
return null;
- FieldCache.Longs values = FieldCache.DEFAULT.GetLongs(context.AtomicReader, field, (FieldCache.ILongParser)parser, false);
+ FieldCache.Longs values = FieldCache.DEFAULT.GetInt64s(context.AtomicReader, field, (FieldCache.ILongParser)parser, false);
// we only request the usage of termDocs, if the range contains 0
return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader.MaxDoc, acceptDocs);
}
@@ -555,8 +555,8 @@ namespace Lucene.Net.Search
float f = (float)lowerVal;
if (!includeUpper && f > 0.0f && float.IsInfinity(f))
return null;
- int i = NumericUtils.FloatToSortableInt(f);
- inclusiveLowerPoint = NumericUtils.SortableIntToFloat(includeLower ? i : (i + 1));
+ int i = NumericUtils.SingleToSortableInt32(f);
+ inclusiveLowerPoint = NumericUtils.SortableInt32ToSingle(includeLower ? i : (i + 1));
}
else
{
@@ -567,8 +567,8 @@ namespace Lucene.Net.Search
float f = (float)upperVal;
if (!includeUpper && f < 0.0f && float.IsInfinity(f))
return null;
- int i = NumericUtils.FloatToSortableInt(f);
- inclusiveUpperPoint = NumericUtils.SortableIntToFloat(includeUpper ? i : (i - 1));
+ int i = NumericUtils.SingleToSortableInt32(f);
+ inclusiveUpperPoint = NumericUtils.SortableInt32ToSingle(includeUpper ? i : (i - 1));
}
else
{
@@ -578,7 +578,7 @@ namespace Lucene.Net.Search
if (inclusiveLowerPoint > inclusiveUpperPoint)
return null;
- FieldCache.Floats values = FieldCache.DEFAULT.GetFloats(context.AtomicReader, field, (FieldCache.IFloatParser)parser, false);
+ FieldCache.Floats values = FieldCache.DEFAULT.GetSingles(context.AtomicReader, field, (FieldCache.IFloatParser)parser, false);
// we only request the usage of termDocs, if the range contains 0
return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader.MaxDoc, acceptDocs);
@@ -627,8 +627,8 @@ namespace Lucene.Net.Search
double f = (double)lowerVal;
if (!includeUpper && f > 0.0 && double.IsInfinity(f))
return null;
- long i = NumericUtils.DoubleToSortableLong(f);
- inclusiveLowerPoint = NumericUtils.SortableLongToDouble(includeLower ? i : (i + 1L));
+ long i = NumericUtils.DoubleToSortableInt64(f);
+ inclusiveLowerPoint = NumericUtils.SortableInt64ToDouble(includeLower ? i : (i + 1L));
}
else
{
@@ -639,8 +639,8 @@ namespace Lucene.Net.Search
double f = (double)upperVal;
if (!includeUpper && f < 0.0 && double.IsInfinity(f))
return null;
- long i = NumericUtils.DoubleToSortableLong(f);
- inclusiveUpperPoint = NumericUtils.SortableLongToDouble(includeUpper ? i : (i - 1L));
+ long i = NumericUtils.DoubleToSortableInt64(f);
+ inclusiveUpperPoint = NumericUtils.SortableInt64ToDouble(includeUpper ? i : (i - 1L));
}
else
{
@@ -706,22 +706,24 @@ namespace Lucene.Net.Search
/// Creates a numeric range filter using <seealso cref="IFieldCache#getShorts(AtomicReader,String,boolean)"/>. this works with all
/// short fields containing exactly one numeric term in the field. The range can be half-open by setting one
/// of the values to <code>null</code>.
+ /// <para/>
+ /// NOTE: this was newShortRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewInt16Range
[Obsolete]
- public static FieldCacheRangeFilter<short?> NewShortRange(string field, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper)
+ public static FieldCacheRangeFilter<short?> NewInt16Range(string field, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper)
{
- return NewShortRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
+ return NewInt16Range(field, null, lowerVal, upperVal, includeLower, includeUpper);
}
/// <summary>
/// Creates a numeric range filter using <seealso cref="IFieldCache#getShorts(AtomicReader,String,FieldCache.ShortParser,boolean)"/>. this works with all
/// short fields containing exactly one numeric term in the field. The range can be half-open by setting one
/// of the values to <code>null</code>.
+ /// <para/>
+ /// NOTE: this was newShortRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewInt16Range
[Obsolete]
- public static FieldCacheRangeFilter<short?> NewShortRange(string field, FieldCache.IShortParser parser, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper)
+ public static FieldCacheRangeFilter<short?> NewInt16Range(string field, FieldCache.IShortParser parser, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper)
{
return new AnonymousShortFieldCacheRangeFilter(field, parser, lowerVal, upperVal, includeLower, includeUpper);
}
@@ -730,20 +732,22 @@ namespace Lucene.Net.Search
/// Creates a numeric range filter using <seealso cref="IFieldCache#getInts(AtomicReader,String,boolean)"/>. this works with all
/// int fields containing exactly one numeric term in the field. The range can be half-open by setting one
/// of the values to <code>null</code>.
+ /// <para/>
+ /// NOTE: this was newIntRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewInt32Range
- public static FieldCacheRangeFilter<int?> NewIntRange(string field, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper)
+ public static FieldCacheRangeFilter<int?> NewInt32Range(string field, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper)
{
- return NewIntRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
+ return NewInt32Range(field, null, lowerVal, upperVal, includeLower, includeUpper);
}
/// <summary>
/// Creates a numeric range filter using <seealso cref="IFieldCache#getInts(AtomicReader,String,FieldCache.IntParser,boolean)"/>. this works with all
/// int fields containing exactly one numeric term in the field. The range can be half-open by setting one
/// of the values to <code>null</code>.
+ /// <para/>
+ /// NOTE: this was newIntRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewInt32Range
- public static FieldCacheRangeFilter<int?> NewIntRange(string field, FieldCache.IIntParser parser, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper)
+ public static FieldCacheRangeFilter<int?> NewInt32Range(string field, FieldCache.IIntParser parser, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper)
{
return new AnonymousIntFieldCacheRangeFilter(field, parser, lowerVal, upperVal, includeLower, includeUpper);
}
@@ -754,18 +758,19 @@ namespace Lucene.Net.Search
/// of the values to <code>null</code>.
/// </summary>
// LUCENENET TODO: Rename NewInt64Range
- public static FieldCacheRangeFilter<long?> NewLongRange(string field, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
+ public static FieldCacheRangeFilter<long?> NewInt64Range(string field, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
{
- return NewLongRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
+ return NewInt64Range(field, null, lowerVal, upperVal, includeLower, includeUpper);
}
/// <summary>
/// Creates a numeric range filter using <seealso cref="IFieldCache#getLongs(AtomicReader,String,FieldCache.LongParser,boolean)"/>. this works with all
/// long fields containing exactly one numeric term in the field. The range can be half-open by setting one
/// of the values to <code>null</code>.
+ /// <para/>
+ /// NOTE: this was newLongRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewInt64Range
- public static FieldCacheRangeFilter<long?> NewLongRange(string field, FieldCache.ILongParser parser, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
+ public static FieldCacheRangeFilter<long?> NewInt64Range(string field, FieldCache.ILongParser parser, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
{
return new AnonymousLongFieldCacheRangeFilter(field, parser, lowerVal, upperVal, includeLower, includeUpper);
}
@@ -774,20 +779,22 @@ namespace Lucene.Net.Search
/// Creates a numeric range filter using <seealso cref="IFieldCache#getFloats(AtomicReader,String,boolean)"/>. this works with all
/// float fields containing exactly one numeric term in the field. The range can be half-open by setting one
/// of the values to <code>null</code>.
+ /// <para/>
+ /// NOTE: this was newFloatRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewSingleRange
- public static FieldCacheRangeFilter<float?> NewFloatRange(string field, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper)
+ public static FieldCacheRangeFilter<float?> NewSingleRange(string field, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper)
{
- return NewFloatRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
+ return NewSingleRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
}
/// <summary>
/// Creates a numeric range filter using <seealso cref="IFieldCache#getFloats(AtomicReader,String,FieldCache.FloatParser,boolean)"/>. this works with all
/// float fields containing exactly one numeric term in the field. The range can be half-open by setting one
/// of the values to <code>null</code>.
+ /// <para/>
+ /// NOTE: this was newFloatRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewSingleRange
- public static FieldCacheRangeFilter<float?> NewFloatRange(string field, FieldCache.IFloatParser parser, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper)
+ public static FieldCacheRangeFilter<float?> NewSingleRange(string field, FieldCache.IFloatParser parser, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper)
{
return new AnonymousFloatFieldCacheRangeFilter(field, parser, lowerVal, upperVal, includeLower, includeUpper);
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/FieldComparator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FieldComparator.cs b/src/Lucene.Net.Core/Search/FieldComparator.cs
index 06e04b3..e4b0026 100644
--- a/src/Lucene.Net.Core/Search/FieldComparator.cs
+++ b/src/Lucene.Net.Core/Search/FieldComparator.cs
@@ -582,7 +582,7 @@ namespace Lucene.Net.Search
{
// NOTE: must do this before calling super otherwise
// we compute the docsWithField Bits twice!
- currentReaderValues = FieldCache.DEFAULT.GetFloats((context.AtomicReader), m_field, parser, m_missingValue != null);
+ currentReaderValues = FieldCache.DEFAULT.GetSingles((context.AtomicReader), m_field, parser, m_missingValue != null);
return base.SetNextReader(context);
}
@@ -672,7 +672,7 @@ namespace Lucene.Net.Search
{
// NOTE: must do this before calling super otherwise
// we compute the docsWithField Bits twice!
- currentReaderValues = FieldCache.DEFAULT.GetShorts((context.AtomicReader), m_field, parser, m_missingValue != null);
+ currentReaderValues = FieldCache.DEFAULT.GetInt16s((context.AtomicReader), m_field, parser, m_missingValue != null);
return base.SetNextReader(context);
}
@@ -758,7 +758,7 @@ namespace Lucene.Net.Search
{
// NOTE: must do this before calling super otherwise
// we compute the docsWithField Bits twice!
- currentReaderValues = FieldCache.DEFAULT.GetInts((context.AtomicReader), m_field, parser, m_missingValue != null);
+ currentReaderValues = FieldCache.DEFAULT.GetInt32s((context.AtomicReader), m_field, parser, m_missingValue != null);
return base.SetNextReader(context);
}
@@ -849,7 +849,7 @@ namespace Lucene.Net.Search
{
// NOTE: must do this before calling super otherwise
// we compute the docsWithField Bits twice!
- currentReaderValues = FieldCache.DEFAULT.GetLongs((context.AtomicReader), m_field, parser, m_missingValue != null);
+ currentReaderValues = FieldCache.DEFAULT.GetInt64s((context.AtomicReader), m_field, parser, m_missingValue != null);
return base.SetNextReader(context);
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/FuzzyQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FuzzyQuery.cs b/src/Lucene.Net.Core/Search/FuzzyQuery.cs
index 35bbc87..bb39c56 100644
--- a/src/Lucene.Net.Core/Search/FuzzyQuery.cs
+++ b/src/Lucene.Net.Core/Search/FuzzyQuery.cs
@@ -263,13 +263,15 @@ namespace Lucene.Net.Search
/// <summary>
/// Helper function to convert from deprecated "minimumSimilarity" fractions
/// to raw edit distances.
+ /// <para/>
+ /// NOTE: this was floatToEdits() in Lucene
/// </summary>
/// <param name="minimumSimilarity"> scaled similarity </param>
/// <param name="termLen"> length (in unicode codepoints) of the term. </param>
/// <returns> equivalent number of maxEdits </returns>
/// @deprecated pass integer edit distances instead.
[Obsolete("pass integer edit distances instead.")]
- public static int FloatToEdits(float minimumSimilarity, int termLen)
+ public static int SingleToEdits(float minimumSimilarity, int termLen)
{
if (minimumSimilarity >= 1f)
{
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/MatchAllDocsQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/MatchAllDocsQuery.cs b/src/Lucene.Net.Core/Search/MatchAllDocsQuery.cs
index c664823..b1031f7 100644
--- a/src/Lucene.Net.Core/Search/MatchAllDocsQuery.cs
+++ b/src/Lucene.Net.Core/Search/MatchAllDocsQuery.cs
@@ -177,7 +177,7 @@ namespace Lucene.Net.Search
public override int GetHashCode()
{
- return Number.FloatToIntBits(Boost) ^ 0x1AA71190;
+ return Number.SingleToInt32Bits(Boost) ^ 0x1AA71190;
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs b/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
index f893fe6..7fff3c8 100644
--- a/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
+++ b/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
@@ -448,7 +448,7 @@ namespace Lucene.Net.Search
public override int GetHashCode() // LUCENENET TODO: Check this algorithm - it may not be working correctly
{
//If this doesn't work hash all elements of positions. This was used to reduce time overhead
- return Number.FloatToIntBits(Boost)
+ return Number.SingleToInt32Bits(Boost)
^ slop
^ TermArraysHashCode()
^ ((positions.Count == 0) ? 0 : HashHelpers.CombineHashCodes(positions.First().GetHashCode(), positions.Last().GetHashCode(), positions.Count)
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/MultiTermQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/MultiTermQuery.cs b/src/Lucene.Net.Core/Search/MultiTermQuery.cs
index e004169..95556e0 100644
--- a/src/Lucene.Net.Core/Search/MultiTermQuery.cs
+++ b/src/Lucene.Net.Core/Search/MultiTermQuery.cs
@@ -369,7 +369,7 @@ namespace Lucene.Net.Search
{
const int prime = 31;
int result = 1;
- result = prime * result + Number.FloatToIntBits(Boost);
+ result = prime * result + Number.SingleToInt32Bits(Boost);
result = prime * result + m_rewriteMethod.GetHashCode();
if (m_field != null)
{
@@ -393,7 +393,7 @@ namespace Lucene.Net.Search
return false;
}
MultiTermQuery other = (MultiTermQuery)obj;
- if (Number.FloatToIntBits(Boost) != Number.FloatToIntBits(other.Boost))
+ if (Number.SingleToInt32Bits(Boost) != Number.SingleToInt32Bits(other.Boost))
{
return false;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/NGramPhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/NGramPhraseQuery.cs b/src/Lucene.Net.Core/Search/NGramPhraseQuery.cs
index 38334cf..38d1865 100644
--- a/src/Lucene.Net.Core/Search/NGramPhraseQuery.cs
+++ b/src/Lucene.Net.Core/Search/NGramPhraseQuery.cs
@@ -108,7 +108,7 @@ namespace Lucene.Net.Search
/// Returns a hash code value for this object. </summary>
public override int GetHashCode()
{
- return Number.FloatToIntBits(Boost)
+ return Number.SingleToInt32Bits(Boost)
^ Slop
^ GetTerms().GetHashCode()
^ GetPositions().GetHashCode()
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/NumericRangeFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/NumericRangeFilter.cs b/src/Lucene.Net.Core/Search/NumericRangeFilter.cs
index ef927e4..112d163 100644
--- a/src/Lucene.Net.Core/Search/NumericRangeFilter.cs
+++ b/src/Lucene.Net.Core/Search/NumericRangeFilter.cs
@@ -105,11 +105,12 @@ namespace Lucene.Net.Search
/// You can have half-open ranges (which are in fact </<= or >/>= queries)
/// by setting the min or max value to <code>null</code>. By setting inclusive to false, it will
/// match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
+ /// <para/>
+ /// NOTE: This was newLongRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewInt64Range
- public static NumericRangeFilter<long> NewLongRange(string field, int precisionStep, long? min, long? max, bool minInclusive, bool maxInclusive)
+ public static NumericRangeFilter<long> NewInt64Range(string field, int precisionStep, long? min, long? max, bool minInclusive, bool maxInclusive)
{
- return new NumericRangeFilter<long>(NumericRangeQuery.NewLongRange(field, precisionStep, min, max, minInclusive, maxInclusive));
+ return new NumericRangeFilter<long>(NumericRangeQuery.NewInt64Range(field, precisionStep, min, max, minInclusive, maxInclusive));
}
/// <summary>
@@ -118,11 +119,12 @@ namespace Lucene.Net.Search
/// You can have half-open ranges (which are in fact </<= or >/>= queries)
/// by setting the min or max value to <code>null</code>. By setting inclusive to false, it will
/// match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
+ /// <para/>
+ /// NOTE: This was newLongRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewInt64Range
- public static NumericRangeFilter<long> NewLongRange(string field, long? min, long? max, bool minInclusive, bool maxInclusive)
+ public static NumericRangeFilter<long> NewInt64Range(string field, long? min, long? max, bool minInclusive, bool maxInclusive)
{
- return new NumericRangeFilter<long>(NumericRangeQuery.NewLongRange(field, min, max, minInclusive, maxInclusive));
+ return new NumericRangeFilter<long>(NumericRangeQuery.NewInt64Range(field, min, max, minInclusive, maxInclusive));
}
/// <summary>
@@ -131,11 +133,12 @@ namespace Lucene.Net.Search
/// You can have half-open ranges (which are in fact </<= or >/>= queries)
/// by setting the min or max value to <code>null</code>. By setting inclusive to false, it will
/// match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
+ /// <para/>
+ /// NOTE: This was newIntRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewInt32Range
- public static NumericRangeFilter<int> NewIntRange(string field, int precisionStep, int? min, int? max, bool minInclusive, bool maxInclusive)
+ public static NumericRangeFilter<int> NewInt32Range(string field, int precisionStep, int? min, int? max, bool minInclusive, bool maxInclusive)
{
- return new NumericRangeFilter<int>(NumericRangeQuery.NewIntRange(field, precisionStep, min, max, minInclusive, maxInclusive));
+ return new NumericRangeFilter<int>(NumericRangeQuery.NewInt32Range(field, precisionStep, min, max, minInclusive, maxInclusive));
}
/// <summary>
@@ -144,11 +147,12 @@ namespace Lucene.Net.Search
/// You can have half-open ranges (which are in fact </<= or >/>= queries)
/// by setting the min or max value to <code>null</code>. By setting inclusive to false, it will
/// match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
+ /// <para/>
+ /// NOTE: This was newIntRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewInt32Range
- public static NumericRangeFilter<int> NewIntRange(string field, int? min, int? max, bool minInclusive, bool maxInclusive)
+ public static NumericRangeFilter<int> NewInt32Range(string field, int? min, int? max, bool minInclusive, bool maxInclusive)
{
- return new NumericRangeFilter<int>(NumericRangeQuery.NewIntRange(field, min, max, minInclusive, maxInclusive));
+ return new NumericRangeFilter<int>(NumericRangeQuery.NewInt32Range(field, min, max, minInclusive, maxInclusive));
}
/// <summary>
@@ -187,11 +191,12 @@ namespace Lucene.Net.Search
/// <seealso cref="Float#NaN"/> will never match a half-open range, to hit {@code NaN} use a query
/// with {@code min == max == Float.NaN}. By setting inclusive to false, it will
/// match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
+ /// <para/>
+ /// NOTE: This was newFloatRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewSingleRange
- public static NumericRangeFilter<float> NewFloatRange(string field, int precisionStep, float? min, float? max, bool minInclusive, bool maxInclusive)
+ public static NumericRangeFilter<float> NewSingleRange(string field, int precisionStep, float? min, float? max, bool minInclusive, bool maxInclusive)
{
- return new NumericRangeFilter<float>(NumericRangeQuery.NewFloatRange(field, precisionStep, min, max, minInclusive, maxInclusive));
+ return new NumericRangeFilter<float>(NumericRangeQuery.NewSingleRange(field, precisionStep, min, max, minInclusive, maxInclusive));
}
/// <summary>
@@ -202,11 +207,12 @@ namespace Lucene.Net.Search
/// <seealso cref="Float#NaN"/> will never match a half-open range, to hit {@code NaN} use a query
/// with {@code min == max == Float.NaN}. By setting inclusive to false, it will
/// match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
+ /// <para/>
+ /// NOTE: This was newFloatRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewSingleRange
- public static NumericRangeFilter<float> NewFloatRange(string field, float? min, float? max, bool minInclusive, bool maxInclusive)
+ public static NumericRangeFilter<float> NewSingleRange(string field, float? min, float? max, bool minInclusive, bool maxInclusive)
{
- return new NumericRangeFilter<float>(NumericRangeQuery.NewFloatRange(field, min, max, minInclusive, maxInclusive));
+ return new NumericRangeFilter<float>(NumericRangeQuery.NewSingleRange(field, min, max, minInclusive, maxInclusive));
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/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 7c17a5f..003078f 100644
--- a/src/Lucene.Net.Core/Search/NumericRangeQuery.cs
+++ b/src/Lucene.Net.Core/Search/NumericRangeQuery.cs
@@ -287,11 +287,11 @@ namespace Lucene.Net.Search
internal readonly bool minInclusive, maxInclusive;
// used to handle float/double infinity correcty
- internal static readonly long LONG_NEGATIVE_INFINITY = NumericUtils.DoubleToSortableLong(double.NegativeInfinity);
+ internal static readonly long LONG_NEGATIVE_INFINITY = NumericUtils.DoubleToSortableInt64(double.NegativeInfinity);
- internal static readonly long LONG_POSITIVE_INFINITY = NumericUtils.DoubleToSortableLong(double.PositiveInfinity);
- internal static readonly int INT_NEGATIVE_INFINITY = NumericUtils.FloatToSortableInt(float.NegativeInfinity);
- internal static readonly int INT_POSITIVE_INFINITY = NumericUtils.FloatToSortableInt(float.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);
/// <summary>
/// Subclass of FilteredTermsEnum for enumerating all terms that match the
@@ -330,7 +330,7 @@ namespace Lucene.Net.Search
else
{
Debug.Assert(this.outerInstance.dataType == NumericType.DOUBLE);
- minBound = (this.outerInstance.min == null) ? LONG_NEGATIVE_INFINITY : NumericUtils.DoubleToSortableLong(Convert.ToDouble(this.outerInstance.min.Value));
+ minBound = (this.outerInstance.min == null) ? LONG_NEGATIVE_INFINITY : NumericUtils.DoubleToSortableInt64(Convert.ToDouble(this.outerInstance.min.Value));
}
if (!this.outerInstance.minInclusive && this.outerInstance.min != null)
{
@@ -350,7 +350,7 @@ namespace Lucene.Net.Search
else
{
Debug.Assert(this.outerInstance.dataType == NumericType.DOUBLE);
- maxBound = (this.outerInstance.max == null) ? LONG_POSITIVE_INFINITY : NumericUtils.DoubleToSortableLong(Convert.ToDouble(this.outerInstance.max));
+ maxBound = (this.outerInstance.max == null) ? LONG_POSITIVE_INFINITY : NumericUtils.DoubleToSortableInt64(Convert.ToDouble(this.outerInstance.max));
}
if (!this.outerInstance.maxInclusive && this.outerInstance.max != null)
{
@@ -361,7 +361,7 @@ namespace Lucene.Net.Search
maxBound--;
}
- NumericUtils.SplitLongRange(new LongRangeBuilderAnonymousInnerClassHelper(this), this.outerInstance.precisionStep, minBound, maxBound);
+ NumericUtils.SplitInt64Range(new LongRangeBuilderAnonymousInnerClassHelper(this), this.outerInstance.precisionStep, minBound, maxBound);
break;
}
@@ -377,7 +377,7 @@ namespace Lucene.Net.Search
else
{
Debug.Assert(this.outerInstance.dataType == NumericType.FLOAT);
- minBound = (this.outerInstance.min == null) ? INT_NEGATIVE_INFINITY : NumericUtils.FloatToSortableInt(Convert.ToSingle(this.outerInstance.min));
+ minBound = (this.outerInstance.min == null) ? INT_NEGATIVE_INFINITY : NumericUtils.SingleToSortableInt32(Convert.ToSingle(this.outerInstance.min));
}
if (!this.outerInstance.minInclusive && this.outerInstance.min != null)
{
@@ -397,7 +397,7 @@ namespace Lucene.Net.Search
else
{
Debug.Assert(this.outerInstance.dataType == NumericType.FLOAT);
- maxBound = (this.outerInstance.max == null) ? INT_POSITIVE_INFINITY : NumericUtils.FloatToSortableInt(Convert.ToSingle(this.outerInstance.max));
+ maxBound = (this.outerInstance.max == null) ? INT_POSITIVE_INFINITY : NumericUtils.SingleToSortableInt32(Convert.ToSingle(this.outerInstance.max));
}
if (!this.outerInstance.maxInclusive && this.outerInstance.max != null)
{
@@ -408,7 +408,7 @@ namespace Lucene.Net.Search
maxBound--;
}
- NumericUtils.SplitIntRange(new IntRangeBuilderAnonymousInnerClassHelper(this), this.outerInstance.precisionStep, minBound, maxBound);
+ NumericUtils.SplitInt32Range(new IntRangeBuilderAnonymousInnerClassHelper(this), this.outerInstance.precisionStep, minBound, maxBound);
break;
}
@@ -514,9 +514,10 @@ namespace Lucene.Net.Search
/// You can have half-open ranges (which are in fact </<= or >/>= queries)
/// by setting the min or max value to <code>null</code>. By setting inclusive to false, it will
/// match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
+ /// <para/>
+ /// NOTE: This was newLongRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewInt64Range
- public static NumericRangeQuery<long> NewLongRange(string field, int precisionStep, long? min, long? max, bool minInclusive, bool maxInclusive)
+ public static NumericRangeQuery<long> NewInt64Range(string field, int precisionStep, long? min, long? max, bool minInclusive, bool maxInclusive)
{
return new NumericRangeQuery<long>(field, precisionStep, NumericType.LONG, min, max, minInclusive, maxInclusive);
}
@@ -527,9 +528,10 @@ namespace Lucene.Net.Search
/// You can have half-open ranges (which are in fact </<= or >/>= queries)
/// by setting the min or max value to <code>null</code>. By setting inclusive to false, it will
/// match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
+ /// <para/>
+ /// NOTE: This was newLongRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewInt64Range
- public static NumericRangeQuery<long> NewLongRange(string field, long? min, long? max, bool minInclusive, bool maxInclusive)
+ public static NumericRangeQuery<long> NewInt64Range(string field, long? min, long? max, bool minInclusive, bool maxInclusive)
{
return new NumericRangeQuery<long>(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.LONG, min, max, minInclusive, maxInclusive);
}
@@ -540,9 +542,10 @@ namespace Lucene.Net.Search
/// You can have half-open ranges (which are in fact </<= or >/>= queries)
/// by setting the min or max value to <code>null</code>. By setting inclusive to false, it will
/// match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
+ /// <para/>
+ /// NOTE: This was newIntRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewInt32Range
- public static NumericRangeQuery<int> NewIntRange(string field, int precisionStep, int? min, int? max, bool minInclusive, bool maxInclusive)
+ public static NumericRangeQuery<int> NewInt32Range(string field, int precisionStep, int? min, int? max, bool minInclusive, bool maxInclusive)
{
return new NumericRangeQuery<int>(field, precisionStep, NumericType.INT, min, max, minInclusive, maxInclusive);
}
@@ -553,9 +556,10 @@ namespace Lucene.Net.Search
/// You can have half-open ranges (which are in fact </<= or >/>= queries)
/// by setting the min or max value to <code>null</code>. By setting inclusive to false, it will
/// match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
+ /// <para/>
+ /// NOTE: This was newIntRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewInt32Range
- public static NumericRangeQuery<int> NewIntRange(string field, int? min, int? max, bool minInclusive, bool maxInclusive)
+ public static NumericRangeQuery<int> NewInt32Range(string field, int? min, int? max, bool minInclusive, bool maxInclusive)
{
return new NumericRangeQuery<int>(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.INT, min, max, minInclusive, maxInclusive);
}
@@ -596,9 +600,10 @@ namespace Lucene.Net.Search
/// <seealso cref="Float#NaN"/> will never match a half-open range, to hit {@code NaN} use a query
/// with {@code min == max == Float.NaN}. By setting inclusive to false, it will
/// match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
+ /// <para/>
+ /// NOTE: This was newFloatRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewSingleRange
- public static NumericRangeQuery<float> NewFloatRange(string field, int precisionStep, float? min, float? max, bool minInclusive, bool maxInclusive)
+ public static NumericRangeQuery<float> NewSingleRange(string field, int precisionStep, float? min, float? max, bool minInclusive, bool maxInclusive)
{
return new NumericRangeQuery<float>(field, precisionStep, NumericType.FLOAT, min, max, minInclusive, maxInclusive);
}
@@ -611,9 +616,10 @@ namespace Lucene.Net.Search
/// <seealso cref="Float#NaN"/> will never match a half-open range, to hit {@code NaN} use a query
/// with {@code min == max == Float.NaN}. By setting inclusive to false, it will
/// match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.
+ /// <para/>
+ /// NOTE: This was newFloatRange() in Lucene
/// </summary>
- // LUCENENET TODO: Rename NewSingleRange
- public static NumericRangeQuery<float> NewFloatRange(string field, float? min, float? max, bool minInclusive, bool maxInclusive)
+ public static NumericRangeQuery<float> NewSingleRange(string field, float? min, float? max, bool minInclusive, bool maxInclusive)
{
return new NumericRangeQuery<float>(field, NumericUtils.PRECISION_STEP_DEFAULT, NumericType.FLOAT, min, max, minInclusive, maxInclusive);
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/PhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/PhraseQuery.cs b/src/Lucene.Net.Core/Search/PhraseQuery.cs
index 10d660b..e8ab3c4 100644
--- a/src/Lucene.Net.Core/Search/PhraseQuery.cs
+++ b/src/Lucene.Net.Core/Search/PhraseQuery.cs
@@ -509,7 +509,7 @@ namespace Lucene.Net.Search
/// Returns a hash code value for this object. </summary>
public override int GetHashCode()
{
- return Number.FloatToIntBits(Boost)
+ return Number.SingleToInt32Bits(Boost)
^ slop
^ terms.GetHashCode()
^ positions.GetHashCode();
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/Query.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Query.cs b/src/Lucene.Net.Core/Search/Query.cs
index 2ea4d2b..67860e5 100644
--- a/src/Lucene.Net.Core/Search/Query.cs
+++ b/src/Lucene.Net.Core/Search/Query.cs
@@ -126,7 +126,7 @@ namespace Lucene.Net.Search
{
const int prime = 31;
int result = 1;
- result = prime * result + Number.FloatToIntBits(Boost);
+ result = prime * result + Number.SingleToInt32Bits(Boost);
return result;
}
@@ -149,7 +149,7 @@ namespace Lucene.Net.Search
var other = obj as Query;
- if (Number.FloatToIntBits(Boost) != Number.FloatToIntBits(other.Boost))
+ if (Number.SingleToInt32Bits(Boost) != Number.SingleToInt32Bits(other.Boost))
{
return false;
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs b/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs
index 310e637..2f363d8 100644
--- a/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs
+++ b/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs
@@ -108,7 +108,7 @@ namespace Lucene.Net.Search.Similarities
/// </summary>
protected internal virtual sbyte EncodeNormValue(float boost, int fieldLength) // LUCENENET TODO: Can we use byte?
{
- return SmallFloat.FloatToByte315(boost / (float)Math.Sqrt(fieldLength));
+ return SmallFloat.SingleToByte315(boost / (float)Math.Sqrt(fieldLength));
}
/// <summary>
@@ -151,7 +151,7 @@ namespace Lucene.Net.Search.Similarities
{
for (int i = 0; i < 256; i++)
{
- float f = SmallFloat.Byte315ToFloat((sbyte)i);
+ float f = SmallFloat.Byte315ToSingle((sbyte)i);
NORM_TABLE[i] = 1.0f / (f * f);
}
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/Similarities/DefaultSimilarity.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Similarities/DefaultSimilarity.cs b/src/Lucene.Net.Core/Search/Similarities/DefaultSimilarity.cs
index 3d139e5..2ea6e9a 100644
--- a/src/Lucene.Net.Core/Search/Similarities/DefaultSimilarity.cs
+++ b/src/Lucene.Net.Core/Search/Similarities/DefaultSimilarity.cs
@@ -54,7 +54,7 @@ namespace Lucene.Net.Search.Similarities
{
for (int i = 0; i < 256; i++)
{
- NORM_TABLE[i] = SmallFloat.Byte315ToFloat((sbyte)i);
+ NORM_TABLE[i] = SmallFloat.Byte315ToSingle((sbyte)i);
}
}
@@ -93,7 +93,7 @@ namespace Lucene.Net.Search.Similarities
/// <seealso cref= Lucene.Net.Util.SmallFloat </seealso>
public override sealed long EncodeNormValue(float f)
{
- return SmallFloat.FloatToByte315(f);
+ return SmallFloat.SingleToByte315(f);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs b/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs
index d880b6d..9337174 100644
--- a/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs
+++ b/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs
@@ -235,7 +235,7 @@ namespace Lucene.Net.Search.Similarities
{
for (int i = 0; i < 256; i++)
{
- float floatNorm = SmallFloat.Byte315ToFloat((sbyte)i);
+ float floatNorm = SmallFloat.Byte315ToSingle((sbyte)i);
NORM_TABLE[i] = 1.0f / (floatNorm * floatNorm);
}
}
@@ -268,7 +268,7 @@ namespace Lucene.Net.Search.Similarities
/// Encodes the length to a byte via SmallFloat. </summary>
protected internal virtual sbyte EncodeNormValue(float boost, float length) // LUCENENET TODO: Can this be byte?
{
- return SmallFloat.FloatToByte315((boost / (float)Math.Sqrt(length)));
+ return SmallFloat.SingleToByte315((boost / (float)Math.Sqrt(length)));
}
// ----------------------------- Static methods ------------------------------