msfl_visitors 1.1.0.dev5 → 1.1.0.dev6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/msfl_visitors/visitor.rb +3 -3
- data/msfl_visitors.gemspec +1 -1
- data/spec/msfl_visitors/visitors/chewy_term_filter_spec.rb +10 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32396eb4d354abc1354870d15fb22e2328aaa6a5
|
4
|
+
data.tar.gz: cf5865b6fcce2cb9e88cad25706d542439add95d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a6b76e2ea415343d350c8dce77a8422db02bf89370bc6df4787f498b723219589756d7018de2b8aa54755620772058d0d3cb86088d57fe07d973ba390987c7b
|
7
|
+
data.tar.gz: 901fbc5717a6ce8dfc72030a2864b0898b4e3ffbce0048f5c19f213a833b50acd8f8e5944c1a5d44e0ff81c8c82fbdc905d39124df5433f99dfe61abf963f9cd
|
@@ -73,7 +73,7 @@ module MSFLVisitors
|
|
73
73
|
when Nodes::Field
|
74
74
|
node.value.to_s
|
75
75
|
when Nodes::Regex
|
76
|
-
%(Regexp.new( "
|
76
|
+
%(Regexp.new( ".*#{Regexp.escape(node.value)}.*" ))
|
77
77
|
when Nodes::Word
|
78
78
|
"\"#{node.value}\""
|
79
79
|
when Nodes::Date, Nodes::Time
|
@@ -83,8 +83,8 @@ module MSFLVisitors
|
|
83
83
|
|
84
84
|
when Nodes::Match
|
85
85
|
if node.right.is_a? Nodes::Set
|
86
|
-
regex = node.right.contents.map { |right_child| MSFLVisitors::Nodes::Regex.new(right_child.value.to_s).accept(visitor)[
|
87
|
-
"#{node.left.accept(visitor)} #{BINARY_OPERATORS[node.class]} Regexp.new( \"
|
86
|
+
regex = node.right.contents.map { |right_child| MSFLVisitors::Nodes::Regex.new(right_child.value.to_s).accept(visitor)[15..-6] }.join('|')
|
87
|
+
"#{node.left.accept(visitor)} #{BINARY_OPERATORS[node.class]} Regexp.new( \".*#{regex}.*\" )"
|
88
88
|
else
|
89
89
|
"#{node.left.accept(visitor)} #{BINARY_OPERATORS[node.class]} #{MSFLVisitors::Nodes::Regex.new(node.right.value.to_s).accept(visitor)}"
|
90
90
|
end
|
data/msfl_visitors.gemspec
CHANGED
@@ -202,8 +202,8 @@ describe MSFLVisitors::Visitor do
|
|
202
202
|
|
203
203
|
context "when using the TermFilter visitor" do
|
204
204
|
|
205
|
-
it "results in: 'Regexp.new( \"foobar
|
206
|
-
expect(result).to eq %(Regexp.new( "foobar" ))
|
205
|
+
it "results in: 'Regexp.new( \".*foobar.*\")'" do
|
206
|
+
expect(result).to eq %(Regexp.new( ".*foobar.*" ))
|
207
207
|
end
|
208
208
|
end
|
209
209
|
|
@@ -223,8 +223,8 @@ describe MSFLVisitors::Visitor do
|
|
223
223
|
|
224
224
|
context "when using the TermFilter visitor" do
|
225
225
|
|
226
|
-
it "results in: 'left =~ Regexp.new( \"rhs
|
227
|
-
expect(result).to eq %(lhs =~ Regexp.new( "rhs" ))
|
226
|
+
it "results in: 'left =~ Regexp.new( \".*rhs.*\" )'" do
|
227
|
+
expect(result).to eq %(lhs =~ Regexp.new( ".*rhs.*" ))
|
228
228
|
end
|
229
229
|
end
|
230
230
|
|
@@ -249,8 +249,8 @@ describe MSFLVisitors::Visitor do
|
|
249
249
|
|
250
250
|
context "when using the TermFilter visitor" do
|
251
251
|
|
252
|
-
it "results in: 'left =~ Regexp.new( \"foo|bar|baz
|
253
|
-
expect(result).to eq %(lhs =~ Regexp.new( "foo|bar|baz" ))
|
252
|
+
it "results in: 'left =~ Regexp.new( \".*foo|bar|baz.*\" )'" do
|
253
|
+
expect(result).to eq %(lhs =~ Regexp.new( ".*foo|bar|baz.*" ))
|
254
254
|
end
|
255
255
|
end
|
256
256
|
|
@@ -690,8 +690,8 @@ describe MSFLVisitors::Visitor do
|
|
690
690
|
|
691
691
|
let(:node) { MSFLVisitors::Nodes::Regex.new regex }
|
692
692
|
|
693
|
-
it "returns: 'Regexp.new( \"content
|
694
|
-
expect(result).to eq %(Regexp.new( "
|
693
|
+
it "returns: 'Regexp.new( \".*content.*\" )'" do
|
694
|
+
expect(result).to eq %(Regexp.new( ".*#{regex}.*" ))
|
695
695
|
end
|
696
696
|
|
697
697
|
context "when using the Aggregations visitor" do
|
@@ -709,8 +709,8 @@ describe MSFLVisitors::Visitor do
|
|
709
709
|
|
710
710
|
let(:node) { MSFLVisitors::Nodes::Regex.new regex }
|
711
711
|
|
712
|
-
it "returns: 'Regexp.new( \"this\\ /\\ needs\\ to\\ %\\ \\{be,escaped\\}\\ \\*\\.\\ \\^\\[or\\]\\ \\|\\ \\\\else
|
713
|
-
expect(result).to eq "Regexp.new( \"this\\ /\\ needs\\ to\\ %\\ \\{be,escaped\\}\\ \\*\\.\\ \\^\\[or\\]\\ \\|\\ \\\\else
|
712
|
+
it "returns: 'Regexp.new( \".*this\\ /\\ needs\\ to\\ %\\ \\{be,escaped\\}\\ \\*\\.\\ \\^\\[or\\]\\ \\|\\ \\\\else.*\" )'" do
|
713
|
+
expect(result).to eq "Regexp.new( \".*this\\ /\\ needs\\ to\\ %\\ \\{be,escaped\\}\\ \\*\\.\\ \\^\\[or\\]\\ \\|\\ \\\\else.*\" )"
|
714
714
|
end
|
715
715
|
|
716
716
|
context "when using the Aggregations visitor" do
|