Lucene.Net.Index.IndexReader.Dispose C# (CSharp) Méthode

Dispose() public méthode

Closes files associated with this index. Also saves any new deletions to disk. No other methods should be called after this has been called.
public Dispose ( ) : void
Résultat void
        public void Dispose()
        {
            Dispose(true);
        }

Same methods

IndexReader::Dispose ( bool disposing ) : void

Usage Example

Exemple #1
0
        public virtual void TestIndexedBit()
        {
            using Directory dir = NewDirectory();
            IndexReader r = null;

            try
            {
                using (RandomIndexWriter w = new RandomIndexWriter(Random, dir))
                {
                    Document  doc        = new Document();
                    FieldType onlyStored = new FieldType();
                    onlyStored.IsStored = true;
                    doc.Add(new Field("field", "value", onlyStored));
                    doc.Add(new StringField("field2", "value", Field.Store.YES));
                    w.AddDocument(doc);
                    r = w.GetReader();
                } // w.Dispose();
                Assert.IsFalse(r.Document(0).GetField("field").IndexableFieldType.IsIndexed);
                Assert.IsTrue(r.Document(0).GetField("field2").IndexableFieldType.IsIndexed);
            }
            finally
            {
                r?.Dispose();
            }
        }
All Usage Examples Of Lucene.Net.Index.IndexReader::Dispose