Lucene.Net.Index.IndexReader.Terms C# (CSharp) Method

Terms() public abstract method

Returns an enumeration of all terms starting at a given term. If the given term does not exist, the enumeration is positioned at the first term greater than the supplied term. The enumeration is ordered by Term.compareTo(). Each term is greater than all that precede it in the enumeration.
public abstract Terms ( Term t ) : TermEnum
t Term
return TermEnum
		public abstract TermEnum Terms(Term t);
		

Same methods

IndexReader::Terms ( ) : TermEnum

Usage Example

Example #1
0
        private void  VerifyDocFreq()
        {
            IndexReader reader   = IndexReader.Open(dir);
            TermEnum    termEnum = null;

            // create enumeration of all terms
            termEnum = reader.Terms();
            // go to the first term (aaa)
            termEnum.Next();
            // assert that term is 'aaa'
            Assert.AreEqual("aaa", termEnum.Term().Text());
            Assert.AreEqual(200, termEnum.DocFreq());
            // go to the second term (bbb)
            termEnum.Next();
            // assert that term is 'bbb'
            Assert.AreEqual("bbb", termEnum.Term().Text());
            Assert.AreEqual(100, termEnum.DocFreq());

            termEnum.Close();


            // create enumeration of terms after term 'aaa', including 'aaa'
            termEnum = reader.Terms(new Term("content", "aaa"));
            // assert that term is 'aaa'
            Assert.AreEqual("aaa", termEnum.Term().Text());
            Assert.AreEqual(200, termEnum.DocFreq());
            // go to term 'bbb'
            termEnum.Next();
            // assert that term is 'bbb'
            Assert.AreEqual("bbb", termEnum.Term().Text());
            Assert.AreEqual(100, termEnum.DocFreq());

            termEnum.Close();
        }
All Usage Examples Of Lucene.Net.Index.IndexReader::Terms