question: private void refreshIndexForDimensionFields ( String rowId , DimensionRow dimensionRow , DimensionRow dimensionRowOld ) { try { for ( DimensionField field : dimension . getDimensionFields ( ) ) { if ( field == dimension . getKey ( ) ) { continue ; } if ( dimensionRowOld != null ) { String oldRowValue = dimensionRowOld . get ( field ) ; String oldRowValueKey = DimensionStoreKeyUtils . getRowKey ( field . getName ( ) , oldRowValue ) ; String oldRowValuesKeysJson = keyValueStore . get ( oldRowValueKey ) ; String [ ] oldRowValueSKeys = objectMapper . readValue ( oldRowValuesKeysJson , String [ ] . class ) ; Set < String > oldRowValuesKeySet = new LinkedHashSet < > ( Arrays . asList ( oldRowValueSKeys ) ) ; oldRowValuesKeySet . remove ( rowId ) ; if ( oldRowValuesKeySet . isEmpty ( ) ) { keyValueStore . remove ( oldRowValueKey ) ; } else { String updatedOldRowValueSKeys = objectMapper . writeValueAsString ( oldRowValuesKeySet ) ; keyValueStore . put ( oldRowValueKey , updatedOldRowValueSKeys ) ; } } String rowValue = dimensionRow . get ( field ) ; String rowValueKey = DimensionStoreKeyUtils . getRowKey ( field . getName ( ) , rowValue ) ; String rowValueSKeys = keyValueStore . get ( rowValueKey ) ; Set < String > rowValueSKeySet = new LinkedHashSet < > ( ) ; if ( rowValueSKeys != null ) { rowValueSKeySet . addAll ( Arrays . asList ( objectMapper . readValue ( rowValueSKeys , String [ ] . class ) ) ) ; } rowValueSKeySet . add ( rowId ) ; String updatedRowValueSKeys = objectMapper . writeValueAsString ( rowValueSKeySet ) ; keyValueStore . put ( rowValueKey , updatedRowValueSKeys ) ; } } catch ( IOException e ) { LOG . error ( "Exception while adding dimension description entry in key value store : {}" , e ) ; throw new RuntimeException ( e ) ; } }
target:  This method updates the store to allow point lookups using the non-key field(s). It loops through all the fields for a dimension (ignores the key field) <p> For a new dimensionRow say ID v1 and DESC value1 a new entry is added in store <p> desc_value1_row_key -> [id_v1_row_key] <p> For a new dimensionRow with duplicate description say ID v2 and DESC value1 the store is updated to look like this <p> desc_value1_row_key -> [id_v1_row_key, id_v2_row_key] <p> For a dimensionRow say ID v2 and DESC value2, dimensionRow -> (v2, value2) dimensionRowOld -> (v2, value1) <p> the store is updated to look like this <p> desc_value1_row_key -> [id_v1_row_key] desc_value2_row_key -> [id_v2_row_key]