@Override protected void changed( IndexEntryUpdate<?> update ) { updatedValueTuples.add( update.values() ); }
@Override protected void added( IndexEntryUpdate<?> update ) { sampler.increment( 1 ); updatedValueTuples.add( update.values() ); }
@Override public void includeSample( IndexEntryUpdate<?> update ) { sampler.include( LuceneDocumentStructure.encodedStringValuesForSampling( update.values() ) ); }
private static <KEY extends NativeIndexKey<KEY>, VALUE extends NativeIndexValue> void processAdd( KEY treeKey, VALUE treeValue, IndexEntryUpdate<?> update, Writer<KEY,VALUE> writer, ConflictDetectingValueMerger<KEY,VALUE> conflictDetectingValueMerger ) throws IndexEntryConflictException { initializeKeyFromUpdate( treeKey, update.getEntityId(), update.values() ); treeValue.from( update.values() ); conflictDetectingValueMerger.controlConflictDetection( treeKey ); writer.merge( treeKey, treeValue, conflictDetectingValueMerger ); conflictDetectingValueMerger.checkConflict( update.values() ); }
@Override protected void added( IndexEntryUpdate<?> update ) { String encodedValue = LuceneDocumentStructure.encodedStringValuesForSampling( update.values() ); sampler.include( encodedValue ); }
@Override protected void removed( IndexEntryUpdate<?> update ) { String removedValue = LuceneDocumentStructure.encodedStringValuesForSampling( update.values() ); sampler.exclude( removedValue ); }
private static Document updateAsDocument( IndexEntryUpdate<?> update ) { return LuceneDocumentStructure.documentRepresentingProperties( update.getEntityId(), update.values() ); } }
@Override public void process( IndexEntryUpdate<?> update ) throws IndexEntryConflictException { actual.process( update ); if ( update.updateMode() != REMOVED ) { touchedTuples.add( ValueTuple.of( update.values() ) ); } }
@Override public void includeSample( IndexEntryUpdate<?> update ) { Value[] values = update.values(); assert values.length == 1; uncheckedSelect( values[0].valueGroup() ).includeSample( update ); }
private static <KEY extends NativeIndexKey<KEY>, VALUE extends NativeIndexValue> void processRemove( KEY treeKey, IndexEntryUpdate<?> update, Writer<KEY,VALUE> writer ) { // todo Do we need to verify that we actually removed something at all? // todo Difference between online and recovery? initializeKeyFromUpdate( treeKey, update.getEntityId(), update.values() ); writer.remove( treeKey ); }
@Override public void includeSample( IndexEntryUpdate<?> update ) { Value[] values = update.values(); assert values.length == 1; uncheckedSelect( ((PointValue) values[0]).getCoordinateReferenceSystem() ).includeSample( update ); }
private Object[] asValues( IndexEntryUpdate<IndexDescriptor>[] updates ) { Object[] values = new Object[updates.length]; for ( int i = 0; i < updates.length; i++ ) { values[i] = updates[i].values()[0].asObject(); } return values; } }
@Override public void includeSample( IndexEntryUpdate<?> update ) { instanceSelector.select( slotSelector.selectSlot( update.values(), GROUP_OF ) ).includeSample( update ); }
@Test public void removeShouldRetainValues() { IndexEntryUpdate<?> single = IndexEntryUpdate.remove( 0, SchemaDescriptorFactory.forLabel( 3, 4 ), singleValue ); IndexEntryUpdate<?> multi = IndexEntryUpdate .remove( 0, SchemaDescriptorFactory.forLabel( 3, 4, 5 ), multiValue ); assertThat( single, not( equalTo( multi ) ) ); assertThat( single.values(), equalTo( new Object[]{singleValue} ) ); assertThat( multi.values(), equalTo( multiValue ) ); }
@Test public void addShouldRetainValues() { IndexEntryUpdate<?> single = IndexEntryUpdate.add( 0, SchemaDescriptorFactory.forLabel( 3, 4 ), singleValue ); IndexEntryUpdate<?> multi = IndexEntryUpdate.add( 0, SchemaDescriptorFactory.forLabel( 3, 4, 5 ), multiValue ); assertThat( single, not( equalTo( multi ) ) ); assertThat( single.values(), equalTo( new Object[]{singleValue} ) ); assertThat( multi.values(), equalTo( multiValue ) ); }
@Override protected void changed( IndexEntryUpdate<?> update ) { String encodedValueBefore = LuceneDocumentStructure.encodedStringValuesForSampling( update.beforeValues() ); sampler.exclude( encodedValueBefore ); String encodedValueAfter = LuceneDocumentStructure.encodedStringValuesForSampling( update.values() ); sampler.include( encodedValueAfter ); }
@Override public void includeSample( IndexEntryUpdate<?> update ) { addValueToSample( update.getEntityId(), update.values()[0] ); }
private Value generateUniqueValue( IndexEntryUpdate<IndexDescriptor>[] updates ) { return filter( skipExisting( updates ), valueCreatorUtil.randomUpdateGenerator( random ) ).next().values()[0]; }
void add( IndexEntryUpdate<?> update ) { if ( update.getEntityId() == 2 ) { job.update( IndexEntryUpdate.remove( nodeToDelete, index, valueToDelete ) ); } added.put( update.getEntityId(), update.values()[0].asObjectCopy() ); }
void add( IndexEntryUpdate<?> update ) { if ( update.getEntityId() == 2 ) { job.update( IndexEntryUpdate.change( nodeToChange, index, previousValue, newValue ) ); } added.add( Pair.of( update.getEntityId(), update.values()[0].asObjectCopy() ) ); }