@Override public void propertyRemoved( ExplicitIndexWrite ops, long entityId, int propertyKey ) throws AutoIndexingKernelException { if ( enabled ) { try { String name = propertyKeyLookup.getTokenById( propertyKey ).name(); if ( propertyKeysToInclude.get().contains( name ) ) { ensureIndexExists( ops ); type.remove( ops, entityId, name ); } } catch ( KernelException e ) { throw new AutoIndexingKernelException( e ); } catch ( TokenNotFoundException e ) { // TODO: TokenNotFoundException was added before there was a kernel. It should be converted to a // KernelException now throw new AutoIndexingKernelException( new PropertyKeyIdNotFoundKernelException( propertyKey, e ) ); } } }
static FulltextIndexDescriptor readOrInitialiseDescriptor( StoreIndexDescriptor descriptor, String defaultAnalyzerName, TokenHolder propertyKeyTokenHolder, PartitionedIndexStorage indexStorage, FileSystemAbstraction fileSystem ) { Properties indexConfiguration = new Properties(); if ( descriptor.schema() instanceof FulltextSchemaDescriptor ) { FulltextSchemaDescriptor schema = (FulltextSchemaDescriptor) descriptor.schema(); indexConfiguration.putAll( schema.getIndexConfiguration() ); } loadPersistedSettings( indexConfiguration, indexStorage, fileSystem ); boolean eventuallyConsistent = Boolean.parseBoolean( indexConfiguration.getProperty( INDEX_CONFIG_EVENTUALLY_CONSISTENT ) ); String analyzerName = indexConfiguration.getProperty( INDEX_CONFIG_ANALYZER, defaultAnalyzerName ); Analyzer analyzer = createAnalyzer( analyzerName ); List<String> names = new ArrayList<>(); for ( int propertyKeyId : descriptor.schema().getPropertyIds() ) { try { names.add( propertyKeyTokenHolder.getTokenById( propertyKeyId ).name() ); } catch ( TokenNotFoundException e ) { throw new IllegalStateException( "Property key id not found.", new PropertyKeyIdNotFoundKernelException( propertyKeyId, e ) ); } } List<String> propertyNames = Collections.unmodifiableList( names ); return new FulltextIndexDescriptor( descriptor, propertyNames, analyzer, analyzerName, eventuallyConsistent ); }
@Override public String propertyKeyName( int propertyKeyId ) throws PropertyKeyIdNotFoundKernelException { ktx.assertOpen(); try { return tokenHolders.propertyKeyTokens().getTokenById( propertyKeyId ).name(); } catch ( TokenNotFoundException e ) { throw new PropertyKeyIdNotFoundKernelException( propertyKeyId, e ); } }
@Override public void propertyAdded( ExplicitIndexWrite ops, long entityId, int propertyKeyId, Value value ) throws AutoIndexingKernelException { if ( enabled ) { try { String name = propertyKeyLookup.getTokenById( propertyKeyId ).name(); if ( propertyKeysToInclude.get().contains( name ) ) { ensureIndexExists( ops ); type.add( ops, entityId, name, value.asObject() ); } } catch ( KernelException e ) { throw new AutoIndexingKernelException( e ); } catch ( TokenNotFoundException e ) { // TODO: TokenNotFoundException was added before there was a kernel. It should be converted to a // KernelException now throw new AutoIndexingKernelException( new PropertyKeyIdNotFoundKernelException( propertyKeyId, e ) ); } } }
@Override public void propertyChanged( ExplicitIndexWrite ops, long entityId, int propertyKeyId, Value oldValue, Value newValue ) throws AutoIndexingKernelException { if ( enabled ) { try { String name = propertyKeyLookup.getTokenById( propertyKeyId ).name(); if ( propertyKeysToInclude.get().contains( name ) ) { ensureIndexExists( ops ); type.remove( ops, entityId, name, oldValue.asObject() ); type.add( ops, entityId, name, newValue.asObject() ); } } catch ( KernelException e ) { throw new AutoIndexingKernelException( e ); } catch ( TokenNotFoundException e ) { // TODO: TokenNotFoundException was added before there was a kernel. It should be converted to a // KernelException now throw new AutoIndexingKernelException( new PropertyKeyIdNotFoundKernelException( propertyKeyId, e ) ); } } }
@Override public void propertyRemoved( ExplicitIndexWrite ops, long entityId, int propertyKey ) throws AutoIndexingKernelException { if ( enabled ) { try { String name = propertyKeyLookup.getTokenById( propertyKey ).name(); if ( propertyKeysToInclude.get().contains( name ) ) { ensureIndexExists( ops ); type.remove( ops, entityId, name ); } } catch ( KernelException e ) { throw new AutoIndexingKernelException( e ); } catch ( TokenNotFoundException e ) { // TODO: TokenNotFoundException was added before there was a kernel. It should be converted to a // KernelException now throw new AutoIndexingKernelException( new PropertyKeyIdNotFoundKernelException( propertyKey, e ) ); } } }
@Override public void propertyAdded( ExplicitIndexWrite ops, long entityId, int propertyKeyId, Value value ) throws AutoIndexingKernelException { if ( enabled ) { try { String name = propertyKeyLookup.getTokenById( propertyKeyId ).name(); if ( propertyKeysToInclude.get().contains( name ) ) { ensureIndexExists( ops ); type.add( ops, entityId, name, value.asObject() ); } } catch ( KernelException e ) { throw new AutoIndexingKernelException( e ); } catch ( TokenNotFoundException e ) { // TODO: TokenNotFoundException was added before there was a kernel. It should be converted to a // KernelException now throw new AutoIndexingKernelException( new PropertyKeyIdNotFoundKernelException( propertyKeyId, e ) ); } } }
@Override public String propertyKeyName( int propertyKeyId ) throws PropertyKeyIdNotFoundKernelException { ktx.assertOpen(); try { return tokenHolders.propertyKeyTokens().getTokenById( propertyKeyId ).name(); } catch ( TokenNotFoundException e ) { throw new PropertyKeyIdNotFoundKernelException( propertyKeyId, e ); } }
@Override public void propertyChanged( ExplicitIndexWrite ops, long entityId, int propertyKeyId, Value oldValue, Value newValue ) throws AutoIndexingKernelException { if ( enabled ) { try { String name = propertyKeyLookup.getTokenById( propertyKeyId ).name(); if ( propertyKeysToInclude.get().contains( name ) ) { ensureIndexExists( ops ); type.remove( ops, entityId, name, oldValue.asObject() ); type.add( ops, entityId, name, newValue.asObject() ); } } catch ( KernelException e ) { throw new AutoIndexingKernelException( e ); } catch ( TokenNotFoundException e ) { // TODO: TokenNotFoundException was added before there was a kernel. It should be converted to a // KernelException now throw new AutoIndexingKernelException( new PropertyKeyIdNotFoundKernelException( propertyKeyId, e ) ); } } }