Пример #1
0
        public void AnItemCanBeAddedToTheIndex()
        {
            TestDataGenerator tdg       = new TestDataGenerator();
            Directory         directory = new RAMDirectory();
            Analyzer          analyzer  = new StandardAnalyzer(Lucene.Net.Util.LuceneVersion.LUCENE_48);

            _indexer = new LuceneIndexer(directory, analyzer);
            _indexer.CreateIndex(tdg.AllData);
            Assert.Equal(2000, _indexer.Count());

            _indexer.Add(tdg.ANewUser());

            Assert.Equal(2001, _indexer.Count());
            directory.ClearLock("write.lock");
        }
Пример #2
0
        public void AnIndexCanBeDeleted()
        {
            TestDataGenerator tdg       = new TestDataGenerator();
            Directory         directory = new RAMDirectory();
            Analyzer          analyzer  = new StandardAnalyzer(Lucene.Net.Util.LuceneVersion.LUCENE_48);

            _indexer = new LuceneIndexer(directory, analyzer);
            _indexer.CreateIndex(tdg.AllData);
            Assert.Equal(2000, _indexer.Count());

            _indexer.DeleteAll();

            Assert.Equal(0, _indexer.Count());
            directory.ClearLock("write.lock");
            analyzer.Dispose();
            directory.Dispose();
        }
Пример #3
0
        public void AnItemCanBeRemovedFromTheIndex()
        {
            TestDataGenerator tdg       = new TestDataGenerator();
            Directory         directory = new RAMDirectory();
            Analyzer          analyzer  = new StandardAnalyzer(Lucene.Net.Util.LuceneVersion.LUCENE_48);

            _indexer = new LuceneIndexer(directory, analyzer);
            _indexer.CreateIndex(tdg.AllData);
            _indexer.Delete(tdg.AllData.First());
            Assert.True(tdg.AllData.Count > _indexer.Count());
            directory.ClearLock("write.lock");
        }
Пример #4
0
 public void AnIndexCanBeCreated()
 {
     Assert.AreEqual(2000, indexer.Count());
 }