anchor.diff:      end.
   
   %% @doc Sends a "commit" message directly to Solr
  +%% This is exposed for the users of delete_search_db_by_type
   -spec solr_commit() -> ok | {error, term()}.
   solr_commit() ->
       solr_update("<?xml version='1.0' encoding='UTF-8'?><commit/>").
  
positive.code:     ok = solr_commit(),
      ok.
  
  %% TODO: Deal properly with errors
  %% @doc Delete all search index entries for a given organization and type.
  -spec delete_search_db_by_type(OrgId :: binary(), Type :: binary()) -> ok.
  delete_search_db_by_type(OrgId, Type) ->
      DeleteQuery = "<?xml version='1.0' encoding='UTF-8'?><delete><query>" ++
          search_db_from_orgid(OrgId) ++ " AND " ++
          search_type_constraint(Type) ++
          "</query></delete>",
      ok = solr_update(DeleteQuery),
      ok = solr_commit(),
      ok.
  
  %% Internal functions
  
  
negative.code: 
  %% @doc Generates a constraint for chef_type
  %% @end
  -spec search_type_constraint(Type :: atom()) -> TypeConstraint :: [byte(),...].
  search_type_constraint(Type) ->
      "X_CHEF_type_CHEF_X:" ++ atom_to_list(Type).
  
  
  % /solr/select?
  