anchor.diff:              IdxDoc2 = riak_indexed_doc:set_fields([
                   {"payload", binary_to_list(Bytes)}], IdxDoc),
               %% index
  -            ok = SearchClient:index_doc(AnalyzerPid, IdxDoc2);
  +            SearchClient:index_doc(AnalyzerPid, IdxDoc2);
           {error, eisdir} ->
               io:format("following directory: ~p~n", [File]),
  -            index_dir(SearchClient, AnalyzerPid, File, Index, Field);
  +            index_dir(File, Index, Field);
           Err ->
               io:format("index_file(~p, ~p, ~p): error: ~p~n",
                   [File, Index, Field, Err])
  
positive.code:     Files = filelib:wildcard(Directory1),
      io:format(" :: Found ~p files...~n", [length(Files)]),
  %%    [index_file(SearchClient, File, Index, Field) || File <- Files],
       plists:map(fun(File) -> index_file(SearchClient, AnalyzerPid, File, Index, Field) end,
           Files, {processes, 32}),
      ok.
  
  %% %% Full-text index the specified file.
  %% index_file(SearchClient, File) ->
  %%     index_file(SearchClient, File, ?DEFAULT_INDEX, ?DEFAULT_FIELD).
  index_file(SearchClient, AnalyzerPid, File, Index, Field) ->
  %%     Props = random_properties(),
      Basename = filename:basename(File),
      io:format(" :: Indexing file: ~s~n", [Basename]),
  
      case file:read_file(File) of
          {ok, Bytes} ->
              %% build doc
  
negative.code: 
  %% This method returns fake properties. It is called by index_file and
  %% is here so that you can play around with facet search.
  %% random_properties() ->
  %%     Colors = ["red", "orange", "yellow", "green", "blue"],
  %%     ColorNum = random:uniform(length(Colors)),
  %%     Color = lists:nth(ColorNum, Colors),
  
  %%     Directions = ["north", "south", "east", "west"],
  %%     DirectionNum = random:uniform(length(Directions)),
  %%     Direction = lists:nth(DirectionNum, Directions),
  
  %%     [{"color", Color}, {"direction", Direction}].
  
  
  %% bytes_to_words(B) ->
  %%     bytes_to_words(B, []).
  %% bytes_to_words(<<>>, []) ->
  %%     [];
  %% bytes_to_words(<<>>, Acc) ->
  %%     Word = string:to_lower(lists:reverse(Acc)),
  %%     [Word];
  %% bytes_to_words(<<C, Rest/binary>>, Acc) when ?IS_CHAR(C) ->
  %%     bytes_to_words(Rest, [C|Acc]);
  %% bytes_to_words(<<_, Rest/binary>>, []) ->
  %%     bytes_to_words(Rest, []);
  %% bytes_to_words(<<_, Rest/binary>>, Acc) ->
  %%     Word = string:to_lower(lists:reverse(Acc)),
  %%     [Word|bytes_to_words(Rest, [])].
  
  random_indexer(Pool) ->
      lists:nth(random:uniform(length(Pool)), Pool).
  
  indexer() ->
      {ok, Pid} = qilr_analyzer_sup:new_analyzer(),
      {ok, Client} = riak_search:local_client(),
      do_index(Pid, Client).
  
  do_index(AnalyzerPid, SearchClient) ->
      receive
          {index, Doc} ->
              SearchClient:index_doc(AnalyzerPid, Doc),
              do_index(AnalyzerPid, SearchClient);
          stop ->
              io:format("(~p) indexer complete~n", [self()]),
              ok
      end.
  
  %% NOTE: This was used during early testing against a demo
  %% backend. Keeping it around for a little while longer.
  