picky 4.23.2 → 4.24.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: c658917caa814d948ecb3f262c541fa152df12aa
4
- data.tar.gz: 1f0022bcd3f71ef234f4cfe9b1a28ea78c4a5553
3
+ metadata.gz: c1ccf80ba3d51955047795eb9a44e0bb90eafa14
4
+ data.tar.gz: 90a2c17f69019a6dbbdbc214ca238c8183443dab
5
5
  SHA512:
6
- metadata.gz: 4fec0aafc8adc4ebf9f12b4f09e69a34aee4a7afea0266bb9d5ab7ab1d3c4322e765467f06ddd183c82f5a32b65cb5a5d79b7be0c78226f3a5140fbeb6c980c6
7
- data.tar.gz: c5f898b6a63da42c4b3fb03be646a3b7823c03e7cd7f227ab414af11836f4deea6eb0c12a24d6838e0b52d5197ab23ea60c52f25b2ece75f4bd452ef62c05b0b
6
+ metadata.gz: 41d01ef1dbe5506274a96747a0dba0617fde5b50735cd59041901d661fea1ba328cfecf76376b06888eb73dcd2f1db5b8c1acb731317487857ae802c1b52f036
7
+ data.tar.gz: 05c23d26a4a86e04a84bcf9ba73b5e67a9a391d9541408a63c366e15cce6499cc272a94e0f364adaadf3605e948e8a26cfc5031fdde8478db6edb1ed8fc96542
@@ -206,13 +206,13 @@ module Picky
206
206
 
207
207
  # Define a character which makes a token a range token.
208
208
  #
209
- # Default is '-'.
209
+ # Default is ''.
210
210
  #
211
211
  # Example:
212
- # Picky::Query::Token.range_character = ""
213
- # try.search("year:20002008") # Will find results in a range.
212
+ # Picky::Query::Token.range_character = "-"
213
+ # try.search("year:2000-2008") # Will find results in a range.
214
214
  #
215
- @@range_character = '-'
215
+ @@range_character = ?…
216
216
  def self.range_character= character
217
217
  @@range_character = character
218
218
  end
@@ -9,7 +9,7 @@ describe 'custom delimiters' do
9
9
  Picky::Query::Token.no_partial_character = '"'
10
10
  Picky::Query::Token.similar_character = '~'
11
11
  Picky::Query::Token.no_similar_character = '"'
12
- Picky::Query::Token.range_character = '-'
12
+ Picky::Query::Token.range_character = ''
13
13
  Picky::Query::Token.qualifier_text_delimiter = /:/
14
14
  Picky::Query::Token.qualifiers_delimiter = /,/
15
15
  end
@@ -102,10 +102,10 @@ describe 'custom delimiters' do
102
102
  index.add rangy.new(4, 3000)
103
103
 
104
104
  try = Picky::Search.new index
105
- try.search("1980-2015").ids.should == [2,3,4]
106
-
107
- try.search("1980…2015").ids.should == []
108
- Picky::Query::Token.range_character = "…"
109
105
  try.search("1980…2015").ids.should == [2,3,4]
106
+
107
+ try.search("1980-2015").ids.should == []
108
+ Picky::Query::Token.range_character = ?-
109
+ try.search("1980-2015").ids.should == [2,3,4]
110
110
  end
111
111
  end
@@ -73,7 +73,7 @@ describe "OR token" do
73
73
  it { try.search("something,other:ohai").ids.should == [] }
74
74
  it { try.search("text:taster~|text:kthxbye hello").ids.should == [2, 1] }
75
75
  it { try.search("text:test*|kthxbye hello").ids.should == [2, 1] }
76
- it { try.search("text:11-15|kthxbye hello").ids.should == [2, 1] }
76
+ it { try.search("text:1115|kthxbye hello").ids.should == [2, 1] }
77
77
  it { try.search("hello text,other:ohai|text:kthxbye").ids.should == [1, 2] }
