diff --git a/src/Lucene.Net.Highlighter/Highlight/QueryTermExtractor.cs b/src/Lucene.Net.Highlighter/Highlight/QueryTermExtractor.cs index f0d152217f..2a9ab56714 100644 --- a/src/Lucene.Net.Highlighter/Highlight/QueryTermExtractor.cs +++ b/src/Lucene.Net.Highlighter/Highlight/QueryTermExtractor.cs @@ -117,7 +117,7 @@ private static void GetTerms(Query query, ISet terms, bool prohibi { if ((fieldName == null) || (term.Field.Equals(fieldName, StringComparison.Ordinal))) { - terms.Add(new WeightedTerm(query.Boost, term.Text())); + terms.Add(new WeightedTerm(query.Boost, term.Text)); } } } diff --git a/src/Lucene.Net.Highlighter/Highlight/WeightedSpanTermExtractor.cs b/src/Lucene.Net.Highlighter/Highlight/WeightedSpanTermExtractor.cs index 458f794c9a..a4b554cb8d 100644 --- a/src/Lucene.Net.Highlighter/Highlight/WeightedSpanTermExtractor.cs +++ b/src/Lucene.Net.Highlighter/Highlight/WeightedSpanTermExtractor.cs @@ -317,12 +317,12 @@ protected virtual void ExtractWeightedSpanTerms(IDictionary pq.ToString())); } } @@ -106,7 +106,7 @@ internal static CharacterRunAutomaton[] ExtractAutomata(Query query, string fiel { if (fq.Field.Equals(field, StringComparison.Ordinal)) { - string utf16 = fq.Term.Text(); + string utf16 = fq.Term.Text; int[] termText = new int[utf16.CodePointCount(0, utf16.Length)]; for (int cp, i = 0, j = 0; i < utf16.Length; i += Character.CharCount(cp)) { diff --git a/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs b/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs index 3e220fa373..76f3311948 100644 --- a/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs +++ b/src/Lucene.Net.Highlighter/VectorHighlight/FieldQuery.cs @@ -270,7 +270,7 @@ private static void CheckOverlap(ICollection expandQueries, Term[] src, T bool overlap = true; for (int j = i; j < src.Length; j++) { - if ((j - i) < dest.Length && !src[j].Text().Equals(dest[j - i].Text(), StringComparison.Ordinal)) + if ((j - i) < dest.Length && !src[j].Text.Equals(dest[j - i].Text, StringComparison.Ordinal)) { overlap = false; break; @@ -283,7 +283,7 @@ private static void CheckOverlap(ICollection expandQueries, Term[] src, T pq.Add(srcTerm); for (int k = src.Length - i; k < dest.Length; k++) { - pq.Add(new Term(src[0].Field, dest[k].Text())); + pq.Add(new Term(src[0].Field, dest[k].Text)); } pq.Slop = slop; pq.Boost = boost; @@ -354,18 +354,18 @@ internal void SaveTerms(ICollection flatQueries, IndexReader reader) { ISet termSet = GetTermSet(query); if (query is TermQuery termQuery) - termSet.Add(termQuery.Term.Text()); + termSet.Add(termQuery.Term.Text); else if (query is PhraseQuery phraseQuery) { foreach (Term term in phraseQuery.GetTerms()) - termSet.Add(term.Text()); + termSet.Add(term.Text); } else if (query is MultiTermQuery && reader != null) { BooleanQuery mtqTerms = (BooleanQuery)query.Rewrite(reader); foreach (BooleanClause clause in mtqTerms.GetClauses()) { - termSet.Add(((TermQuery)clause.Query).Term.Text()); + termSet.Add(((TermQuery)clause.Query).Term.Text); } } else @@ -438,7 +438,7 @@ public QueryPhraseMap(FieldQuery fieldQuery) internal void AddTerm(Term term, float boost) { - QueryPhraseMap map = GetOrNewMap(subMap, term.Text()); + QueryPhraseMap map = GetOrNewMap(subMap, term.Text); map.MarkTerminal(boost); } @@ -465,7 +465,7 @@ internal void Add(Query query /*, IndexReader reader // LUCENENET: Never read */ QueryPhraseMap qpm = null; foreach (Term term in terms) { - qpm = GetOrNewMap(map, term.Text()); + qpm = GetOrNewMap(map, term.Text); map = qpm.subMap; } qpm.MarkTerminal(pq.Slop, pq.Boost); diff --git a/src/Lucene.Net.Misc/Misc/GetTermInfo.cs b/src/Lucene.Net.Misc/Misc/GetTermInfo.cs index 4416591019..fb7fd1e84e 100644 --- a/src/Lucene.Net.Misc/Misc/GetTermInfo.cs +++ b/src/Lucene.Net.Misc/Misc/GetTermInfo.cs @@ -55,7 +55,7 @@ public static void Main(string[] args) public static void TermInfo(Store.Directory dir, Term term) { IndexReader reader = DirectoryReader.Open(dir); - Console.WriteLine("{0}:{1} \t totalTF = {2:#,##0} \t doc freq = {3:#,##0} \n", term.Field, term.Text(), reader.TotalTermFreq(term), reader.DocFreq(term)); + Console.WriteLine("{0}:{1} \t totalTF = {2:#,##0} \t doc freq = {3:#,##0} \n", term.Field, term.Text, reader.TotalTermFreq(term), reader.DocFreq(term)); } // LUCENENET specific - our wrapper console shows the correct usage diff --git a/src/Lucene.Net.Queries/TermFilter.cs b/src/Lucene.Net.Queries/TermFilter.cs index ce2d031741..5df6d74db3 100644 --- a/src/Lucene.Net.Queries/TermFilter.cs +++ b/src/Lucene.Net.Queries/TermFilter.cs @@ -108,7 +108,7 @@ public override int GetHashCode() public override string ToString() { - return term.Field + ":" + term.Text(); + return term.Field + ":" + term.Text; } } } \ No newline at end of file diff --git a/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs b/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs index 0d7b8f81d7..b7e8eeb45d 100644 --- a/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs +++ b/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs @@ -579,7 +579,7 @@ protected internal virtual Query NewRegexpQuery(Term regexp) protected internal virtual Query NewFuzzyQuery(Term term, float minimumSimilarity, int prefixLength) { // FuzzyQuery doesn't yet allow constant score rewrite - string text = term.Text(); + string text = term.Text; #pragma warning disable 612, 618 int numEdits = FuzzyQuery.SingleToEdits(minimumSimilarity, text.CodePointCount(0, text.Length)); diff --git a/src/Lucene.Net.Sandbox/Queries/SlowFuzzyQuery.cs b/src/Lucene.Net.Sandbox/Queries/SlowFuzzyQuery.cs index 770166685f..9733c23bf1 100644 --- a/src/Lucene.Net.Sandbox/Queries/SlowFuzzyQuery.cs +++ b/src/Lucene.Net.Sandbox/Queries/SlowFuzzyQuery.cs @@ -93,7 +93,7 @@ public SlowFuzzyQuery(Term term, float minimumSimilarity, int prefixLength, MultiTermRewriteMethod = new MultiTermQuery.TopTermsScoringBooleanQueryRewrite(maxExpansions); - string text = term.Text(); + string text = term.Text; int len = text.CodePointCount(0, text.Length); if (len > 0 && (minimumSimilarity >= 1f || len > 1.0f / (1.0f - minimumSimilarity))) { @@ -163,7 +163,7 @@ public override string ToString(string field) buffer.Append(m_term.Field); buffer.Append(":"); } - buffer.Append(m_term.Text()); + buffer.Append(m_term.Text); buffer.Append('~'); buffer.Append(Number.ToString(minimumSimilarity)); buffer.Append(ToStringUtils.Boost(Boost)); diff --git a/src/Lucene.Net.Suggest/Spell/DirectSpellChecker.cs b/src/Lucene.Net.Suggest/Spell/DirectSpellChecker.cs index 3d2a5efa96..8d393dcfe9 100644 --- a/src/Lucene.Net.Suggest/Spell/DirectSpellChecker.cs +++ b/src/Lucene.Net.Suggest/Spell/DirectSpellChecker.cs @@ -322,7 +322,7 @@ public virtual SuggestWord[] SuggestSimilar(Term term, int numSug, IndexReader i SuggestMode suggestMode, float accuracy) { CharsRef spare = new CharsRef(); - string text = term.Text(); + string text = term.Text; if (minQueryLength > 0 && text.CodePointCount(0, text.Length) < minQueryLength) { return Arrays.Empty(); @@ -433,7 +433,7 @@ protected internal virtual ICollection SuggestSimilar(Term term, int var stQueue = new JCG.PriorityQueue(); - BytesRef queryTerm = new BytesRef(term.Text()); + BytesRef queryTerm = new BytesRef(term.Text); BytesRef candidateTerm; ScoreTerm st = new ScoreTerm(); IBoostAttribute boostAtt = e.Attributes.AddAttribute(); @@ -474,7 +474,7 @@ protected internal virtual ICollection SuggestSimilar(Term term, int { UnicodeUtil.UTF8toUTF16(candidateTerm, spare); termAsString = spare.ToString(); - score = distance.GetDistance(term.Text(), termAsString); + score = distance.GetDistance(term.Text, termAsString); } if (score < accuracy) diff --git a/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs b/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs index a01631dd8d..4543e85440 100644 --- a/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs +++ b/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs @@ -182,7 +182,7 @@ public virtual CombineSuggestion[] SuggestWordCombinations(Term[] terms, int max { continue; } - string leftTermText = terms[i].Text(); + string leftTermText = terms[i].Text; int leftTermLength = leftTermText.CodePointCount(0, leftTermText.Length); if (leftTermLength > maxCombineWordLength) { @@ -203,7 +203,7 @@ public virtual CombineSuggestion[] SuggestWordCombinations(Term[] terms, int max { break; } - string rightTermText = terms[j].Text(); + string rightTermText = terms[j].Text; int rightTermLength = rightTermText.CodePointCount(0, rightTermText.Length); combinedTermText += rightTermText; combinedLength += rightTermLength; @@ -236,7 +236,7 @@ public virtual CombineSuggestion[] SuggestWordCombinations(Term[] terms, int max SuggestWord word = new SuggestWord(); word.Freq = combinedTermFreq; word.Score = origIndexes.Length - 1; - word.String = combinedTerm.Text(); + word.String = combinedTerm.Text; CombineSuggestionWrapper suggestion = new CombineSuggestionWrapper(new CombineSuggestion(word, origIndexes), (origIndexes.Length - 1)); suggestions.Enqueue(suggestion); if (suggestions.Count > maxSuggestions) @@ -266,7 +266,7 @@ private int GenerateBreakUpSuggestions(Term term, IndexReader ir, SuggestWord[] prefix, JCG.PriorityQueue suggestions, int totalEvaluations, BreakSuggestionSortMethod sortMethod) { - string termText = term.Text(); + string termText = term.Text; int termLength = termText.CodePointCount(0, termText.Length); int useMinBreakWordLength = minBreakWordLength; if (useMinBreakWordLength < 1) diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts2.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts2.cs index 999e8a23f5..284547bc86 100644 --- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts2.cs +++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts2.cs @@ -120,7 +120,7 @@ private static IList RandomCategories(Random random) private static void AddField(Document doc) { - doc.Add(new StringField(A.Field, A.Text(), Store.NO)); + doc.Add(new StringField(A.Field, A.Text, Store.NO)); } private static void AddFacets(Document doc, FacetsConfig config, bool updateTermExpectedCounts) diff --git a/src/Lucene.Net.Tests.Misc/Index/TestMultiPassIndexSplitter.cs b/src/Lucene.Net.Tests.Misc/Index/TestMultiPassIndexSplitter.cs index a8f2e9491c..8e85271650 100644 --- a/src/Lucene.Net.Tests.Misc/Index/TestMultiPassIndexSplitter.cs +++ b/src/Lucene.Net.Tests.Misc/Index/TestMultiPassIndexSplitter.cs @@ -159,8 +159,8 @@ public void TestSplitSeq() // make sure the deleted doc is not here TermsEnum te = MultiFields.GetTerms(ir, "id").GetEnumerator(); Term t = new Term("id", (NUM_DOCS - 1) + ""); - assertEquals(TermsEnum.SeekStatus.NOT_FOUND, te.SeekCeil(new BytesRef(t.Text()))); - assertNotSame(t.Text(), te.Term.Utf8ToString()); + assertEquals(TermsEnum.SeekStatus.NOT_FOUND, te.SeekCeil(new BytesRef(t.Text))); + assertNotSame(t.Text, te.Term.Utf8ToString()); } } finally diff --git a/src/Lucene.Net.Tests.Queries/CommonTermsQueryTest.cs b/src/Lucene.Net.Tests.Queries/CommonTermsQueryTest.cs index 996763b86a..c47aad08b8 100644 --- a/src/Lucene.Net.Tests.Queries/CommonTermsQueryTest.cs +++ b/src/Lucene.Net.Tests.Queries/CommonTermsQueryTest.cs @@ -618,7 +618,7 @@ public ExtendedCommonTermsQuery(Occur highFreqOccur, Occur lowFreqOccur, float m protected override Query NewTermQuery(Term term, TermContext context) { Query query = base.NewTermQuery(term, context); - if (term.Text().Equals(@"universe", StringComparison.Ordinal)) + if (term.Text.Equals(@"universe", StringComparison.Ordinal)) { query.Boost = 100f; } diff --git a/src/Lucene.Net.Tests.Queries/Mlt/TestMoreLikeThis.cs b/src/Lucene.Net.Tests.Queries/Mlt/TestMoreLikeThis.cs index 0a5fc6245d..159443dfe8 100644 --- a/src/Lucene.Net.Tests.Queries/Mlt/TestMoreLikeThis.cs +++ b/src/Lucene.Net.Tests.Queries/Mlt/TestMoreLikeThis.cs @@ -96,12 +96,12 @@ public void TestBoostFactor() foreach (BooleanClause clause in clauses) { TermQuery tq = (TermQuery)clause.Query; - float? termBoost = originalValues[tq.Term.Text()]; - assertNotNull("Expected term " + tq.Term.Text(), termBoost); + float? termBoost = originalValues[tq.Term.Text]; + assertNotNull("Expected term " + tq.Term.Text, termBoost); float totalBoost = (float) (termBoost * boostFactor); assertEquals("Expected boost of " + totalBoost + " for term '" - + tq.Term.Text() + "' got " + tq.Boost, totalBoost, tq.Boost, 0.0001); + + tq.Term.Text + "' got " + tq.Boost, totalBoost, tq.Boost, 0.0001); } } @@ -123,7 +123,7 @@ public void TestBoostFactor() foreach (BooleanClause clause in clauses) { TermQuery tq = (TermQuery)clause.Query; - originalValues[tq.Term.Text()] = tq.Boost; + originalValues[tq.Term.Text] = tq.Boost; } return originalValues; } diff --git a/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs index 58a733745e..9d17cdb08f 100644 --- a/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs +++ b/src/Lucene.Net.Tests.QueryParser/Classic/TestQueryParser.cs @@ -233,37 +233,37 @@ public override void TestStarParsing() TermQuery tq; tq = (TermQuery)qp.Parse("foo:zoo*"); - assertEquals("zoo", tq.Term.Text()); + assertEquals("zoo", tq.Term.Text); assertEquals(2, qp.type[0]); tq = (TermQuery)qp.Parse("foo:zoo*^2"); - assertEquals("zoo", tq.Term.Text()); + assertEquals("zoo", tq.Term.Text); assertEquals(2, qp.type[0]); assertEquals(tq.Boost, 2, 0); tq = (TermQuery)qp.Parse("foo:*"); - assertEquals("*", tq.Term.Text()); + assertEquals("*", tq.Term.Text); assertEquals(1, qp.type[0]); // could be a valid prefix query in the future too tq = (TermQuery)qp.Parse("foo:*^2"); - assertEquals("*", tq.Term.Text()); + assertEquals("*", tq.Term.Text); assertEquals(1, qp.type[0]); assertEquals(tq.Boost, 2, 0); tq = (TermQuery)qp.Parse("*:foo"); assertEquals("*", tq.Term.Field); - assertEquals("foo", tq.Term.Text()); + assertEquals("foo", tq.Term.Text); assertEquals(3, qp.type[0]); tq = (TermQuery)qp.Parse("*:*"); assertEquals("*", tq.Term.Field); - assertEquals("*", tq.Term.Text()); + assertEquals("*", tq.Term.Text); assertEquals(1, qp.type[0]); // could be handled as a prefix query in the // future tq = (TermQuery)qp.Parse("(*:*)"); assertEquals("*", tq.Term.Field); - assertEquals("*", tq.Term.Text()); + assertEquals("*", tq.Term.Text); assertEquals(1, qp.type[0]); } diff --git a/src/Lucene.Net.Tests.QueryParser/Ext/TestExtendableQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Ext/TestExtendableQueryParser.cs index 9d243201e6..89f10aff06 100644 --- a/src/Lucene.Net.Tests.QueryParser/Ext/TestExtendableQueryParser.cs +++ b/src/Lucene.Net.Tests.QueryParser/Ext/TestExtendableQueryParser.cs @@ -87,7 +87,7 @@ public virtual void TestExtFieldUnqoted() TermQuery tquery = (TermQuery)query; assertEquals("aField", tquery.Term .Field); - assertEquals("foo", tquery.Term.Text()); + assertEquals("foo", tquery.Term.Text); booleanClause = clauses[1]; query = booleanClause.Query; @@ -95,7 +95,7 @@ public virtual void TestExtFieldUnqoted() query is TermQuery); tquery = (TermQuery)query; assertEquals(DefaultField, tquery.Term.Field); - assertEquals("bar", tquery.Term.Text()); + assertEquals("bar", tquery.Term.Text); } } @@ -114,7 +114,7 @@ public virtual void TestExtDefaultField() parse is TermQuery); TermQuery tquery = (TermQuery)parse; assertEquals(DefaultField, tquery.Term.Field); - assertEquals("foo & bar", tquery.Term.Text()); + assertEquals("foo & bar", tquery.Term.Text); } } @@ -138,7 +138,7 @@ public virtual void TestExtField() parse is TermQuery); TermQuery tquery = (TermQuery)parse; assertEquals("afield", tquery.Term.Field); - assertEquals("foo & bar", tquery.Term.Text()); + assertEquals("foo & bar", tquery.Term.Text); } } diff --git a/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs index 07ac1b32d8..ab710ce604 100644 --- a/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs +++ b/src/Lucene.Net.Tests/Codecs/Lucene3x/TestSurrogates.cs @@ -1,4 +1,4 @@ -using J2N.Text; +using J2N.Text; using Lucene.Net.Analysis; using Lucene.Net.Documents; using Lucene.Net.Index; @@ -78,7 +78,7 @@ private static string MakeDifficultRandomUnicodeString(Random r) private static string ToHexString(Term t) { - return t.Field + ":" + UnicodeUtil.ToHexString(t.Text()); + return t.Field + ":" + UnicodeUtil.ToHexString(t.Text); } private string GetRandomString(Random r) @@ -148,7 +148,7 @@ private void DoTestStraightEnum(IList fieldTerms, IndexReader reader, int if (Verbose) { Console.WriteLine(" got term=" + field + ":" + UnicodeUtil.ToHexString(text.Utf8ToString())); - Console.WriteLine(" exp=" + exp.Field + ":" + UnicodeUtil.ToHexString(exp.Text())); + Console.WriteLine(" exp=" + exp.Field + ":" + UnicodeUtil.ToHexString(exp.Text)); Console.WriteLine(); } if (lastText == null) @@ -195,7 +195,7 @@ private void DoTestSeekExists(Random r, IList fieldTerms, IndexReader read if (Verbose) { - Console.WriteLine("TEST: exist seek field=" + field + " term=" + UnicodeUtil.ToHexString(term.Text())); + Console.WriteLine("TEST: exist seek field=" + field + " term=" + UnicodeUtil.ToHexString(term.Text)); } // seek to it @@ -239,7 +239,7 @@ private void DoTestSeekExists(Random r, IList fieldTerms, IndexReader read if (Verbose) { Console.WriteLine(" got term=" + (t == null ? null : UnicodeUtil.ToHexString(t.Utf8ToString()))); - Console.WriteLine(" exp=" + UnicodeUtil.ToHexString(term.Text().ToString())); + Console.WriteLine(" exp=" + UnicodeUtil.ToHexString(term.Text.ToString())); } Assert.AreEqual(term.Bytes, t); @@ -271,7 +271,7 @@ private void DoTestSeekDoesNotExist(Random r, int numField, IList fieldTer { if (Verbose) { - Console.WriteLine("TEST: non-exist seek to " + field + ":" + UnicodeUtil.ToHexString(tx.Text())); + Console.WriteLine("TEST: non-exist seek to " + field + ":" + UnicodeUtil.ToHexString(tx.Text)); } // term does not exist: @@ -299,7 +299,7 @@ private void DoTestSeekDoesNotExist(Random r, int numField, IList fieldTer if (Verbose) { Console.WriteLine(" got term=" + UnicodeUtil.ToHexString(te.Term.Utf8ToString())); - Console.WriteLine(" exp term=" + UnicodeUtil.ToHexString(fieldTerms[spot].Text())); + Console.WriteLine(" exp term=" + UnicodeUtil.ToHexString(fieldTerms[spot].Text)); } Assert.AreEqual(fieldTerms[spot].Bytes, te.Term); @@ -330,7 +330,7 @@ private void DoTestSeekDoesNotExist(Random r, int numField, IList fieldTer if (Verbose) { Console.WriteLine(" got term=" + (t == null ? null : UnicodeUtil.ToHexString(t.Utf8ToString()))); - Console.WriteLine(" exp=" + UnicodeUtil.ToHexString(term.Text().ToString())); + Console.WriteLine(" exp=" + UnicodeUtil.ToHexString(term.Text.ToString())); } Assert.AreEqual(term.Bytes, t); diff --git a/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs b/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs index cab193b54a..5c0aa8b544 100644 --- a/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs +++ b/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs @@ -350,7 +350,7 @@ public virtual void TestTermVectors() internal virtual void AssertTermDocsCount(string msg, IndexReader reader, Term term, int expected) { - DocsEnum tdocs = TestUtil.Docs(Random, reader, term.Field, new BytesRef(term.Text()), MultiFields.GetLiveDocs(reader), null, 0); + DocsEnum tdocs = TestUtil.Docs(Random, reader, term.Field, new BytesRef(term.Text), MultiFields.GetLiveDocs(reader), null, 0); int count = 0; if (tdocs != null) { diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs index d90a80bc6a..c30cd0470f 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterExceptions.cs @@ -635,7 +635,7 @@ public virtual void TestExceptionFromTokenStream() // Make sure the doc that hit the exception was marked // as deleted: - DocsEnum tdocs = TestUtil.Docs(Random, reader, t.Field, new BytesRef(t.Text()), MultiFields.GetLiveDocs(reader), null, 0); + DocsEnum tdocs = TestUtil.Docs(Random, reader, t.Field, new BytesRef(t.Text), MultiFields.GetLiveDocs(reader), null, 0); int count = 0; while (tdocs.NextDoc() != DocIdSetIterator.NO_MORE_DOCS) diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs index a43ca6b78a..b368980af7 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs @@ -60,7 +60,7 @@ public class TestIndexWriterReader : LuceneTestCase public static int Count(Term t, IndexReader r) { int count = 0; - DocsEnum td = TestUtil.Docs(Random, r, t.Field, new BytesRef(t.Text()), MultiFields.GetLiveDocs(r), null, 0); + DocsEnum td = TestUtil.Docs(Random, r, t.Field, new BytesRef(t.Text), MultiFields.GetLiveDocs(r), null, 0); if (td != null) { diff --git a/src/Lucene.Net.Tests/Index/TestMultiLevelSkipList.cs b/src/Lucene.Net.Tests/Index/TestMultiLevelSkipList.cs index e2c3c29c91..d90097339f 100644 --- a/src/Lucene.Net.Tests/Index/TestMultiLevelSkipList.cs +++ b/src/Lucene.Net.Tests/Index/TestMultiLevelSkipList.cs @@ -1,4 +1,4 @@ -using J2N.Threading.Atomic; +using J2N.Threading.Atomic; using Lucene.Net.Analysis; using Lucene.Net.Analysis.TokenAttributes; using Lucene.Net.Documents; @@ -87,7 +87,7 @@ public virtual void TestSimpleSkip() for (int i = 0; i < 5000; i++) { Document d1 = new Document(); - d1.Add(NewTextField(term.Field, term.Text(), Field.Store.NO)); + d1.Add(NewTextField(term.Field, term.Text, Field.Store.NO)); writer.AddDocument(d1); } writer.Commit(); diff --git a/src/Lucene.Net.Tests/Index/TestPayloads.cs b/src/Lucene.Net.Tests/Index/TestPayloads.cs index e86af35b74..e0ebb57abc 100644 --- a/src/Lucene.Net.Tests/Index/TestPayloads.cs +++ b/src/Lucene.Net.Tests/Index/TestPayloads.cs @@ -154,7 +154,7 @@ private void PerformTest(Directory dir) StringBuilder sb = new StringBuilder(); for (int i = 0; i < terms.Length; i++) { - sb.Append(terms[i].Text()); + sb.Append(terms[i].Text); sb.Append(" "); } string content = sb.ToString(); @@ -200,7 +200,7 @@ private void PerformTest(Directory dir) var tps = new DocsAndPositionsEnum[numTerms]; for (int i = 0; i < numTerms; i++) { - tps[i] = MultiFields.GetTermPositionsEnum(reader, MultiFields.GetLiveDocs(reader), terms[i].Field, new BytesRef(terms[i].Text())); + tps[i] = MultiFields.GetTermPositionsEnum(reader, MultiFields.GetLiveDocs(reader), terms[i].Field, new BytesRef(terms[i].Text)); } while (tps[0].NextDoc() != DocIdSetIterator.NO_MORE_DOCS) @@ -231,7 +231,7 @@ private void PerformTest(Directory dir) /* * test lazy skipping */ - DocsAndPositionsEnum tp = MultiFields.GetTermPositionsEnum(reader, MultiFields.GetLiveDocs(reader), terms[0].Field, new BytesRef(terms[0].Text())); + DocsAndPositionsEnum tp = MultiFields.GetTermPositionsEnum(reader, MultiFields.GetLiveDocs(reader), terms[0].Field, new BytesRef(terms[0].Text)); tp.NextDoc(); tp.NextPosition(); // NOTE: prior rev of this test was failing to first @@ -255,7 +255,7 @@ private void PerformTest(Directory dir) /* * Test different lengths at skip points */ - tp = MultiFields.GetTermPositionsEnum(reader, MultiFields.GetLiveDocs(reader), terms[1].Field, new BytesRef(terms[1].Text())); + tp = MultiFields.GetTermPositionsEnum(reader, MultiFields.GetLiveDocs(reader), terms[1].Field, new BytesRef(terms[1].Text)); tp.NextDoc(); tp.NextPosition(); Assert.AreEqual(1, tp.GetPayload().Length, "Wrong payload length."); diff --git a/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs b/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs index 3141b3adad..1f9eaca312 100644 --- a/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs +++ b/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs @@ -249,7 +249,7 @@ public virtual int[] ToDocsArray(Term term, IBits bits, IndexReader reader) Fields fields = MultiFields.GetFields(reader); Terms cterms = fields.GetTerms(term.Field); TermsEnum ctermsEnum = cterms.GetEnumerator(); - if (ctermsEnum.SeekExact(new BytesRef(term.Text()))) + if (ctermsEnum.SeekExact(new BytesRef(term.Text))) { DocsEnum docsEnum = TestUtil.Docs(Random, ctermsEnum, bits, null, DocsFlags.NONE); return ToArray(docsEnum); diff --git a/src/Lucene.Net.Tests/Index/TestSegmentTermDocs.cs b/src/Lucene.Net.Tests/Index/TestSegmentTermDocs.cs index 2c9a3986a4..e613616e72 100644 --- a/src/Lucene.Net.Tests/Index/TestSegmentTermDocs.cs +++ b/src/Lucene.Net.Tests/Index/TestSegmentTermDocs.cs @@ -1,4 +1,4 @@ -using Lucene.Net.Documents; +using Lucene.Net.Documents; using Lucene.Net.Index.Extensions; using NUnit.Framework; using Assert = Lucene.Net.TestFramework.Assert; @@ -149,7 +149,7 @@ public virtual void TestSkipTo(int indexDivisor) IndexReader reader = DirectoryReader.Open(dir, indexDivisor); - DocsEnum tdocs = TestUtil.Docs(Random, reader, ta.Field, new BytesRef(ta.Text()), MultiFields.GetLiveDocs(reader), null, DocsFlags.FREQS); + DocsEnum tdocs = TestUtil.Docs(Random, reader, ta.Field, new BytesRef(ta.Text), MultiFields.GetLiveDocs(reader), null, DocsFlags.FREQS); // without optimization (assumption skipInterval == 16) @@ -169,7 +169,7 @@ public virtual void TestSkipTo(int indexDivisor) Assert.IsFalse(tdocs.Advance(10) != DocIdSetIterator.NO_MORE_DOCS); // without next - tdocs = TestUtil.Docs(Random, reader, ta.Field, new BytesRef(ta.Text()), MultiFields.GetLiveDocs(reader), null, 0); + tdocs = TestUtil.Docs(Random, reader, ta.Field, new BytesRef(ta.Text), MultiFields.GetLiveDocs(reader), null, 0); Assert.IsTrue(tdocs.Advance(0) != DocIdSetIterator.NO_MORE_DOCS); Assert.AreEqual(0, tdocs.DocID); @@ -182,7 +182,7 @@ public virtual void TestSkipTo(int indexDivisor) // exactly skipInterval documents and therefore with optimization // with next - tdocs = TestUtil.Docs(Random, reader, tb.Field, new BytesRef(tb.Text()), MultiFields.GetLiveDocs(reader), null, DocsFlags.FREQS); + tdocs = TestUtil.Docs(Random, reader, tb.Field, new BytesRef(tb.Text), MultiFields.GetLiveDocs(reader), null, DocsFlags.FREQS); Assert.IsTrue(tdocs.NextDoc() != DocIdSetIterator.NO_MORE_DOCS); Assert.AreEqual(10, tdocs.DocID); @@ -201,7 +201,7 @@ public virtual void TestSkipTo(int indexDivisor) Assert.IsFalse(tdocs.Advance(26) != DocIdSetIterator.NO_MORE_DOCS); // without next - tdocs = TestUtil.Docs(Random, reader, tb.Field, new BytesRef(tb.Text()), MultiFields.GetLiveDocs(reader), null, DocsFlags.FREQS); + tdocs = TestUtil.Docs(Random, reader, tb.Field, new BytesRef(tb.Text), MultiFields.GetLiveDocs(reader), null, DocsFlags.FREQS); Assert.IsTrue(tdocs.Advance(5) != DocIdSetIterator.NO_MORE_DOCS); Assert.AreEqual(10, tdocs.DocID); @@ -216,7 +216,7 @@ public virtual void TestSkipTo(int indexDivisor) // much more than skipInterval documents and therefore with optimization // with next - tdocs = TestUtil.Docs(Random, reader, tc.Field, new BytesRef(tc.Text()), MultiFields.GetLiveDocs(reader), null, DocsFlags.FREQS); + tdocs = TestUtil.Docs(Random, reader, tc.Field, new BytesRef(tc.Text), MultiFields.GetLiveDocs(reader), null, DocsFlags.FREQS); Assert.IsTrue(tdocs.NextDoc() != DocIdSetIterator.NO_MORE_DOCS); Assert.AreEqual(26, tdocs.DocID); @@ -237,7 +237,7 @@ public virtual void TestSkipTo(int indexDivisor) Assert.IsFalse(tdocs.Advance(76) != DocIdSetIterator.NO_MORE_DOCS); //without next - tdocs = TestUtil.Docs(Random, reader, tc.Field, new BytesRef(tc.Text()), MultiFields.GetLiveDocs(reader), null, 0); + tdocs = TestUtil.Docs(Random, reader, tc.Field, new BytesRef(tc.Text), MultiFields.GetLiveDocs(reader), null, 0); Assert.IsTrue(tdocs.Advance(5) != DocIdSetIterator.NO_MORE_DOCS); Assert.AreEqual(26, tdocs.DocID); Assert.IsTrue(tdocs.Advance(40) != DocIdSetIterator.NO_MORE_DOCS); diff --git a/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs b/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs index f0bfe54dee..2b011dede2 100644 --- a/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs +++ b/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs @@ -1,4 +1,4 @@ -using Lucene.Net.Documents; +using Lucene.Net.Documents; using NUnit.Framework; using System; using System.Diagnostics; @@ -190,7 +190,7 @@ private void CheckBooleanQueryBoosts(BooleanQuery bq) foreach (BooleanClause clause in bq.Clauses) { TermQuery mtq = (TermQuery)clause.Query; - Assert.AreEqual(Convert.ToSingle(mtq.Term.Text()), mtq.Boost, 0, "Parallel sorting of boosts in rewrite mode broken"); + Assert.AreEqual(Convert.ToSingle(mtq.Term.Text), mtq.Boost, 0, "Parallel sorting of boosts in rewrite mode broken"); } } diff --git a/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs b/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs index 799a8b7036..21c1509f9e 100644 --- a/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs +++ b/src/Lucene.Net.Tests/Search/TestRegexpRandom2.cs @@ -116,7 +116,7 @@ private class DumbRegexpQuery : MultiTermQuery internal DumbRegexpQuery(Term term, RegExpSyntax flags) : base(term.Field) { - RegExp re = new RegExp(term.Text(), flags); + RegExp re = new RegExp(term.Text, flags); automaton = re.ToAutomaton(); } diff --git a/src/Lucene.Net.Tests/Search/TestScorerPerf.cs b/src/Lucene.Net.Tests/Search/TestScorerPerf.cs index 00339b222e..89b2062911 100644 --- a/src/Lucene.Net.Tests/Search/TestScorerPerf.cs +++ b/src/Lucene.Net.Tests/Search/TestScorerPerf.cs @@ -82,7 +82,7 @@ public virtual void CreateRandomTerms(int nDocs, int nTerms, double power, Direc { if (Random.Next(freq[j]) == 0) { - d.Add(NewStringField("f", terms[j].Text(), Field.Store.NO)); + d.Add(NewStringField("f", terms[j].Text, Field.Store.NO)); //System.out.println(d); } } diff --git a/src/Lucene.Net.Tests/Search/TestTermRangeQuery.cs b/src/Lucene.Net.Tests/Search/TestTermRangeQuery.cs index 13c1bacb3d..2f70464dc4 100644 --- a/src/Lucene.Net.Tests/Search/TestTermRangeQuery.cs +++ b/src/Lucene.Net.Tests/Search/TestTermRangeQuery.cs @@ -1,4 +1,4 @@ -using Lucene.Net.Analysis; +using Lucene.Net.Analysis; using Lucene.Net.Analysis.TokenAttributes; using Lucene.Net.Documents; using Lucene.Net.Index.Extensions; @@ -169,7 +169,7 @@ private void CheckBooleanTerms(IndexSearcher searcher, TermRangeQuery query, par { Assert.IsTrue(c.Query is TermQuery); TermQuery tq = (TermQuery)c.Query; - string term = tq.Term.Text(); + string term = tq.Term.Text; Assert.IsTrue(allowedTerms.Contains(term), "invalid term: " + term); allowedTerms.Remove(term); // remove to fail on double terms } diff --git a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs index 385a1c72a5..68a210d890 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/Lucene3xFields.cs @@ -1,4 +1,4 @@ -using J2N.Text; +using J2N.Text; using Lucene.Net.Diagnostics; using Lucene.Net.Index; using Lucene.Net.Util; @@ -358,7 +358,7 @@ private bool SeekToNonBMP(SegmentTermEnum te, BytesRef term, int pos) if (DEBUG_SURROGATES) { - Console.WriteLine(" got term=" + UnicodeUtil.ToHexString(t2.Text())); + Console.WriteLine(" got term=" + UnicodeUtil.ToHexString(t2.Text)); } // Now test if prefix is identical and we found @@ -497,7 +497,7 @@ private bool DoPop() { if (DEBUG_SURROGATES) { - Console.WriteLine(" got term=" + UnicodeUtil.ToHexString(t2.Text()) + " " + t2.Bytes); + Console.WriteLine(" got term=" + UnicodeUtil.ToHexString(t2.Text) + " " + t2.Bytes); } BytesRef b2 = t2.Bytes; @@ -696,7 +696,7 @@ private void DoPushes() } else { - Console.WriteLine($" hit term={UnicodeUtil.ToHexString(t2.Text())} {t2?.Bytes}"); + Console.WriteLine($" hit term={UnicodeUtil.ToHexString(t2.Text)} {t2?.Bytes}"); } } @@ -908,7 +908,7 @@ public override SeekStatus SeekCeil(BytesRef term) if (DEBUG_SURROGATES) { - Console.WriteLine(" seek hit non-exact term=" + UnicodeUtil.ToHexString(t.Text())); + Console.WriteLine(" seek hit non-exact term=" + UnicodeUtil.ToHexString(t.Text)); } BytesRef br = t.Bytes; diff --git a/src/Lucene.Net/Codecs/Lucene3x/TermInfosReaderIndex.cs b/src/Lucene.Net/Codecs/Lucene3x/TermInfosReaderIndex.cs index e70b092730..efea428072 100644 --- a/src/Lucene.Net/Codecs/Lucene3x/TermInfosReaderIndex.cs +++ b/src/Lucene.Net/Codecs/Lucene3x/TermInfosReaderIndex.cs @@ -92,7 +92,7 @@ public TermInfosReaderIndex(SegmentTermEnum indexEnum, int indexDivisor, long ti TermInfo termInfo = indexEnum.TermInfo(); indexToTerms.Set(i, dataOutput.GetPosition()); dataOutput.WriteVInt32(fieldCounter); - dataOutput.WriteString(term.Text()); + dataOutput.WriteString(term.Text); dataOutput.WriteVInt32(termInfo.DocFreq); if (termInfo.DocFreq >= skipInterval) { diff --git a/src/Lucene.Net/Index/Term.cs b/src/Lucene.Net/Index/Term.cs index 34bc92c1ea..98d792ae64 100644 --- a/src/Lucene.Net/Index/Term.cs +++ b/src/Lucene.Net/Index/Term.cs @@ -84,10 +84,7 @@ public Term(string fld) /// text of the word. In the case of dates and other types, this is an /// encoding of the object as a string. /// - public string Text() // LUCENENET TODO: API - Change to a property. While this calls a method internally, its expected usage is that it will return a deterministic value. - { - return ToString(Bytes); - } + public string Text => ToString(Bytes); // LUCENENET: Changed to a property. While this calls a method internally, its expected usage is that it will return a deterministic value. /// /// Returns human-readable form of the term text. If the term is not unicode, @@ -193,7 +190,7 @@ public bool Equals(Term other) public override string ToString() { - return Field + ":" + Text(); + return Field + ":" + Text; } } } \ No newline at end of file diff --git a/src/Lucene.Net/Search/FuzzyQuery.cs b/src/Lucene.Net/Search/FuzzyQuery.cs index 5c70213841..7fe864bf1f 100644 --- a/src/Lucene.Net/Search/FuzzyQuery.cs +++ b/src/Lucene.Net/Search/FuzzyQuery.cs @@ -148,7 +148,7 @@ public FuzzyQuery(Term term) protected override TermsEnum GetTermsEnum(Terms terms, AttributeSource atts) { - if (maxEdits == 0 || prefixLength >= term.Text().Length) // can only match if it's exact + if (maxEdits == 0 || prefixLength >= term.Text.Length) // can only match if it's exact { return new SingleTermsEnum(terms.GetEnumerator(), term.Bytes); } @@ -168,7 +168,7 @@ public override string ToString(string field) buffer.Append(term.Field); buffer.Append(":"); } - buffer.Append(term.Text()); + buffer.Append(term.Text); buffer.Append('~'); buffer.Append(Convert.ToString(maxEdits)); buffer.Append(ToStringUtils.Boost(Boost)); diff --git a/src/Lucene.Net/Search/FuzzyTermsEnum.cs b/src/Lucene.Net/Search/FuzzyTermsEnum.cs index c28eeeb98b..97c9f01920 100644 --- a/src/Lucene.Net/Search/FuzzyTermsEnum.cs +++ b/src/Lucene.Net/Search/FuzzyTermsEnum.cs @@ -124,7 +124,7 @@ public FuzzyTermsEnum(Terms terms, AttributeSource atts, Term term, float minSim this.term = term; // convert the string into a utf32 int[] representation for fast comparisons - string utf16 = term.Text(); + string utf16 = term.Text; this.m_termText = new int[utf16.CodePointCount(0, utf16.Length)]; for (int cp, i = 0, j = 0; i < utf16.Length; i += Character.CharCount(cp)) { @@ -375,7 +375,7 @@ public AutomatonFuzzyTermsEnum(FuzzyTermsEnum outerInstance, TermsEnum tenum, Co { this.matchers[i] = compiled[i].RunAutomaton; } - termRef = new BytesRef(outerInstance.term.Text()); + termRef = new BytesRef(outerInstance.term.Text); } /// diff --git a/src/Lucene.Net/Search/MultiPhraseQuery.cs b/src/Lucene.Net/Search/MultiPhraseQuery.cs index 37105ccf14..44804425b7 100644 --- a/src/Lucene.Net/Search/MultiPhraseQuery.cs +++ b/src/Lucene.Net/Search/MultiPhraseQuery.cs @@ -285,7 +285,7 @@ public override Scorer GetScorer(AtomicReaderContext context, IBits acceptDocs) { // term does exist, but has no positions if (Debugging.AssertsEnabled) Debugging.Assert(termsEnum.Docs(liveDocs, null, DocsFlags.NONE) != null, "termstate found but no term exists in reader"); - throw IllegalStateException.Create("field \"" + term.Field + "\" was indexed without position data; cannot run PhraseQuery (term=" + term.Text() + ")"); + throw IllegalStateException.Create("field \"" + term.Field + "\" was indexed without position data; cannot run PhraseQuery (term=" + term.Text + ")"); } docFreq = termsEnum.DocFreq; @@ -407,7 +407,7 @@ public override sealed string ToString(string f) buffer.Append("("); for (int j = 0; j < terms.Length; j++) { - buffer.Append(terms[j].Text()); + buffer.Append(terms[j].Text); if (j < terms.Length - 1) { buffer.Append(" "); @@ -417,7 +417,7 @@ public override sealed string ToString(string f) } else { - buffer.Append(terms[0].Text()); + buffer.Append(terms[0].Text); } lastPos = position; ++k; @@ -621,7 +621,7 @@ public UnionDocsAndPositionsEnum(IBits liveDocs, AtomicReaderContext context, Te if (postings == null) { // term does exist, but has no positions - throw IllegalStateException.Create("field \"" + term.Field + "\" was indexed without position data; cannot run PhraseQuery (term=" + term.Text() + ")"); + throw IllegalStateException.Create("field \"" + term.Field + "\" was indexed without position data; cannot run PhraseQuery (term=" + term.Text + ")"); } _cost += postings.GetCost(); docsEnums.Add(postings); diff --git a/src/Lucene.Net/Search/PhraseQuery.cs b/src/Lucene.Net/Search/PhraseQuery.cs index 80bdf224a4..4160b079dc 100644 --- a/src/Lucene.Net/Search/PhraseQuery.cs +++ b/src/Lucene.Net/Search/PhraseQuery.cs @@ -369,7 +369,7 @@ public override Scorer GetScorer(AtomicReaderContext context, IBits acceptDocs) { if (Debugging.AssertsEnabled) Debugging.Assert(te.SeekExact(t.Bytes), "termstate found but no term exists in reader"); // term does exist, but has no positions - throw IllegalStateException.Create("field \"" + t.Field + "\" was indexed without position data; cannot run PhraseQuery (term=" + t.Text() + ")"); + throw IllegalStateException.Create("field \"" + t.Field + "\" was indexed without position data; cannot run PhraseQuery (term=" + t.Text + ")"); } postingsFreqs[i] = new PostingsAndFreq(postingsEnum, te.DocFreq, (int)outerInstance.positions[i], t); } @@ -458,11 +458,11 @@ public override string ToString(string f) string s = pieces[pos]; if (s == null) { - s = (terms[i]).Text(); + s = terms[i].Text; } else { - s = s + "|" + (terms[i]).Text(); + s = s + "|" + terms[i].Text; } pieces[pos] = s; } diff --git a/src/Lucene.Net/Search/PrefixQuery.cs b/src/Lucene.Net/Search/PrefixQuery.cs index 3c4fef7a79..cf4ef5721a 100644 --- a/src/Lucene.Net/Search/PrefixQuery.cs +++ b/src/Lucene.Net/Search/PrefixQuery.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; namespace Lucene.Net.Search @@ -72,7 +72,7 @@ public override string ToString(string field) buffer.Append(Field); buffer.Append(":"); } - buffer.Append(_prefix.Text()); + buffer.Append(_prefix.Text); buffer.Append('*'); buffer.Append(ToStringUtils.Boost(Boost)); return buffer.ToString(); diff --git a/src/Lucene.Net/Search/RegexpQuery.cs b/src/Lucene.Net/Search/RegexpQuery.cs index 53c57c309b..a488d7e78d 100644 --- a/src/Lucene.Net/Search/RegexpQuery.cs +++ b/src/Lucene.Net/Search/RegexpQuery.cs @@ -1,4 +1,4 @@ -using Lucene.Net.Util.Automaton; +using Lucene.Net.Util.Automaton; using System; using System.Text; @@ -93,7 +93,7 @@ public RegexpQuery(Term term, RegExpSyntax flags) /// Optional features from /// Custom for named automata public RegexpQuery(Term term, RegExpSyntax flags, IAutomatonProvider provider) - : base(term, (new RegExp(term.Text(), flags)).ToAutomaton(provider)) + : base(term, (new RegExp(term.Text, flags)).ToAutomaton(provider)) { } @@ -108,7 +108,7 @@ public override string ToString(string field) buffer.Append(":"); } buffer.Append('/'); - buffer.Append(m_term.Text()); + buffer.Append(m_term.Text); buffer.Append('/'); buffer.Append(ToStringUtils.Boost(Boost)); return buffer.ToString(); diff --git a/src/Lucene.Net/Search/Spans/SpanTermQuery.cs b/src/Lucene.Net/Search/Spans/SpanTermQuery.cs index dd374e135d..4ae350da64 100644 --- a/src/Lucene.Net/Search/Spans/SpanTermQuery.cs +++ b/src/Lucene.Net/Search/Spans/SpanTermQuery.cs @@ -1,4 +1,4 @@ -using Lucene.Net.Index; +using Lucene.Net.Index; using System; using System.Collections.Generic; using System.Text; @@ -62,7 +62,7 @@ public override string ToString(string field) StringBuilder buffer = new StringBuilder(); if (m_term.Field.Equals(field, StringComparison.Ordinal)) { - buffer.Append(m_term.Text()); + buffer.Append(m_term.Text); } else { @@ -164,7 +164,7 @@ public override Spans GetSpans(AtomicReaderContext context, IBits acceptDocs, ID else { // term does exist, but has no positions - throw IllegalStateException.Create("field \"" + m_term.Field + "\" was indexed without position data; cannot run SpanTermQuery (term=" + m_term.Text() + ")"); + throw IllegalStateException.Create("field \"" + m_term.Field + "\" was indexed without position data; cannot run SpanTermQuery (term=" + m_term.Text + ")"); } } } diff --git a/src/Lucene.Net/Search/TermQuery.cs b/src/Lucene.Net/Search/TermQuery.cs index 3d909b96f0..e9bb64607e 100644 --- a/src/Lucene.Net/Search/TermQuery.cs +++ b/src/Lucene.Net/Search/TermQuery.cs @@ -1,4 +1,4 @@ -using Lucene.Net.Diagnostics; +using Lucene.Net.Diagnostics; using System; using System.Collections.Generic; using System.Text; @@ -219,7 +219,7 @@ public override string ToString(string field) buffer.Append(term.Field); buffer.Append(":"); } - buffer.Append(term.Text()); + buffer.Append(term.Text); buffer.Append(ToStringUtils.Boost(Boost)); return buffer.ToString(); } diff --git a/src/Lucene.Net/Search/WildcardQuery.cs b/src/Lucene.Net/Search/WildcardQuery.cs index bebb34c3f3..8c7c22ae98 100644 --- a/src/Lucene.Net/Search/WildcardQuery.cs +++ b/src/Lucene.Net/Search/WildcardQuery.cs @@ -1,4 +1,4 @@ -using J2N; +using J2N; using System; using System.Collections.Generic; using System.Text; @@ -73,7 +73,7 @@ public static Automaton ToAutomaton(Term wildcardquery) { IList automata = new List(); - string wildcardText = wildcardquery.Text(); + string wildcardText = wildcardquery.Text; for (int i = 0; i < wildcardText.Length; ) { @@ -124,7 +124,7 @@ public override string ToString(string field) buffer.Append(Field); buffer.Append(":"); } - buffer.Append(Term.Text()); + buffer.Append(Term.Text); buffer.Append(ToStringUtils.Boost(Boost)); return buffer.ToString(); } diff --git a/src/Lucene.Net/Support/ObsoleteAPI/TermExtensions.cs b/src/Lucene.Net/Support/ObsoleteAPI/TermExtensions.cs new file mode 100644 index 0000000000..98a8b4989a --- /dev/null +++ b/src/Lucene.Net/Support/ObsoleteAPI/TermExtensions.cs @@ -0,0 +1,35 @@ +using System; + +namespace Lucene.Net.Index +{ + /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + public static class TermExtensions + { + /// + /// Returns the text of this term. In the case of words, this is simply the + /// text of the word. In the case of dates and other types, this is an + /// encoding of the object as a string. + /// + [Obsolete("Use Text property instead. This method will be removed in 4.8.0 release candidate."), System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public static string Text(this Term term) + { + return term.Text; + } + } +}