anchor.diff:                              solr_query = Query,
                               organization_guid = OrgGuid,
                               batch_size = BatchSize}) ->
  -    try
  -        {ok, Start, NumFound, Ids} = chef_solr:search(Query),
  -        {make_search_results(S, OrgGuid, Ids, BatchSize, Start, NumFound), Req, State}
  -    catch
  -        throw:X ->
  -	    io:format("500! ~p~n", [X]),
  -            {{halt, 500}, Req, State}
  +    {ok, Start, NumFound, Ids} = chef_solr:search(Query),
  +    {NumFound, Ans} = make_search_results(S, OrgGuid, Ids, BatchSize,
  +                                          Start, NumFound),
  +    case Query#chef_solr_query.index of
  +        {data_bag, BagName} when NumFound =:= 0 ->
  +            case chef_otto:data_bag_exists(S, OrgGuid, BagName) of
  +                true ->
  +                    {Ans, Req, State};
  +                false ->
  +                    Msg = iolist_to_binary([<<"I don't know how to search for ">>,
  +                                            BagName, <<" data objects.">>]),
  +                    Json = ejson:encode({[{<<"error">>, [Msg]}]}),
  +                    {{halt, 404}, wrq:set_resp_body(Json, Req), State}
  +            end;
  +        _Else ->
  +            {Ans, Req, State}
       end.
   
   finish_request(Req, State) ->
  
positive.code: 
  make_search_results(S, Db, Ids, BatchSize, Start, NumFound) ->
      Ans0 = search_result_start(Start, NumFound),
      Ans1 = fetch_result_rows(Ids, BatchSize, S, ?db_for_guid(Db), Ans0),
      search_result_finish(Ans1).
  
  % @doc Fetch a list of `Ids' in batches of size `BatchSize'.
  %
  
negative.code: verify_request_message(bad_sig, User, Org) ->
      is_authorized_message(bad_sig, User, Org).
  
  content_types_provided(ReqData, State) ->
      {[{"application/json", to_json}], ReqData, State}.
  
  