lsolr 0.0.7 → 0.0.8

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 +4 -4
  2. data/lib/lsolr.rb +13 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0de60c66ff9d0bcd24c7caa5c3d86f1bb829c341
4
- data.tar.gz: dd3a5e496f35898ff3147860b83b912829f186bc
3
+ metadata.gz: 3d4c5d52577c944f0791a16c8466af1d3039c66d
4
+ data.tar.gz: 15970c48d02ee7e663fb4817069a4989a3f0b7fd
5
5
  SHA512:
6
- metadata.gz: daef2067c282dfc6bc0312800a6191cc31931e4fba5c15e13116fe9de9f7100f0da3109ca27941860c5987c97b1d7299dea4428ff22ce17ae56779572456c811
7
- data.tar.gz: 16f091cd2ccfd556024ede8c33477ec5a888c175de2d6d1bc3b71d3234a1357cd82796d5b2f07e9ece6ef87a17914a7625ee301844b15a860629f8137430cb00
6
+ metadata.gz: 866651def401510477a12cdd305c0a4a432f392a837c68b246332ffa392f197a8183baf938d377d3ad9ddd386cb823afb9b4ef8de7f01cc6838ed617521cfc7e
7
+ data.tar.gz: 2ab681e15a5e71e74e89583886e96deb9916cfbc5c11ad89f6eb5defa93f2da9120f533eadafa74b83421822ffd10e3288666461e2ef17751627d9c92411aa21
@@ -176,7 +176,7 @@ class LSolr
176
176
  # @return [LSolr] copied self instance
177
177
  def wrap
178
178
  this = dup
179
- take_head(this).left_parentheses << PARENTHESIS_LEFT
179
+ this.head.left_parentheses << PARENTHESIS_LEFT
180
180
  this.right_parentheses << PARENTHESIS_RIGHT
181
181
  this
182
182
  end
@@ -354,6 +354,17 @@ class LSolr
354
354
  link(another, OR)
355
355
  end
356
356
 
357
+ # Returns a first term of query.
358
+ #
359
+ # @return [LSolr] a first term of query.
360
+ def head
361
+ if !prev.nil? && prev.present?
362
+ prev.head
363
+ else
364
+ self
365
+ end
366
+ end
367
+
357
368
  private
358
369
 
359
370
  def initialize_copy(obj)
@@ -376,17 +387,12 @@ class LSolr
376
387
  return self if another.nil? || another.blank?
377
388
 
378
389
  another = another.dup
379
- head = take_head(another)
390
+ head = another.head
380
391
  head.prev = dup
381
392
  head.operator = operator
382
393
  another
383
394
  end
384
395
 
385
- def take_head(element)
386
- while !element.prev.nil? && element.prev.present? do element = element.prev end
387
- element
388
- end
389
-
390
396
  def format_date(date)
391
397
  msec_str = case date
392
398
  when Date then date.strftime(FORMAT_MILLISECOND_FOR_DATE_TYPE).gsub(date.strftime(FORMAT_SECOND), '')
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.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taishi Kasuga