Skip to content

Commit

Permalink
Minor cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
synhershko committed Jan 5, 2015
1 parent 6b0841c commit 7a5aa5c
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class Lucene3xSegmentInfoReader : SegmentInfoReader
{
public static void ReadLegacyInfos(SegmentInfos infos, Directory directory, IndexInput input, int format)
{
infos.Version_Renamed = input.ReadLong(); // read version
infos.Version = input.ReadLong(); // read version
infos.Counter = input.ReadInt(); // read counter
Lucene3xSegmentInfoReader reader = new Lucene3xSegmentInfoReader();
for (int i = input.ReadInt(); i > 0; i--) // read segmentInfos
Expand Down Expand Up @@ -98,7 +98,7 @@ public static void ReadLegacyInfos(SegmentInfos infos, Directory directory, Inde
infos.Add(siPerCommit);
}

infos.UserData_Renamed = input.ReadStringStringMap();
infos.UserData = input.ReadStringStringMap();
}

public override SegmentInfo Read(Directory directory, string segmentName, IOContext context)
Expand Down
4 changes: 2 additions & 2 deletions src/Lucene.Net.Core/Index/IndexWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5654,9 +5654,9 @@ internal virtual bool NrtIsCurrent(SegmentInfos infos)
EnsureOpen();
if (infoStream.IsEnabled("IW"))
{
infoStream.Message("IW", "nrtIsCurrent: infoVersion matches: " + (infos.Version_Renamed == segmentInfos.Version_Renamed) + "; DW changes: " + DocWriter.AnyChanges() + "; BD changes: " + BufferedUpdatesStream.Any());
infoStream.Message("IW", "nrtIsCurrent: infoVersion matches: " + (infos.Version == segmentInfos.Version) + "; DW changes: " + DocWriter.AnyChanges() + "; BD changes: " + BufferedUpdatesStream.Any());
}
return infos.Version_Renamed == segmentInfos.Version_Renamed && !DocWriter.AnyChanges() && !BufferedUpdatesStream.Any();
return infos.Version == segmentInfos.Version && !DocWriter.AnyChanges() && !BufferedUpdatesStream.Any();
}
}

Expand Down
18 changes: 9 additions & 9 deletions src/Lucene.Net.Core/Index/LogMergePolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ protected internal virtual bool IsMerged(SegmentInfos infos, int maxNumSegments,
private MergeSpecification FindForcedMergesSizeLimit(SegmentInfos infos, int maxNumSegments, int last)
{
MergeSpecification spec = new MergeSpecification();
List<SegmentCommitInfo> segments = infos.AsList();
IList<SegmentCommitInfo> segments = infos.AsList();

int start = last - 1;
while (start >= 0)
Expand Down Expand Up @@ -300,8 +300,8 @@ private MergeSpecification FindForcedMergesSizeLimit(SegmentInfos infos, int max
/// </summary>
private MergeSpecification FindForcedMergesMaxNumSegments(SegmentInfos infos, int maxNumSegments, int last)
{
MergeSpecification spec = new MergeSpecification();
List<SegmentCommitInfo> segments = infos.AsList();
var spec = new MergeSpecification();
var segments = infos.AsList();

// First, enroll all "full" merges (size
// mergeFactor) to potentially be run concurrently:
Expand Down Expand Up @@ -454,15 +454,15 @@ public override MergeSpecification FindForcedMerges(SegmentInfos infos, int maxN
/// </summary>
public override MergeSpecification FindForcedDeletesMerges(SegmentInfos segmentInfos)
{
List<SegmentCommitInfo> segments = segmentInfos.AsList();
var segments = segmentInfos.AsList();
int numSegments = segments.Count;

if (Verbose())
{
Message("findForcedDeleteMerges: " + numSegments + " segments");
}

MergeSpecification spec = new MergeSpecification();
var spec = new MergeSpecification();
int firstSegmentWithDeletions = -1;
IndexWriter w = Writer.Get();
Debug.Assert(w != null);
Expand Down Expand Up @@ -520,9 +520,9 @@ public override MergeSpecification FindForcedDeletesMerges(SegmentInfos segmentI

private class SegmentInfoAndLevel : IComparable<SegmentInfoAndLevel>
{
internal SegmentCommitInfo Info;
internal float Level;
internal int Index;
internal readonly SegmentCommitInfo Info;
internal readonly float Level;
private int Index;

public SegmentInfoAndLevel(SegmentCommitInfo info, float level, int index)
{
Expand Down Expand Up @@ -558,7 +558,7 @@ public override MergeSpecification FindMerges(MergeTrigger? mergeTrigger, Segmen
// Compute levels, which is just log (base mergeFactor)
// of the size of each segment
IList<SegmentInfoAndLevel> levels = new List<SegmentInfoAndLevel>();
float norm = (float)Math.Log(MergeFactor_Renamed);
var norm = (float)Math.Log(MergeFactor_Renamed);

ICollection<SegmentCommitInfo> mergingSegments = Writer.Get().MergingSegments;

Expand Down
Loading

0 comments on commit 7a5aa5c

Please sign in to comment.