anchor.diff:      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,
  +     plists:map(fun(File) -> index_file(AnalyzerPid, File, Index, Field) end,
            Files, {processes, 32}),
  +    qilr_analyzer:close(AnalyzerPid),
       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) ->
  +index_file(AnalyzerPid, File, Index, Field) ->
   %%     Props = random_properties(),
       Basename = filename:basename(File),
       io:format(" :: Indexing file: ~s~n", [Basename]),
  -
  +    {ok, SearchClient} = riak_search:local_client(),
       case file:read_file(File) of
           {ok, Bytes} ->
               %% build doc
  
positive.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, [])].
  
  
  %% NOTE: This was used during early testing against a demo
  %% backend. Keeping it around for a little while longer.
  
negative.code: 
  %% Full-text index the files within the specified directory.
  index_dir(Directory) ->
      index_dir(Directory, ?DEFAULT_INDEX, ?DEFAULT_FIELD).
  
  index_dir(Directory, Index, Field) ->
      io:format(" :: Indexing directory: ~s~n", [Directory]),
      {ok, AnalyzerPid} = qilr_analyzer_sup:new_analyzer(),
      {T1, T2, T3} = erlang:now(),
      random:seed(T1, T2, T3),
      %% Get a list of files in the directory, and index them.
      Directory1 = case string:str(Directory, "*") of
          0 -> filename:join([Directory, "*"]);
  