Search in sources :

Example 1 with SchemaIndexProviderMap

use of org.neo4j.kernel.impl.api.index.SchemaIndexProviderMap in project neo4j by neo4j.

the class MultiIndexPopulationConcurrentUpdatesIT method launchCustomIndexPopulation.

private void launchCustomIndexPopulation(Map<String, Integer> labelNameIdMap, int propertyId, List<NodeUpdates> updates) throws Exception {
    NeoStores neoStores = getNeoStores();
    LabelScanStore labelScanStore = getLabelScanStore();
    ThreadToStatementContextBridge transactionStatementContextBridge = getTransactionStatementContextBridge();
    try (Transaction transaction = embeddedDatabase.beginTx()) {
        Statement statement = transactionStatementContextBridge.get();
        DynamicIndexStoreView storeView = new DynamicIndexStoreViewWrapper(labelScanStore, LockService.NO_LOCK_SERVICE, neoStores, updates);
        SchemaIndexProviderMap providerMap = new DefaultSchemaIndexProviderMap(getSchemaIndexProvider());
        JobScheduler scheduler = getJobScheduler();
        StatementTokenNameLookup tokenNameLookup = new StatementTokenNameLookup(statement.readOperations());
        indexService = IndexingServiceFactory.createIndexingService(Config.empty(), scheduler, providerMap, storeView, tokenNameLookup, getIndexRules(neoStores), NullLogProvider.getInstance(), IndexingService.NO_MONITOR, () -> {
        });
        indexService.start();
        IndexRule[] rules = createIndexRules(labelNameIdMap, propertyId);
        indexService.createIndexes(rules);
        transaction.success();
    }
}
Also used : JobScheduler(org.neo4j.kernel.impl.util.JobScheduler) IndexRule(org.neo4j.kernel.impl.store.record.IndexRule) LabelScanStore(org.neo4j.kernel.api.labelscan.LabelScanStore) StatementTokenNameLookup(org.neo4j.kernel.api.StatementTokenNameLookup) Statement(org.neo4j.kernel.api.Statement) DefaultSchemaIndexProviderMap(org.neo4j.kernel.impl.transaction.state.DefaultSchemaIndexProviderMap) ThreadToStatementContextBridge(org.neo4j.kernel.impl.core.ThreadToStatementContextBridge) DynamicIndexStoreView(org.neo4j.kernel.impl.transaction.state.storeview.DynamicIndexStoreView) DefaultSchemaIndexProviderMap(org.neo4j.kernel.impl.transaction.state.DefaultSchemaIndexProviderMap) SchemaIndexProviderMap(org.neo4j.kernel.impl.api.index.SchemaIndexProviderMap) Transaction(org.neo4j.graphdb.Transaction) NeoStores(org.neo4j.kernel.impl.store.NeoStores)

Aggregations

Transaction (org.neo4j.graphdb.Transaction)1 Statement (org.neo4j.kernel.api.Statement)1 StatementTokenNameLookup (org.neo4j.kernel.api.StatementTokenNameLookup)1 LabelScanStore (org.neo4j.kernel.api.labelscan.LabelScanStore)1 SchemaIndexProviderMap (org.neo4j.kernel.impl.api.index.SchemaIndexProviderMap)1 ThreadToStatementContextBridge (org.neo4j.kernel.impl.core.ThreadToStatementContextBridge)1 NeoStores (org.neo4j.kernel.impl.store.NeoStores)1 IndexRule (org.neo4j.kernel.impl.store.record.IndexRule)1 DefaultSchemaIndexProviderMap (org.neo4j.kernel.impl.transaction.state.DefaultSchemaIndexProviderMap)1 DynamicIndexStoreView (org.neo4j.kernel.impl.transaction.state.storeview.DynamicIndexStoreView)1 JobScheduler (org.neo4j.kernel.impl.util.JobScheduler)1