Skip to content

Commit

Permalink
test: group by match
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Feb 14, 2017
1 parent 30a0810 commit 3469ad7
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions test/mruby/suite/query_optimizer/test_index.rb
@@ -1,39 +1,40 @@
class TestIndex < QueryOptimizerTestCase
def setup
Groonga::Schema.define do |schema|
schema.create_table("Logs") do |table|
table.text("message")
end
class TestMatch < self
def setup
Groonga::Schema.define do |schema|
schema.create_table("Logs") do |table|
table.text("message")
end

schema.create_table("Terms",
:type => :patricia_trie,
:default_tokenizer => "TokenBigram",
:normalizer => "NormalizerAuto") do |table|
table.index("Logs", "message")
schema.create_table("Terms",
:type => :patricia_trie,
:default_tokenizer => "TokenBigram",
:normalizer => "NormalizerAuto") do |table|
table.index("Logs", "message")
end
end
end

@logs = Groonga["Logs"]
setup_expression(@logs)
end
@logs = Groonga["Logs"]
setup_expression(@logs)
end

def teardown
teardown_expression
end
def teardown
teardown_expression
end

def test_match
assert_equal(<<-DUMP, dump_plan("message @ 'Groonga'"))
def test_only
assert_equal(<<-DUMP, dump_plan("message @ 'Groonga'"))
[0]
op: <match>
logical_op: <or>
index: <[#<column:index Terms.Logs_message range:Logs sources:[Logs.message] flags:POSITION>]>
query: <"Groonga">
expr: <0..2>
DUMP
end
DUMP
end

def test_with_arithmetic_operator
assert_equal(<<-DUMP, dump_plan("message @ 'Groonga' && ((1 + 1) == 2)"))
def test_with_arithmetic_operator
assert_equal(<<-DUMP, dump_plan("message @ 'Groonga' && ((1 + 1) == 2)"))
[0]
op: <match>
logical_op: <or>
Expand All @@ -46,6 +47,7 @@ def test_with_arithmetic_operator
index: <[]>
query: <2>
expr: <3..7>
DUMP
DUMP
end
end
end

0 comments on commit 3469ad7

Please sign in to comment.