querylicious 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1f4d432e05a5f75fcfc89b7cdba9c08274e3a53
4
- data.tar.gz: 8180af54ac20004c003e4ff8db81f360cbad2387
3
+ metadata.gz: 4b87db5c227da769fcd523b34826d1075a77ba8a
4
+ data.tar.gz: 29e2d6e298dfc6339d459624f06c0a2ca9e70bc8
5
5
  SHA512:
6
- metadata.gz: 1f327774005b652a257346a7007ca6b3dfc79ac30ea6b1dd125500629478051ec53fb22023052f609d9003aeb2e544d38bc42b721397cd6c2cb47af696823764
7
- data.tar.gz: 0c16fbe5446519fee9b9b4111791e407ff20435e8abb29ae9e16c0c3ae9e8f03782353f1140c56bfdb01c8bf53aa1a601c88445a02fd0279a560ae43c48f909d
6
+ metadata.gz: 8d56f13d5e40e3f7065d1e0f52bfdb67e3f243b0b3e5e5965b982a934e931c6556d719f235577a2325958ee4fd729a681b0618f7d4a2381d28fd990625d563a8
7
+ data.tar.gz: d8ba0dcf09d32aca4bfb6ef9004114020ff7b8df769018931b15db96abfc31434da3b69ce1785159e96c60fe5221f2d3a135cfb37f8a78c33a171c66e1e0d7e7
data/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.3.0] - 2017-11-28
10
+ ### Added
11
+ - Add `not_key` reducer alias
12
+
13
+ ### Changed
14
+ - Updated required dependency versions
15
+
9
16
  ## [0.2.0] - 2017-08-15
10
17
  ### Added
11
18
  - Add support for lists (arrays)
@@ -20,5 +27,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
20
27
  ### Added
21
28
  - Initial implementation of querylicious, with query-parser and query-reducer
22
29
 
23
- [Unreleased]: https://github.com/Sonans/querylicious/compare/v0.1.0...HEAD
30
+ [Unreleased]: https://github.com/Sonans/querylicious/compare/v0.3.0...HEAD
31
+ [0.3.0]: https://github.com/Sonans/querylicious/compare/v0.2.0...v0.3.0
32
+ [0.2.0]: https://github.com/Sonans/querylicious/compare/v0.1.0...v0.2.0
24
33
  [0.1.0]: https://github.com/Sonans/querylicious/compare/v0.0.0...v0.1.0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -14,7 +14,11 @@ module Querylicious
14
14
  end
15
15
 
16
16
  def not_phrase(&block)
17
- key('phrase', op: :not_eql, type: Types::Strict::String, &block)
17
+ not_key('phrase', type: Types::Strict::String, &block)
18
+ end
19
+
20
+ def not_key(key, type: Types::Any, &block)
21
+ key(key, op: :not_eql, type: type, &block)
18
22
  end
19
23
  end
20
24
 
@@ -11,7 +11,7 @@ module Querylicious
11
11
 
12
12
  rule(:phrase) do
13
13
  (
14
- (str('NOT').as(:symbol).as(:op) >> space).maybe >> (word | string)
14
+ (str('NOT').as(:symbol).as(:op) >> space).maybe >> (word | quoted_string)
15
15
  ).as(:phrase)
16
16
  end
17
17
 
@@ -22,14 +22,17 @@ module Querylicious
22
22
 
23
23
  rule(:key) { word }
24
24
  rule(:value) do
25
- list | range | (kv_op.as(:op).maybe >> (datetime | integer | word | string))
25
+ list | range | (kv_op.as(:op).maybe >> (datetime | integer | simple_string | quoted_string))
26
26
  end
27
27
 
28
28
  rule(:kv_op) { (str('>=') | str('>') | str('<=') | str('<')).as(:symbol) }
29
29
 
30
30
  rule(:word) { match('[[:graph:]&&[^":.,]]').repeat(1).as(:string) }
