internal LuceneBatchInserterIndex(File dbStoreDir, IndexIdentifier identifier, IDictionary <string, string> config, RelationshipLookup relationshipLookup) { File storeDir = GetStoreDir(dbStoreDir); this._createdNow = !LuceneDataSource.GetFileDirectory(storeDir, identifier).exists(); this._identifier = identifier; this._type = IndexType.GetIndexType(config); this._relationshipLookup = relationshipLookup; this._writer = InstantiateWriter(storeDir); this._searcherManager = InstantiateSearcherManager(_writer); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void indexDeleteShouldDeleteDirectory() public virtual void IndexDeleteShouldDeleteDirectory() { string indexName = "index"; string otherIndexName = "other-index"; File indexBaseDir = new File(TestDirectory.databaseDir(), "index"); File pathToLuceneIndex = LuceneDataSource.GetFileDirectory(indexBaseDir, new IndexIdentifier(IndexEntityType.Node, indexName)); File pathToOtherLuceneIndex = LuceneDataSource.GetFileDirectory(indexBaseDir, new IndexIdentifier(IndexEntityType.Node, otherIndexName)); Index <Node> index; using (Transaction tx = _db.beginTx()) { index = _db.index().forNodes(indexName); Index <Node> otherIndex = _db.index().forNodes(otherIndexName); Node node = _db.createNode(); index.Add(node, "someKey", "someValue"); otherIndex.Add(node, "someKey", "someValue"); tx.Success(); } // Here "index" and "other-index" indexes should exist assertTrue(pathToLuceneIndex.exists()); assertTrue(pathToOtherLuceneIndex.exists()); using (Transaction tx = _db.beginTx()) { index.Delete(); assertTrue(pathToLuceneIndex.exists()); assertTrue(pathToOtherLuceneIndex.exists()); tx.Success(); } // Here only "other-index" should exist assertFalse(pathToLuceneIndex.exists()); assertTrue(pathToOtherLuceneIndex.exists()); }