anchor.diff:  
   %% convert string to query
   from_str(Str, Lang) ->
  -    {ok, ParseTree} = dk_q_parser:parse(scan(Str)),
  +    {ok,ParseTree} = dk_q_parser:parse(scan(Str)),
       tree_to_query(ParseTree, Lang).
   
   %% rewrite query to DNF
  
positive.code: %% Internal functions
  %%----------------------------------------------------------------------------
  
  scan(<<C/utf8, Rest/bytes>>) ->
      case C of
          $( -> [{'(', 1}|scan(Rest)];
          $) -> [{')', 1}|scan(Rest)];
          $& -> [{'&', 1}|scan(Rest)];
          $| -> [{'|', 1}|scan(Rest)];
          $! -> [{'!', 1}|scan(Rest)];
          32 -> scan(Rest); % skip spaces
          _  ->
              Regex = [<<"^([^()&|! ]*)(.*)$">>],
              Options = [unicode, global, {capture, all_but_first,
                                           binary}],
              case re:run(Rest, Regex, Options) of
                  {match, [[Str, RestRest]]} ->
                      [{string, <<C, Str/bytes>>, 1}|scan(RestRest)];
                  _ ->
                      [{string, <<C>>, 1}|scan(Rest)]
              end
      end;
  scan(<<>>) ->
      [{'$end', 1}].
  
  tree_to_query({and_q, SubTreeL, SubTreeR}, Lang) ->
      #and_q{subs = [tree_to_query(SubTreeL, Lang),
                     tree_to_query(SubTreeR, Lang)]};
  tree_to_query({or_q, SubTreeL, SubTreeR}, Lang) ->
      #or_q{subs = [tree_to_query(SubTreeL, Lang),
                    tree_to_query(SubTreeR, Lang)]};
  tree_to_query({not_q, SubTree}, Lang) ->
      #not_q{sub = tree_to_query(SubTree, Lang)};
  tree_to_query({term_q, {string, Keyword, _}}, Lang) ->
      [Term|_] = dk_pp:terms(Keyword, Lang),
      #term_q{term = Term}.
  
  
negative.code: 
  distr_and(And = #and_q{subs = Qs}) ->
      case lists:partition(fun (Q) -> is_record(Q, or_q) end, Qs) of
          {[],_Rest} ->
              And;
          {Ors,Rest} ->
              #or_q{subs = [distr_and(#and_q{subs = Rs})
                            || Rs <- product([Q#or_q.subs || Q <-Ors],
                                             [Rest])]}
  