Пример #1
0
        public void Can_Delete()
        {
            using (var luceneDir = new RandomIdRAMDirectory())
                using (var indexer = new TestIndex(luceneDir, new StandardAnalyzer(Version.LUCENE_30)))
                {
                    for (var i = 0; i < 10; i++)
                    {
                        indexer.IndexItem(new ValueSet(i.ToString(), "content",
                                                       new Dictionary <string, IEnumerable <object> >
                        {
                            { "item1", new List <object>(new[] { "value1" }) },
                            { "item2", new List <object>(new[] { "value2" }) }
                        }));
                    }
                    indexer.DeleteFromIndex("9");

                    var indexWriter = indexer.GetIndexWriter();
                    var reader      = indexWriter.GetReader();
                    Assert.AreEqual(9, reader.NumDocs());
                }
        }