lsolr 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +5 -5
  2. data/lib/lsolr.rb +7 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3d4c5d52577c944f0791a16c8466af1d3039c66d
4
- data.tar.gz: 15970c48d02ee7e663fb4817069a4989a3f0b7fd
2
+ SHA256:
3
+ metadata.gz: e884aa57682f3715a2070c525fb222b2d903ecc8996a8d4f0339c650b5c67876
4
+ data.tar.gz: 014e5b4258a969035f2f2584fa12c3bd56b1b1ae0ff9197f2b3894f8ba7268ea
5
5
  SHA512:
6
- metadata.gz: 866651def401510477a12cdd305c0a4a432f392a837c68b246332ffa392f197a8183baf938d377d3ad9ddd386cb823afb9b4ef8de7f01cc6838ed617521cfc7e
7
- data.tar.gz: 2ab681e15a5e71e74e89583886e96deb9916cfbc5c11ad89f6eb5defa93f2da9120f533eadafa74b83421822ffd10e3288666461e2ef17751627d9c92411aa21
6
+ metadata.gz: 812e0344c84e1b4bb878551b45366c54c0cfbe8c44b11420cd6560af99d6763c926fe1fb5011c6f8d568dcddb218f69ee7eaa1a6e51a74be2c5135446f3cb429
7
+ data.tar.gz: 682545466a8173b25191498109b3496c676f315a6cf20b401e2fe8ed16f6b15b2ded3dde69d1beec20dd8f779ec257be6bfdc637469b1da2dc73a0097e61e03f
data/lib/lsolr.rb CHANGED
@@ -79,7 +79,7 @@ class LSolr
79
79
  RESERVED_WORDS = /(AND|OR|NOT)/
80
80
  REPLACEMENT_CHAR = ' '
81
81
 
82
- attr_accessor :prev, :operator, :left_parentheses, :right_parentheses
82
+ attr_accessor :prev, :operator, :left_parentheses, :right_parentheses, :expr_not
83
83
 
84
84
  class << self
85
85
  # Builds composite query and returns builder instance.
@@ -131,7 +131,7 @@ class LSolr
131
131
  def initialize(field)
132
132
  raise ArgumentError, 'Please specify a field name.' if field.nil? || field.empty?
133
133
 
134
- @not = ''
134
+ @expr_not = ''
135
135
  @field = field
136
136
  @value = ''
137
137
  @range_first = ''
@@ -144,11 +144,11 @@ class LSolr
144
144
  # Returns Apache Solr standard lucene type query string.
145
145
  #
146
146
  # @return [String] a stringified query
147
- def to_s
147
+ def to_s # rubocop:disable Metrics/AbcSize
148
148
  @value = "#{@range_first} #{TO} #{@range_last}" if range_search?
149
149
  raise IncompleteQueryError, 'Please specify a search value.' if blank?
150
150
 
151
- expr = "#{left_parentheses.join}#{@not}#{@field}:#{@value}#{right_parentheses.join}"
151
+ expr = "#{expr_not}#{left_parentheses.join}#{@field}:#{@value}#{right_parentheses.join}"
152
152
  expr = "#{prev} #{operator} #{expr}" if !prev.nil? && prev.present?
153
153
  "#{expr}#{@boost}"
154
154
  end
@@ -187,8 +187,9 @@ class LSolr
187
187
  #
188
188
  # @return [LSolr] self instance
189
189
  def not
190
- @not = "#{NOT} "
191
- self
190
+ this = dup
191
+ this.head.expr_not = "#{NOT} "
192
+ this
192
193
  end
193
194
 
194
195
  # Boosts a query expression.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lsolr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taishi Kasuga
@@ -38,7 +38,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
38
38
  version: '0'
39
39
  requirements: []
40
40
  rubyforge_project:
41
- rubygems_version: 2.6.13
41
+ rubygems_version: 2.7.3
42
42
  signing_key:
43
43
  specification_version: 4
44
44
  summary: A query builder of Apache Solr for Ruby