anchor.diff:      end.
   
   %% @private
  -%% 'legacy' 2i (v1)
  -get_index_folder(Folder, Acc0, {index, Bucket, {eq, <<"$bucket">>, _}}, DataRef, _) ->
  -    %% For the special $bucket index, turn it into a fold over the
  -    %% data table.
  -    fun() ->
  -            key_range_folder(Folder, Acc0, DataRef, {Bucket, <<>>}, {Bucket, <<>>, true})
  -    end;
  -get_index_folder(Folder, Acc0, {index, Bucket, {range, <<"$key">>, Min, Max}}, DataRef, _) ->
  -    %% For the special range lookup on the $key index, turn it into a
  -    %% fold on the data table
  -    fun() ->
  -            key_range_folder(Folder, Acc0, DataRef, {Bucket, Min}, {Bucket, Min, Max, true})
  -    end;
  -get_index_folder(Folder, Acc0, {index, Bucket, {eq, <<"$key">>, Val}}, DataRef, IndexRef) ->
  -    get_index_folder(Folder, Acc0, {index, Bucket, {range, <<"$key">>, Val, Val}}, DataRef, IndexRef);
  -get_index_folder(Folder, Acc0, {index, Bucket, {eq, Field, Term}}, _, IndexRef) ->
  -    fun() ->
  -            index_range_folder(Folder, Acc0, IndexRef,
  -                               {Bucket, Field, Term, undefined},
  -                               {Bucket, Field, Term, Term, true})
  -    end;
  -get_index_folder(Folder, Acc0, {index, Bucket, {range, Field, Min, Max}}, _, IndexRef) ->
  -    fun() ->
  -            index_range_folder(Folder, Acc0, IndexRef,
  -                               {Bucket, Field, Min, undefined},
  -                               {Bucket, Field, Min, Max, true})
  -    end;
   %% V2 2i
   get_index_folder(Folder, Acc0, {index, Bucket, Q=?KV_INDEX_Q{filter_field= <<"$bucket">>}}, DataRef, _) ->
       %% get first key
  
positive.code:             index_range_folder(Folder, Acc0, IndexRef,
                                 {Bucket, FF, Min, StartKey},
                                 {Bucket, FF, Min, Max, StartKey, Incl})
      end.
  
  %% Iterates over a range of keys, for the special $key and $bucket
  %% indexes.
  
negative.code:        (_, Acc) ->
              Acc
      end;
  %% Upgrade legacy indexes
  fold_keys_fun(FoldKeysFun, {index, Bucket, Q}) ->
      UpgradeQ = riak_index:upgrade_query(Q),
      fold_keys_fun(FoldKeysFun, {index, Bucket, UpgradeQ}).
  
  %% @private
  %% Return a function to fold over keys on this backend
  