textquery 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/textquery/textquery_grammar.treetop +20 -6
- data/spec/textquery_spec.rb +11 -1
- data/textquery.gemspec +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
@@ -48,12 +48,20 @@ grammar TextQueryGrammar
|
|
48
48
|
[^\s\(\)]+ <WordMatch>
|
49
49
|
end
|
50
50
|
|
51
|
-
rule
|
52
|
-
[
|
51
|
+
rule single_quote
|
52
|
+
[']
|
53
53
|
end
|
54
54
|
|
55
|
-
rule
|
56
|
-
['
|
55
|
+
rule single_quote_words
|
56
|
+
[^']+ <WordMatch>
|
57
|
+
end
|
58
|
+
|
59
|
+
rule double_quote
|
60
|
+
["]
|
61
|
+
end
|
62
|
+
|
63
|
+
rule double_quote_words
|
64
|
+
[^"]+ <WordMatch>
|
57
65
|
end
|
58
66
|
|
59
67
|
rule value
|
@@ -69,9 +77,15 @@ grammar TextQueryGrammar
|
|
69
77
|
end
|
70
78
|
}
|
71
79
|
/
|
72
|
-
|
80
|
+
double_quote space double_quote_words space double_quote {
|
81
|
+
def eval(text, opt)
|
82
|
+
double_quote_words.eval(text, opt)
|
83
|
+
end
|
84
|
+
}
|
85
|
+
/
|
86
|
+
single_quote space single_quote_words space single_quote {
|
73
87
|
def eval(text, opt)
|
74
|
-
|
88
|
+
single_quote_words.eval(text, opt)
|
75
89
|
end
|
76
90
|
}
|
77
91
|
/
|
data/spec/textquery_spec.rb
CHANGED
@@ -135,6 +135,16 @@ describe TextQuery do
|
|
135
135
|
parse('"to be" OR NOT "to be"').eval("to be").should be_true
|
136
136
|
end
|
137
137
|
|
138
|
+
it "should accept mixed quotes inside the exact match queries" do
|
139
|
+
parse("seattle's best").eval("seattle's best").should be_true
|
140
|
+
|
141
|
+
parse("peets OR \"seattle's best\"").eval("peets").should be_true
|
142
|
+
parse("peets OR \"seattle's best\"").eval("seattle's").should be_false
|
143
|
+
|
144
|
+
parse("\"seattle's best\"").eval("seattle's best coffee").should be_true
|
145
|
+
parse('"seattle\'s best"').eval("seattle's best coffee").should be_true
|
146
|
+
end
|
147
|
+
|
138
148
|
it "should treat spaces as implicit ANDs" do
|
139
149
|
parse("a b").eval("a c b").should be_true
|
140
150
|
parse("b a c").eval("a c b").should be_true
|
@@ -172,7 +182,7 @@ describe TextQuery do
|
|
172
182
|
|
173
183
|
parse("~a~3").eval("daffy").should be_true
|
174
184
|
parse("a~1").eval("adf").should be_false
|
175
|
-
|
185
|
+
|
176
186
|
parse("a~1 AND b").eval("adf b").should be_false
|
177
187
|
parse("a~2 AND b").eval("adf b").should be_true
|
178
188
|
parse("a~3 AND b").eval("adf b").should be_false
|
data/textquery.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{textquery}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ilya Grigorik"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-08-18}
|
13
13
|
s.description = %q{Evaluate any text against a collection of match rules}
|
14
14
|
s.email = %q{ilya@igvita.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 6
|
9
|
+
version: 0.1.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ilya Grigorik
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-08-18 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|