Skip to content

Commit

Permalink
Lucene.Net.TestFramework.Search.RandomSimilarityProvider::ToString():…
Browse files Browse the repository at this point in the history
… Use StringBuilder for better efficiency (#295, #261)
  • Loading branch information
NightOwl888 committed Jun 30, 2020
1 parent 55e44c7 commit c7f23fa
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/Lucene.Net.TestFramework/Search/RandomSimilarityProvider.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using J2N.Collections.Generic.Extensions;
using Lucene.Net.Search.Similarities;
using Lucene.Net.Support;
using System;
using System.Collections.Generic;
using System.Text;
using Debug = Lucene.Net.Diagnostics.Debug; // LUCENENET NOTE: We cannot use System.Diagnostics.Debug because those calls will be optimized out of the release!

namespace Lucene.Net.Search
Expand Down Expand Up @@ -140,21 +140,21 @@ public override string ToString()
{
lock (this)
{
string coordMethod;
// LUCENENET: Use StringBuilder for better efficiency
var sb = new StringBuilder();
sb.Append(nameof(RandomSimilarityProvider));
sb.Append("(queryNorm=");
sb.Append(shouldQueryNorm);
sb.Append(",coord=");
if (coordType == 0)
{
coordMethod = "no";
}
sb.Append("no");
else if (coordType == 1)
{
coordMethod = "yes";
}
sb.Append("yes");
else
{
coordMethod = "crazy";
}
return "RandomSimilarityProvider(queryNorm=" + shouldQueryNorm + ",coord=" + coordMethod + "): " +
string.Format(J2N.Text.StringFormatter.InvariantCulture, "{0}", previousMappings);
sb.Append("crazy");
sb.Append("): ");
sb.AppendFormat(J2N.Text.StringFormatter.InvariantCulture, "{0}", previousMappings);
return sb.ToString();
}
}
}
Expand Down

0 comments on commit c7f23fa

Please sign in to comment.