Permalink
Browse files

Actually support case-insensitive search in Mnesia

  • Loading branch information...
1 parent ec85171 commit 86e5729114730ef3c49c19381c4cceb247c19b67 @evanmiller evanmiller committed Sep 3, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/db_adapters/boss_db_adapter_mnesia.erl
@@ -129,15 +129,15 @@ test_rec(Rec,{Key, 'ge', Value}) ->
apply(Rec,Key,[]) >= Value;
test_rec(Rec,{Key, 'le', Value}) ->
apply(Rec,Key,[]) =< Value;
-test_rec(Rec,{Key, 'matches', Value}) ->
- {ok, MP} = re:compile(Value),
+test_rec(Rec,{Key, 'matches', "*"++Value}) ->
+ {ok, MP} = re:compile(Value, [caseless]),
case re:run(apply(Rec,Key,[]), MP) of
{match,_} -> true;
match -> true;
_ -> false
end;
-test_rec(Rec,{Key, 'matches', "*"++Value}) ->
- {ok, MP} = re:compile(Value, [caseless]),
+test_rec(Rec,{Key, 'matches', Value}) ->
+ {ok, MP} = re:compile(Value),
case re:run(apply(Rec,Key,[]), MP) of
{match,_} -> true;
match -> true;

0 comments on commit 86e5729

Please sign in to comment.