anchor.diff:                  %% we need to redefine set view whenever document changes; but
                   %% previous group for current value of design document can
                   %% still be alive; thus using maybe_define_group
  -                maybe_define_group(Bucket, BucketConfig, DDocId, Map),
  +                maybe_define_group(Bucket, BucketConfig,
  +                                   DDocId, Map, UseReplicaIndex),
                   DDocs1 = sets:add_element(DDocId, DDocs),
                   State#state{ddocs=DDocs1};
               true ->
  
positive.code:             #state{bucket=Bucket,
                     ddocs=DDocs,
                     map=Map,
                     pending_vbucket_states=States} = State) ->
      NewStates = dict:map(
                    fun (_, _) ->
                            dead
                    end, States),
      NewMap = ?EMPTY_MAP,
      apply_map(Bucket, DDocs, Map, NewMap),
      {reply, ok, State#state{vbucket_states=NewStates,
                              pending_vbucket_states=NewStates,
                              map=NewMap}};
  
negative.code: handle_cast({update_ddoc, DDocId, Deleted},
              #state{bucket=Bucket,
                     bucket_config=BucketConfig,
                     use_replica_index=UseReplicaIndex,
                     ddocs=DDocs, map=Map} = State) ->
      State1 =
          case Deleted of
  