private void updateUniqueSample( IndexEntryUpdate<?> update ) { switch ( update.updateMode() ) { case ADDED: uniqueSampler.increment( 1 ); break; case REMOVED: uniqueSampler.increment( -1 ); break; case CHANGED: break; default: throw new IllegalArgumentException( "Unsupported update mode type:" + update.updateMode() ); } }
@Override public void process( IndexEntryUpdate<?> update ) throws IndexEntryConflictException { actual.process( update ); if ( update.updateMode() != REMOVED ) { touchedTuples.add( ValueTuple.of( update.values() ) ); } }
static <KEY extends NativeIndexKey<KEY>, VALUE extends NativeIndexValue> void processUpdate( KEY treeKey, VALUE treeValue, IndexEntryUpdate<?> update, Writer<KEY,VALUE> writer, ConflictDetectingValueMerger<KEY,VALUE> conflictDetectingValueMerger ) throws IndexEntryConflictException { switch ( update.updateMode() ) { case ADDED: processAdd( treeKey, treeValue, update, writer, conflictDetectingValueMerger ); break; case CHANGED: processChange( treeKey, treeValue, update, writer, conflictDetectingValueMerger ); break; case REMOVED: processRemove( treeKey, update, writer ); break; default: throw new IllegalArgumentException(); } }
@Override public void process( IndexEntryUpdate<?> update ) { switch ( update.updateMode() ) { case ADDED: case CHANGED: added.add( Pair.of( update.getEntityId(), update.values()[0].asObjectCopy() ) ); break; default: throw new IllegalArgumentException( update.updateMode().name() ); } }
@Override public void process( IndexEntryUpdate<?> update ) { switch ( update.updateMode() ) { case ADDED: case CHANGED: added.put( update.getEntityId(), update.values()[0].asObjectCopy() ); break; case REMOVED: removed.put( update.getEntityId(), update.values()[0].asObjectCopy() ); // on remove, value is the before value break; default: throw new IllegalArgumentException( update.updateMode().name() ); } }
/** * Commit these updates to the index. Also store the values, which currently are stored for all types except geometry, * so therefore it's done explicitly here so that we can filter on them later. */ void updateAndCommit( Collection<IndexEntryUpdate<?>> updates ) throws IndexEntryConflictException { try ( IndexUpdater updater = accessor.newUpdater( IndexUpdateMode.ONLINE ) ) { for ( IndexEntryUpdate<?> update : updates ) { updater.process( update ); switch ( update.updateMode() ) { case ADDED: case CHANGED: committedValues.put( update.getEntityId(), update.values() ); break; case REMOVED: committedValues.remove( update.getEntityId() ); break; default: throw new IllegalArgumentException( "Unknown update mode of " + update ); } } } } }
switch ( update.updateMode() )
if ( update.updateMode() == UpdateMode.ADDED || update.updateMode() == UpdateMode.CHANGED )
@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 ); } }
switch ( update.updateMode() ) break; default: throw new IllegalArgumentException( update.updateMode().name() );
@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" ); } }
update.forIndexKeys( Collections.singleton( schema ) ) ) switch ( indexUpdate.updateMode() ) break; default: throw new IllegalArgumentException( indexUpdate.updateMode().name() );
@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" ); } }
switch ( update.updateMode() )
@Override public void process( IndexEntryUpdate<?> update ) throws IndexEntryConflictException switch ( update.updateMode() )
@Override public void process( IndexEntryUpdate<?> update ) throws IndexEntryConflictException switch ( update.updateMode() )
private void updateUniqueSample( IndexEntryUpdate<?> update ) { switch ( update.updateMode() ) { case ADDED: uniqueSampler.increment( 1 ); break; case REMOVED: uniqueSampler.increment( -1 ); break; case CHANGED: break; default: throw new IllegalArgumentException( "Unsupported update mode type:" + update.updateMode() ); } }
@Override public void process( IndexEntryUpdate<?> update ) throws IndexEntryConflictException { actual.process( update ); if ( update.updateMode() != REMOVED ) { touchedTuples.add( ValueTuple.of( update.values() ) ); } }
static <KEY extends NativeIndexKey<KEY>, VALUE extends NativeIndexValue> void processUpdate( KEY treeKey, VALUE treeValue, IndexEntryUpdate<?> update, Writer<KEY,VALUE> writer, ConflictDetectingValueMerger<KEY,VALUE> conflictDetectingValueMerger ) throws IndexEntryConflictException { switch ( update.updateMode() ) { case ADDED: processAdd( treeKey, treeValue, update, writer, conflictDetectingValueMerger ); break; case CHANGED: processChange( treeKey, treeValue, update, writer, conflictDetectingValueMerger ); break; case REMOVED: processRemove( treeKey, update, writer ); break; default: throw new IllegalArgumentException(); } }
@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" ); } }