anchor.diff:  
   send_delete(Doc) ->
       post_to_solr(update_payload([], [Doc])).
  -
  -%% @doc Send items accumulated in the index expand context to
  -%% Solr. The URL used to talk to Solr is embedded in the context
  -%% object and determined when `{@link init_items/1}' was called.
  --spec send_items(pid() | index_expand_ctx()) -> ok | {error, {_, _}}.
  -send_items(Pid) when is_pid(Pid)->
  -    % Adding a timeout of 30s as preprod is very, very slow
  -    gen_server:call(Pid, send_items, 30000).
  -send_items_impl(#idx_exp_ctx{to_add = Added, to_del = Deleted,
  -                        count = Count,
  -                        received = Count,
  -                       send_requested = Requestor,
  -                       send_fun = SendFun}) when Requestor /= undefined ->
  -    Result = case {Added, Deleted} of
  -        {[], []} ->
  -            ok;
  -        {UnsortedToAdd, UnsortedToDel} ->
  -            ToAdd = sort(UnsortedToAdd),
  -            ToDel = sort(UnsortedToDel),
  -            error_logger:info_msg("chef_index_expand:send_items adds:~p dels:~p~n",
  -                                  [length(ToAdd), length(ToDel)]),
  -            Doc = update_payload(ToAdd, ToDel),
  -            SendFun(Doc)
  -             end,
  -    gen_server:reply(Requestor, Result),
  -    #idx_exp_ctx{};
  -send_items_impl(State) ->
  -    State.
   
   %% --- start copy from chef_index (chef_index_queue) ---
   
  
positive.code: %%
  %% This module implements Chef object flatten/expand using the same
  %% algorithm as `chef-expander' and handles POSTing updates (both adds
  %% and deletes) to Solr. You will interact with four functions:
  %%
  %% <ol>
  %% <li>{@link init_items/1}</li>
  %% <li>{@link add_item/4}</li>
  %% <li>{@link delete_item/4}</li>
  %% <li>{@link send_items/1}</li>
  %% </ol>
  %%
  %% Start by initializing an item context object using {@link
  %% init_items/1} to which you pass the URL for the Solr instance you
  %% want to work with.
  %%
  %% Next, use {@link add_item/4} to add/update items in the
  %% index. These items will go through the flatten/expand process. If
  %% you want to stage an item delete, use {@link delete_item/4}. Both
  %% of these functions take an item context object and return a
  %% possibly updated context. It is important to keep track of the
  %% possibly modified context to use for your next call. This API
  %% allows this module to handle the flatten/expand and post in
  %% different ways. For example, the flatten/expand can be done inline,
  %% accumulating the result in the context, or the context can contain
  %% a pid and the work can be done async and in parallel.
  %%
  %% Finally, call {@link send_items/1} passing the accumulated context
  %% object. Calling this function triggers the actual POST to solr.
  %%
  %% @end
  -module(chef_index_expand).
  
  -export([
           start_link/0,
           add_item/5,
           delete_item/4,
           init_items/2,
           make_command/5,
           post_multi/2,
           post_single/2,
           post_to_solr/1,
           send_items/1,
           send_item/1,
           send_delete/1,
           doc_for_index/4,
           doc_for_delete/3,
           stop/1,
           gather/1
          ]).
  -behaviour(gen_server).
  
  %% gen_server callbacks
  -export([init/1, handle_call/3, handle_cast/2, handle_info/2,
           terminate/2, code_change/3]).
  
  -define(SERVER, ?MODULE).
  
  
negative.code: -define(META_FIELDS, [{?K_ID, <<"X_CHEF_id_CHEF_X">>},
                        {?K_DATABASE, <<"X_CHEF_database_CHEF_X">>}]).
  
  chef_object_type(Index) when is_binary(Index) -> {data_bag_item, Index};
  chef_object_type(Index) when is_atom(Index)   -> Index.
  
  