コード例 #1
0
        public async Task CannotWriteTwoLuceneIndexesOnSameStore()
        {
            var docs = CreateIpsumDocs(1);
            await _indexer.WriteToIndex(docs, true).ConfigureAwait(false);

            var store = new SecureStore(_store);

            using (var indexer2 = new LuceneIndex(store, "testindexer", "basePath", null))
            {
                Assert.ThrowsAsync <LockObtainFailedException>(() =>
                {
                    return(indexer2.WriteToIndex(docs));
                });
            }
        }
コード例 #2
0
        public void RecreatingWriterDoesNotRefreshIndex()
        {
            LeoTrace.WriteLine = Console.WriteLine;

            _indexer.WriteToIndex(CreateIpsumDocs(3), true).Wait();
            _indexer.Dispose();
            _indexer = new LuceneIndex(new SecureStore(_store), "testindexer", "basePath", null);
            _indexer.WriteToIndex(CreateIpsumDocs(3), true).Wait();
            _indexer.Dispose();
            _indexer = new LuceneIndex(new SecureStore(_store), "testindexer", "basePath", null);

            var number = _indexer.SearchDocuments(s => s.Search(new MatchAllDocsQuery(), int.MaxValue)).Count();

            Assert.AreEqual(6, number);
        }
コード例 #3
0
        public void RecreatingWriterDoesNotRefreshIndex()
        {
            LeoTrace.WriteLine = Console.WriteLine;

            _indexer.WriteToIndex(CreateIpsumDocs(3), true).Wait();
            _indexer.Dispose();
            _indexer = new LuceneIndex(new SecureStore(_store), "testindexer", "basePath", null);
            _indexer.WriteToIndex(CreateIpsumDocs(3), true).Wait();
            _indexer.Dispose();
            _indexer = new LuceneIndex(new SecureStore(_store), "testindexer", "basePath", null);

            var number = _indexer.SearchDocuments(s => s.Search(new MatchAllDocsQuery(), int.MaxValue)).Count();
            Assert.AreEqual(6, number);
        }