anchor.diff:      end,
       {Json,_,_} = api_help:json_handler(ReqData,State),
       FilteredJson = filter_json(Json, From, Size, Sort),
  -    erlang:display(lib_json:to_string(FilteredJson)),
  +	erlang:display(lib_json:to_string(FilteredJson)),
       case erlastic_search:search_json(#erls_params{},?INDEX, "stream", FilteredJson) of % Maybe wanna take more
               {error, Reason1} ->
                   StreamSearch = {error, Reason1};
               {ok,List1} ->
  -            case lib_json:get_field(FilteredJson, "query.filtered.query.query_string.query") of
  -                undefined ->
  -                    erlang:display("No query string text");
  -                QueryString ->
  -                    erlastic_search:index_doc(?INDEX,"search_query","{\"search_suggest\":{\"input\":[\""++ lib_json:to_string(QueryString) ++"\"],\"weight\":1}}")
  -            end,
  -            StreamSearch = lib_json:encode(List1) % May need to convert
  +			case lib_json:get_field(FilteredJson, "query.filtered.query.query_string.query") of
  +				undefined ->
  +					erlang:display("No query string text");
  +				QueryString ->
  +					erlastic_search:index_doc(?INDEX,"search_query","{\"search_suggest\":{\"input\":[\""++ lib_json:to_string(QueryString) ++"\"],\"weight\":1}}")
  +			end,
  +			StreamSearch = lib_json:encode(List1) % May need to convert
       end,
       case erlastic_search:search_json(#erls_params{},?INDEX, "user", lib_json:rm_field(FilteredJson, "sort")) of % Maybe wanna take more
               {error, Reason2} ->
                       UserSearch = {error, Reason2};
               {ok,List2} -> 
  -            UserSearch = lib_json:encode(List2) % May need to convert
  +			UserSearch = lib_json:encode(List2) % May need to convert
        end,
  -    % check search-results for error
  -    case StreamSearch of
  -        {error, {Body, Code}} ->
  -        ErrorString = api_help:generate_error(Body, Code),
  -        {{halt, Code}, wrq:set_resp_body(ErrorString, ReqData), State};
  -        _ -> 
  -        case UserSearch of
  -          {error, {Body, Code}} ->
  -            ErrorString = api_help:generate_error(Body, Code),
  -            {{halt, Code}, wrq:set_resp_body(ErrorString, ReqData), State};
  -          _ ->
  -                SearchResults = "{\"streams\":"++ StreamSearch ++", \"users\":"++ UserSearch ++"}",
  -                {true,wrq:set_resp_body(SearchResults,ReqData),State}
  -        end
  -    end.
  +	% check search-results for error
  +	case StreamSearch of
  +		{error, {Body, Code}} ->
  +		ErrorString = api_help:generate_error(Body, Code),
  +		{{halt, Code}, wrq:set_resp_body(ErrorString, ReqData), State};
  +		_ -> 
  +		case UserSearch of
  +		  {error, {Body, Code}} ->
  +			ErrorString = api_help:generate_error(Body, Code),
  +			{{halt, Code}, wrq:set_resp_body(ErrorString, ReqData), State};
  +		  _ ->
  +				SearchResults = "{\"streams\":"++ StreamSearch ++", \"users\":"++ UserSearch ++"}",
  +				{true,wrq:set_resp_body(SearchResults,ReqData),State}
  +		end
  +	end.
   %% GROUPS ARE NOT IMPLEMENTED
   %%         case erlastic_search:search_json(#erls_params{},?INDEX, "group", FilteredJson) of % Maybe wanna take more
   %%                 {error,Reason} -> {{halt,Reason}, ReqData, State};
  
positive.code: %% Returns: JSON string that is updated with filter and the from size parameters
  %% @end
  filter_json(Json, From, Size, Sort) ->
      case lib_json:get_field(Json, "sort") of 
          undefined -> 
              UseSort = "\"" ++ Sort ++ "\"", 
              SortJson = Json;
          SortValue when is_binary(SortValue) -> 
              UseSort = "\"" ++ binary_to_list(SortValue) ++ "\"",
              SortJson = lib_json:rm_field(Json, "sort");
          SortValue -> 
              UseSort = SortValue,
              SortJson = lib_json:rm_field(Json, "sort")
      end,
      NewJson = string:sub_string(SortJson,1,string:len(SortJson)-1),
      "{\"from\" : "++From++
      ",\"size\" : "++Size++
      ",\"sort\" : " ++UseSort++
      ",\"query\" : {\"filtered\" : "++NewJson++
      ",\"filter\" : {\"bool\" : {\"must_not\" : {\"term\" : {\"private\" : \"true\"}}}}}}}".
  
negative.code: %% @end
  -spec content_types_provided(ReqData::tuple(), State::string()) -> {list(), tuple(), string()}.
  content_types_provided(ReqData, State) ->
  		{[{"application/json", get_search}], ReqData, State}.
  
  
  %% @doc
  