예제 #1
0
        public void Rebuild_Index()
        {
            using (var d = new RandomIdRAMDirectory())
                using (var indexer = new TestIndex(d, new StandardAnalyzer(Version.LUCENE_30)))
                {
                    indexer.CreateIndex();
                    indexer.IndexItems(indexer.AllData());

                    var indexWriter = indexer.GetIndexWriter();
                    var reader      = indexWriter.GetReader();
                    Assert.AreEqual(100, reader.NumDocs());
                }
        }
예제 #2
0
        public void Can_Add_One_Document()
        {
            using (var luceneDir = new RandomIdRAMDirectory())
                using (var indexer = new TestIndex(luceneDir, new StandardAnalyzer(Version.LUCENE_30)))
                {
                    indexer.IndexItem(new ValueSet(1.ToString(), "content",
                                                   new Dictionary <string, IEnumerable <object> >
                    {
                        { "item1", new List <object>(new[] { "value1" }) },
                        { "item2", new List <object>(new[] { "value2" }) }
                    }));

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