anchor.diff:    #state{conn = Conn, bucket = Bucket, index = Index, get_opts = Opts} = State,
     TranslatedConditions = transform_conditions(DocName, Conditions),
     SortOpts = build_sort(Sort),
  -  Query = <<(build_query(TranslatedConditions))/binary>>,
  +  Query = <<(build_query(TranslatedConditions, Bucket))/binary>>,
     case search_keys_by(Conn, Index, Query, SortOpts, Limit, Offset) of
       {ok, {_Total, Keys}} ->
         Results = fetch_docs(DocName, Conn, Bucket, Keys, Opts),
  
positive.code: delete_by(DocName, Conditions, State) ->
    #state{conn = Conn, bucket = Bucket, index = Index, del_opts = Opts} = State,
    TranslatedConditions = transform_conditions(DocName, Conditions),
    Query = build_query(TranslatedConditions),
    case search_docs_by(DocName, Conn, Index, Query, 0, 0) of
      {ok, {Total, Res}}  ->
        delete_docs(Conn, Bucket, Res, Opts),
  
negative.code:           {error, Error, State}
        end;
      _ ->
        Query = build_query(Conditions, Bucket),
        case search_docs_by(DocName, Conn, Index, Query, 0, 0) of
          {ok, {Total, Res}}  ->
            delete_docs(Conn, Bucket, Res, Opts),
  