コード例 #1
0
ファイル: LuceneIndexTests.cs プロジェクト: tvarshney/Examine
        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
ファイル: LuceneIndexTests.cs プロジェクト: tvarshney/Examine
        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());
                }
        }