private void add( EntityUpdates updates ) { // This is called from a full store node scan, meaning that all node properties are included in the // EntityUpdates object. Therefore no additional properties need to be loaded. for ( IndexEntryUpdate<IndexPopulation> indexUpdate : updates.forIndexKeys( populations ) ) { indexUpdate.indexKey().onUpdate( indexUpdate ); } } }
@Override public String toString() { return format( "IndexEntryUpdate[id=%d, mode=%s, %s, beforeValues=%s, values=%s]", entityId, updateMode, indexKey().schema().userDescription( SchemaUtil.idTokenNameLookup ), Arrays.toString( before ), Arrays.toString( values ) ); }
private boolean updatesForCorrectIndex( Collection<? extends IndexEntryUpdate<?>> updates ) { for ( IndexEntryUpdate<?> update : updates ) { if ( !update.indexKey().schema().equals( luceneIndex.getDescriptor().schema() ) ) { return false; } } return true; }
private void processUpdate( IndexUpdaterMap updaterMap, IndexEntryUpdate<SchemaDescriptor> indexUpdate ) throws IndexEntryConflictException { IndexUpdater updater = updaterMap.getUpdater( indexUpdate.indexKey().schema() ); if ( updater != null ) { updater.process( indexUpdate ); } }
@Override public void process( IndexEntryUpdate<?> update ) { Pair<IndexPopulation,IndexUpdater> pair = populationsWithUpdaters.get( update.indexKey().schema() ); if ( pair != null ) { IndexPopulation population = pair.first(); IndexUpdater updater = pair.other(); try { population.populator.includeSample( update ); updater.process( update ); } catch ( Throwable t ) { try { updater.close(); } catch ( Throwable ce ) { log.error( format( "Failed to close index updater: [%s]", updater ), ce ); } populationsWithUpdaters.remove( update.indexKey().schema() ); multipleIndexPopulator.fail( population, t ); } } }
@Override public void process( IndexEntryUpdate<?> update ) throws IndexEntryConflictException { IndexUpdater to = select( ((PointValue)update.values()[0]).getCoordinateReferenceSystem() ); switch ( update.updateMode() ) { case ADDED: case REMOVED: to.process( update ); break; case CHANGED: IndexUpdater from = select( ((PointValue) update.beforeValues()[0]).getCoordinateReferenceSystem() ); // There are two cases: // - both before/after go into the same updater --> pass update into that updater if ( from == to ) { from.process( update ); } // - before go into one and after into the other --> REMOVED from one and ADDED into the other else { from.process( IndexEntryUpdate.remove( update.getEntityId(), update.indexKey(), update.beforeValues() ) ); to.process( IndexEntryUpdate.add( update.getEntityId(), update.indexKey(), update.values() ) ); } break; default: throw new IllegalArgumentException( "Unknown update mode" ); } }
@Override public void process( IndexEntryUpdate<?> update ) throws IndexEntryConflictException { IndexUpdater to = select( update.values()[0].valueGroup() ); switch ( update.updateMode() ) { case ADDED: case REMOVED: to.process( update ); break; case CHANGED: IndexUpdater from = select( update.beforeValues()[0].valueGroup() ); // There are two cases: // - both before/after go into the same updater --> pass update into that updater if ( from == to ) { from.process( update ); } // - before go into one and after into the other --> REMOVED from one and ADDED into the other else { from.process( IndexEntryUpdate.remove( update.getEntityId(), update.indexKey(), update.beforeValues() ) ); to.process( IndexEntryUpdate.add( update.getEntityId(), update.indexKey(), update.values() ) ); } break; default: throw new IllegalArgumentException( "Unknown update mode" ); } }
@Override public void process( IndexEntryUpdate<?> update ) { assert update.indexKey().schema().equals( descriptor.schema() ); try { switch ( update.updateMode() ) { case ADDED: long nodeId = update.getEntityId(); luceneIndex.getIndexWriter().updateDocument( LuceneFulltextDocumentStructure.newTermForChangeOrRemove( nodeId ), LuceneFulltextDocumentStructure.documentRepresentingProperties( nodeId, descriptor.propertyNames(), update.values() ) ); case CHANGED: long nodeId1 = update.getEntityId(); luceneIndex.getIndexWriter().updateDocument( LuceneFulltextDocumentStructure.newTermForChangeOrRemove( nodeId1 ), LuceneFulltextDocumentStructure.documentRepresentingProperties( nodeId1, descriptor.propertyNames(), update.values() ) ); break; case REMOVED: luceneIndex.getIndexWriter().deleteDocuments( LuceneFulltextDocumentStructure.newTermForChangeOrRemove( update.getEntityId() ) ); break; default: throw new UnsupportedOperationException(); } } catch ( IOException e ) { throw new UncheckedIOException( e ); } }
private void add( EntityUpdates updates ) { // This is called from a full store node scan, meaning that all node properties are included in the // EntityUpdates object. Therefore no additional properties need to be loaded. for ( IndexEntryUpdate<IndexPopulation> indexUpdate : updates.forIndexKeys( populations ) ) { indexUpdate.indexKey().onUpdate( indexUpdate ); } } }
@Override public String toString() { return format( "IndexEntryUpdate[id=%d, mode=%s, %s, beforeValues=%s, values=%s]", entityId, updateMode, indexKey().schema().userDescription( SchemaUtil.idTokenNameLookup ), Arrays.toString( before ), Arrays.toString( values ) ); }
private void processUpdate( IndexUpdaterMap updaterMap, IndexEntryUpdate<SchemaDescriptor> indexUpdate ) throws IndexEntryConflictException { IndexUpdater updater = updaterMap.getUpdater( indexUpdate.indexKey().schema() ); if ( updater != null ) { updater.process( indexUpdate ); } }
@Override public void process( IndexEntryUpdate<?> update ) { Pair<IndexPopulation,IndexUpdater> pair = populationsWithUpdaters.get( update.indexKey().schema() ); if ( pair != null ) { IndexPopulation population = pair.first(); IndexUpdater updater = pair.other(); try { population.populator.includeSample( update ); updater.process( update ); } catch ( Throwable t ) { try { updater.close(); } catch ( Throwable ce ) { log.error( format( "Failed to close index updater: [%s]", updater ), ce ); } populationsWithUpdaters.remove( update.indexKey().schema() ); multipleIndexPopulator.fail( population, t ); } } }
@Override public void process( IndexEntryUpdate<?> update ) throws IndexEntryConflictException { IndexUpdater to = select( update.values()[0].valueGroup() ); switch ( update.updateMode() ) { case ADDED: case REMOVED: to.process( update ); break; case CHANGED: IndexUpdater from = select( update.beforeValues()[0].valueGroup() ); // There are two cases: // - both before/after go into the same updater --> pass update into that updater if ( from == to ) { from.process( update ); } // - before go into one and after into the other --> REMOVED from one and ADDED into the other else { from.process( IndexEntryUpdate.remove( update.getEntityId(), update.indexKey(), update.beforeValues() ) ); to.process( IndexEntryUpdate.add( update.getEntityId(), update.indexKey(), update.values() ) ); } break; default: throw new IllegalArgumentException( "Unknown update mode" ); } }
@Override public void process( IndexEntryUpdate<?> update ) throws IndexEntryConflictException { IndexUpdater to = select( ((PointValue)update.values()[0]).getCoordinateReferenceSystem() ); switch ( update.updateMode() ) { case ADDED: case REMOVED: to.process( update ); break; case CHANGED: IndexUpdater from = select( ((PointValue) update.beforeValues()[0]).getCoordinateReferenceSystem() ); // There are two cases: // - both before/after go into the same updater --> pass update into that updater if ( from == to ) { from.process( update ); } // - before go into one and after into the other --> REMOVED from one and ADDED into the other else { from.process( IndexEntryUpdate.remove( update.getEntityId(), update.indexKey(), update.beforeValues() ) ); to.process( IndexEntryUpdate.add( update.getEntityId(), update.indexKey(), update.values() ) ); } break; default: throw new IllegalArgumentException( "Unknown update mode" ); } }