anchor.diff:                  true -> atom_to_list(Sort);
                   false -> Sort
               end,
  -    [FirstChar|F1] = Sort1,
  -    Order = case FirstChar of
  -                $- -> F1 ++ " DESC";
  -                $+ -> F1 ++ " ASC";
  -                _ -> Sort1 ++ " ASC"
  -            end,
  -    parse_query(Rest, Context, add_order(Order, Result));
  +    parse_query(Rest, Context, add_order(Sort1, Result));
   
   %% custompivot=tablename
   %% Add a join on the given custom pivot table.
  
positive.code:             Search#search_sql{where=C ++ " AND " ++ Clause}
      end.
  
  %% Add an AND clause to the WHERE of a #search_sql
  add_order(Clause, Search) ->
      case Search#search_sql.order of
          [] ->
              Search#search_sql{order=Clause};
  
negative.code: ]).
  
  -include_lib("zotonic.hrl").
  
  -define(SQL_SAFE_REGEXP, "^[a-zA-Z_\.]+$").
  
  search(Query, Context) ->
      Start = #search_sql{select="rsc.id",
  