Skip to content

Commit

Permalink
Make TermStats.TermText public (#959)
Browse files Browse the repository at this point in the history
  • Loading branch information
rclabo committed Sep 24, 2024
1 parent 627fccc commit c04fe30
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/Lucene.Net.Misc/Misc/HighFreqTerms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public int Compare(TermStats a, TermStats b)
res = a.Field.CompareToOrdinal(b.Field);
if (res == 0)
{
res = a.termtext.CompareTo(b.termtext);
res = a.TermText.CompareTo(b.TermText);
}
}
return res;
Expand All @@ -180,7 +180,7 @@ public int Compare(TermStats a, TermStats b)
res = a.Field.CompareToOrdinal(b.Field);
if (res == 0)
{
res = a.termtext.CompareTo(b.termtext);
res = a.TermText.CompareTo(b.TermText);
}
}
return res;
Expand Down Expand Up @@ -217,4 +217,4 @@ internal void Fill(string field, TermsEnum termsEnum)
}
}
}
}
}
10 changes: 5 additions & 5 deletions src/Lucene.Net.Misc/Misc/TermStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,27 @@ namespace Lucene.Net.Misc
/// </summary>
public sealed class TermStats
{
internal readonly BytesRef termtext;
public readonly BytesRef TermText;
public string Field { get; set; }
public int DocFreq { get; set; }
public long TotalTermFreq { get; set; }

internal TermStats(string field, BytesRef termtext, int df, long tf)
{
this.termtext = BytesRef.DeepCopyOf(termtext);
this.TermText = BytesRef.DeepCopyOf(termtext);
this.Field = field;
this.DocFreq = df;
this.TotalTermFreq = tf;
}

internal string GetTermText()
{
return termtext.Utf8ToString();
return TermText.Utf8ToString();
}

public override string ToString()
{
return ("TermStats: Term=" + termtext.Utf8ToString() + " DocFreq=" + DocFreq + " TotalTermFreq=" + TotalTermFreq);
return ("TermStats: Term=" + TermText.Utf8ToString() + " DocFreq=" + DocFreq + " TotalTermFreq=" + TotalTermFreq);
}
}
}
}
4 changes: 2 additions & 2 deletions src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void TestGetHighFreqTerms()

for (int i = 0; i < terms.Length; i++)
{
string termtext = terms[i].termtext.Utf8ToString();
string termtext = terms[i].TermText.Utf8ToString();
// hardcoded highTF or highTFmedDF
if (termtext.Contains("highTF"))
{
Expand Down Expand Up @@ -195,7 +195,7 @@ public void TestGetTermFreqOrdered()

for (int i = 0; i < terms.Length; i++)
{
string text = terms[i].termtext.Utf8ToString();
string text = terms[i].TermText.Utf8ToString();
if (text.Contains("highTF"))
{
if (text.Contains("medDF"))
Expand Down

0 comments on commit c04fe30

Please sign in to comment.