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

Terms() public abstract method

Returns an enumeration of all the terms in the index. The enumeration is ordered by Term.compareTo(). Each term is greater than all that precede it in the enumeration. Note that after calling terms(), TermEnum.Next() must be called on the resulting enumeration before calling other methods such as TermEnum.Term.
public abstract Terms ( ) : TermEnum
return TermEnum
		public abstract TermEnum Terms();
		

Same methods

IndexReader::Terms ( Term t ) : 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