78
78
  it { try.search("hello something,other:ohai|kthxbye").ids.should == [2] }
79
79
  it { try.search("hello text:oh*|text:kthxbya~").ids.should == [1, 2] }
@@ -31,49 +31,49 @@ describe 'range queries' do
31
31
  end
32
32
 
33
33
  it 'works with misses' do
34
- try.search('900-1200').ids.should == []
34
+ try.search('9001200').ids.should == []
35
35
  end
36
36
 
37
37
  it 'survives huge ranges' do
38
- try.search('0-10000 a').ids.should == [3]
38
+ try.search('010000 a').ids.should == [3]
39
39
 
40
40
  # Quote to make it non-partial.
41
41
  #
42
- try.search('0-3000"').ids.should == [7,6,2,8,3,1,4,5]
42
+ try.search('03000"').ids.should == [7,6,2,8,3,1,4,5]
43
43
  end
44
44
  it 'is semi-reasonably fast with huge ranges' do
45
45
  # Quote to make it non-partial.
46
46
  #
47
- performance_of { try.search('0-3000"') }.should < 0.21
47
+ performance_of { try.search('03000"') }.should < 0.21
48
48
 
49
49
  # Note it is much much faster with an additional token.
50
50
  #
51
- performance_of { try.search('0-3000 a') }.should < 0.0085
51
+ performance_of { try.search('03000 a') }.should < 0.0085
52
52
  end
53
53
 
54
54
  it 'handles basic range queries' do
55
- try.search('1980-2001').ids.should == [8,3,1]
56
- try.search('f-u').ids.should == [2,1,8,7,4]
55
+ try.search('19802001').ids.should == [8,3,1]
56
+ try.search('fu').ids.should == [2,1,8,7,4]
57
57
  end
58
58
 
59
59
  it 'can handle qualifiers' do
60
- try.search('year:1980-2001').ids.should == [8,3,1]
61
- try.search('alphabet:f-u').ids.should == [2,1,8,7,4]
60
+ try.search('year:19802001').ids.should == [8,3,1]
61
+ try.search('alphabet:fu').ids.should == [2,1,8,7,4]
62
62
  end
63
63
 
64
64
  it 'can be combined with other search words' do
65
- try.search('1980-2001 a').ids.should == [3]
66
- try.search('f-u 881').ids.should == [7]
65
+ try.search('19802001 a').ids.should == [3]
66
+ try.search('fu 881').ids.should == [7]
67
67
  end
68
68
 
69
69
  it 'can handle multiple range queries' do
70
- try.search('1980-2001 a-h').ids.should == [3,1]
71
- try.search('f-u 881-1977').ids.should == [2,7]
70
+ try.search('19802001 ah').ids.should == [3,1]
71
+ try.search('fu 8811977').ids.should == [2,7]
72
72
  end
73
73
 
74
74
  it 'can be combined with partial queries' do
75
- try.search('198* a-h').ids.should == [3]
76
- try.search('a-h 198').ids.should == [3]
75
+ try.search('198* ah').ids.should == [3]
76
+ try.search('ah 198').ids.should == [3]
77
77
  end
78
78
 
79
79
  it 'works with nonsensical ranges' do
@@ -126,11 +126,11 @@ describe 'range queries' do
126
126
  end
127
127
 
128
128
  it 'allows injection of custom range classes' do
129
- try.search('hour:10-2').ids.should == [6, 5, 1, 2, 7]
129
+ try.search('hour:102').ids.should == [6, 5, 1, 2, 7]
130
130
  end
131
131
 
132
132
  it 'allows injection of custom range classes' do
133
- try.search('hour:0-11').ids.should == [1, 2, 7, 8, 3, 4, 6, 5]
133
+ try.search('hour:011').ids.should == [1, 2, 7, 8, 3, 4, 6, 5]
134
134
  end
135
135
  end
136
136
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picky
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.23.2
4
+ version: 4.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Hanke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-04 00:00:00.000000000 Z
11
+ date: 2014-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport