Commits

Anonymous committed f2932dd

Fix wildcard parser tests

az293

In commit `b25b649c` there was a change to the handling of wildcards
in the parser to move the check out of `riak_search_op_string` and
instead use a flag. The eunit test cases, however, were not updated.

  • Participants
  • Parent commits 54d8245

Comments (0)

Files changed (2)

File apps/lucene_parser/src/lucene_parse_test.erl

 
 wildcard1_test() ->
     Expect = [
-        #string { s="test?"}
+        #string { s="test", flags=[{wildcard,char}] }
     ],
     test_helper("test?", Expect).
 
 wildcard2_test() ->
     Expect = [
-        #string { s="test*"}
+        #string { s="test", flags=[{wildcard,glob}] }
     ],
     test_helper("test*", Expect).
 
     Expect = [
         #intersection { ops=[
             #union { ops=[
-                #scope { field="color", ops=[#string { s="re*" }] },
+                #scope { field="color", ops=[#string { s="re", flags=[{wildcard,glob}] }] },
                 #scope { field="color", ops=[#string { s="blub", flags=[{fuzzy, 0.5}] }]}
             ]},
             #scope { field="parity", ops=[
         #intersection { ops=[
             #scope { field="acc", ops=[#string { s="afa" }] },
             #negation { op=#scope { field="acc", ops=[#string { s="aga" }] } },
-            #negation { op=#scope { field="color", ops=[#string { s="oran*" }] }}
+            #negation { op=#scope { field="color",
+                                    ops=[#string { s="oran",
+                                                   flags=[{wildcard,glob}] }] }}
         ]}
     ],
     test_helper( "(acc:afa AND -acc:aga) AND -color:oran*", Expect).
         #intersection { ops=[
             #scope { field="acc", ops=[#string { s="afa" }] },
             #negation { op=#scope { field="acc", ops=[#string { s="aga" }] } },
-            #negation { op=#scope { field="color", ops=[#string { s="oran*" }] }}
+            #negation { op=#scope { field="color",
+                                    ops=[#string { s="oran",
+                                                   flags=[{wildcard,glob}] }] }}
         ]}
     ],
     test_helper( "(acc:afa AND (NOT acc:aga)) AND (NOT color:oran*)", Expect).
                     #negation { op=#string { s="aga" } }
                 ]}
             ]},
-            #negation { op=#scope { field="color", ops=[#string { s="oran*" }] }}
+            #negation { op=#scope { field="color",
+                                    ops=[#string { s="oran",
+                                                   flags=[{wildcard,glob}] }] }}
         ]}
     ],
     test_helper( "acc:(afa NOT aga) AND -color:oran*", Expect).
                     #negation { op=#string { s="aga" } }
                 ]}
             ]},
-            #negation { op=#scope { field="color", ops=[#string { s="oran*" }] }}
+            #negation { op=#scope { field="color",
+                                    ops=[#string { s="oran",
+                                                   flags=[{wildcard,glob}] }] }}
         ]}
     ],
     test_helper( "acc:(afa AND (NOT aga)) AND (NOT color:oran*)", Expect).

File apps/lucene_parser/src/lucene_scan_test.erl

 
 wildcard1_test() ->
     Expect = [
-              {string, 1, "test?"}
+              {wildcard_char, 1, "test?"}
              ],
     test_helper("test?", Expect).
 
 wildcard2_test() ->
     Expect = [
-              {string, 1, "test*"}
+              {wildcard_glob, 1, "test*"}
              ],
     test_helper("test*", Expect).