cql-ruby 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,6 +47,7 @@ class CqlLexer
47
47
  end
48
48
 
49
49
  def find_quoted_string_end( s, position )
50
+
50
51
  is_backslashed = false
51
52
  for i in position+1..s.length
52
53
  if s[i..i] == '\\'
@@ -134,7 +135,7 @@ class CqlLexer
134
135
  return
135
136
  end
136
137
  @value = @simple_tokens[ @index ]
137
- if /[0-9]+/ =~ @value
138
+ if /^[0-9]+$/ =~ @value
138
139
  @token_type = CqlLexer::TT_NUMBER
139
140
  elsif @value.length > 1
140
141
  if @value.slice(0..0) == '"'
@@ -27,6 +27,18 @@ class TestCqlParser < Test::Unit::TestCase
27
27
  # and round-trip it comes back.
28
28
  assert_equal('field relation "there is \\"phrase here\\""', node.to_cql)
29
29
  end
30
+
31
+ def test_tokens_ending_in_numbers
32
+ # Not sure why tokens ending in numbers were a bug, first test then
33
+ # fix.
34
+ parser = CqlRuby::CqlParser.new
35
+ parser.debug = false
36
+
37
+ cql = 'number_field = "one_1 two_2"'
38
+ tree = parser.parse(cql)
39
+
40
+ assert_equal(cql, tree.to_cql )
41
+ end
30
42
 
31
43
  def test_parser
32
44
  parser = CqlRuby::CqlParser.new
@@ -33,13 +33,20 @@ class CqlToSolrTest < Test::Unit::TestCase
33
33
  end
34
34
 
35
35
  def test_rel_any
36
- assert_to_solr_eq('column cql.any "one two three"', 'column:(one OR two OR three)')
36
+ assert_to_solr_eq('column cql.any "one_term two_term three_term"', 'column:(one_term OR two_term OR three_term)')
37
37
  end
38
38
 
39
+ # For some reason these particular tokens caaused a bug
40
+ def test_any_number_tokens
41
+ assert_to_solr_eq('number_field cql.any "bib_1 bib_2"', 'number_field:(bib_1 OR bib_2)')
42
+ end
43
+
44
+
39
45
  def test_rel_all
40
46
  assert_to_solr_eq('column cql.all "one two three"', 'column:(+one +two +three)')
41
47
  end
42
48
 
49
+
43
50
  def test_rel_not
44
51
  # Depending on solr schema, this will really map to "does not include phrase", not "does not exactly equal", best we can do.
45
52
  assert_to_solr_eq('column <> "one two three"', '-column:"one two three"')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cql-ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
4
+ hash: 59
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 1
10
- version: 0.8.1
9
+ - 2
10
+ version: 0.8.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonathan Rochkind
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-06-28 00:00:00 -04:00
19
+ date: 2010-07-07 00:00:00 -04:00
20
20
  default_executable:
21
21
  dependencies: []
22
22