An always exhausted token stream
Inheritance: TokenStream
 public void Test()
 {
     TokenStream ts = new EmptyTokenStream();
     Assert.False(ts.IncrementToken());
     ts.Reset();
     Assert.False(ts.IncrementToken());
 }
 public virtual void TestConsume()
 {
     TokenStream ts = new EmptyTokenStream();
     ts.Reset();
     assertFalse(ts.IncrementToken());
     ts.End();
     ts.Dispose();
     // try again with reuse:
     ts.Reset();
     assertFalse(ts.IncrementToken());
     ts.End();
     ts.Dispose();
 }
Exemple #3
0
        public virtual void TestConsume()
        {
            TokenStream ts = new EmptyTokenStream();

            ts.Reset();
            assertFalse(ts.IncrementToken());
            ts.End();
            ts.Dispose();
            // try again with reuse:
            ts.Reset();
            assertFalse(ts.IncrementToken());
            ts.End();
            ts.Dispose();
        }
        public virtual void TestIndexWriter_LUCENE4656()
        {
            Store.Directory directory = NewDirectory();
            IndexWriter writer = new IndexWriter(directory, NewIndexWriterConfig(TEST_VERSION_CURRENT, null));

            TokenStream ts = new EmptyTokenStream();
            assertFalse(ts.HasAttribute<ITermToBytesRefAttribute>());

            Document doc = new Document();
            doc.Add(new StringField("id", "0", Field.Store.YES));
            doc.Add(new TextField("description", ts));

            // this should not fail because we have no TermToBytesRefAttribute
            writer.AddDocument(doc);

            assertEquals(1, writer.NumDocs());

            writer.Dispose();
            directory.Dispose();
        }
Exemple #5
0
        public virtual void TestIndexWriter_LUCENE4656()
        {
            Store.Directory directory = NewDirectory();
            IndexWriter     writer    = new IndexWriter(directory, NewIndexWriterConfig(TEST_VERSION_CURRENT, null));

            TokenStream ts = new EmptyTokenStream();

            assertFalse(ts.HasAttribute <ITermToBytesRefAttribute>());

            Document doc = new Document();

            doc.Add(new StringField("id", "0", Field.Store.YES));
            doc.Add(new TextField("description", ts));

            // this should not fail because we have no TermToBytesRefAttribute
            writer.AddDocument(doc);

            assertEquals(1, writer.NumDocs);

            writer.Dispose();
            directory.Dispose();
        }