31
- rule(:string) do
32
- quotemark >> match('[[^"]&&[:print:]]').repeat(0).as(:string) >> quotemark
31
+ rule(:simple_string) do
32
+ match('[[:graph:]&&[^".,]]').repeat(1).as(:string)
33
+ end
34
+ rule(:quoted_string) do
35
+ str('"') >> (str('\"') | match('[[^"]&&[:print:]]')).repeat(0).as(:string) >> str('"')
33
36
  end
34
37
  rule(:integer) { match('\d').repeat(1).as(:integer) }
35
38
 
@@ -41,9 +44,9 @@ module Querylicious
41
44
  end
42
45
 
43
46
  rule(:list) do
44
- ((range | datetime | integer | word | string) >>
47
+ ((range | datetime | integer | simple_string | quoted_string) >>
45
48
  (comma >>
46
- (range | datetime | integer | word | string)).repeat(1)
49
+ (range | datetime | integer | simple_string | quoted_string)).repeat(1)
47
50
  ).as(:list)
48
51
  end
49
52
 
@@ -61,7 +64,6 @@ module Querylicious
61
64
  str('Z') | (str('+') >> digits2 >> str(':') >> digits2)
62
65
  end
63
66
 
64
- rule(:quotemark) { match('"') }
65
67
  rule(:star) { str('*').as(:symbol) }
66
68
  rule(:dotdot) { str('..') }
67
69
  rule(:comma) { str(',') }
@@ -9,7 +9,7 @@ module Querylicious
9
9
  # Transformer for turning a parsed query string into a list of KeyValuePair
10
10
  class Transform < Parslet::Transform
11
11
  rule('') { nil }
12
- rule(string: simple(:it)) { Types::Coercible::String[it] }
12
+ rule(string: simple(:it)) { Types::Coercible::String[it].gsub('\"', '"') }
13
13
  rule(integer: simple(:it)) { Types::Form::Int[it] }
14
14
  rule(date: simple(:it)) { Types::Form::Date[it] }
15
15
  rule(datetime: simple(:it)) { Types::Form::DateTime[it] }
@@ -44,7 +44,10 @@ module Querylicious
44
44
  end
45
45
 
46
46
  rule(phrase: simple(:text)) do
47
- KeyValuePair.new(key: 'phrase', value: text)
47
+ KeyValuePair.new(
48
+ key: 'phrase',
49
+ value: Types::Coercible::String[text]
50
+ )
48
51
  end
49
52
  rule(phrase: { object: simple(:text), op: simple(:op) }) do
50
53
  KeyValuePair.new(
data/querylicious.gemspec CHANGED
@@ -22,9 +22,9 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_runtime_dependency 'parslet', '~> 1.8'
24
24
  spec.add_runtime_dependency 'dry-matcher', '~> 0.6.0'
25
- spec.add_runtime_dependency 'dry-types', '~> 0.11.0'
26
- spec.add_runtime_dependency 'dry-struct', '~> 0.3.1'
27
- spec.add_runtime_dependency 'dry-initializer', '~> 1.4'
25
+ spec.add_runtime_dependency 'dry-types', '~> 0.12.0'
26
+ spec.add_runtime_dependency 'dry-struct', '~> 0.4.0'
27
+ spec.add_runtime_dependency 'dry-initializer', '~> 2.3'
28
28
 
29
29
  spec.add_development_dependency 'bundler', '~> 1.15'
30
30
  spec.add_development_dependency 'rake', '~> 12.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: querylicious
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jo-Herman Haugholt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-16 00:00:00.000000000 Z
11
+ date: 2017-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parslet
@@ -44,42 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.11.0
47
+ version: 0.12.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.11.0
54
+ version: 0.12.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: dry-struct
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.3.1
61
+ version: 0.4.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.3.1
68
+ version: 0.4.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: dry-initializer
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.4'
75
+ version: '2.3'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.4'
82
+ version: '2.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -239,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
239
  version: '0'
240
240
  requirements: []
241
241
  rubyforge_project:
242
- rubygems_version: 2.6.11
242
+ rubygems_version: 2.6.13
243
243
  signing_key:
244
244
  specification_version: 4
245
245
  summary: An opinionated search query parser