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 +4 -4
- data/lib/picky/query/token.rb +4 -4
- data/spec/functional/custom_delimiters_spec.rb +5 -5
- data/spec/functional/or_spec.rb +1 -1
- data/spec/functional/range_queries_spec.rb +17 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1ccf80ba3d51955047795eb9a44e0bb90eafa14
|
4
|
+
data.tar.gz: 90a2c17f69019a6dbbdbc214ca238c8183443dab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41d01ef1dbe5506274a96747a0dba0617fde5b50735cd59041901d661fea1ba328cfecf76376b06888eb73dcd2f1db5b8c1acb731317487857ae802c1b52f036
|
7
|
+
data.tar.gz: 05c23d26a4a86e04a84bcf9ba73b5e67a9a391d9541408a63c366e15cce6499cc272a94e0f364adaadf3605e948e8a26cfc5031fdde8478db6edb1ed8fc96542
|
data/lib/picky/query/token.rb
CHANGED
@@ -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:2000
|
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
|
data/spec/functional/or_spec.rb
CHANGED
@@ -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
|
76
|
+
it { try.search("text:11…15|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
|
34
|
+
try.search('900…1200').ids.should == []
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'survives huge ranges' do
|
38
|
-
try.search('0
|
38
|
+
try.search('0…10000 a').ids.should == [3]
|
39
39
|
|
40
40
|
# Quote to make it non-partial.
|
41
41
|
#
|
42
|
-
try.search('0
|
42
|
+
try.search('0…3000"').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
|
47
|
+
performance_of { try.search('0…3000"') }.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
|
51
|
+
performance_of { try.search('0…3000 a') }.should < 0.0085
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'handles basic range queries' do
|
55
|
-
try.search('1980
|
56
|
-
try.search('f
|
55
|
+
try.search('1980…2001').ids.should == [8,3,1]
|
56
|
+
try.search('f…u').ids.should == [2,1,8,7,4]
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'can handle qualifiers' do
|
60
|
-
try.search('year:1980
|
61
|
-
try.search('alphabet:f
|
60
|
+
try.search('year:1980…2001').ids.should == [8,3,1]
|
61
|
+
try.search('alphabet:f…u').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
|
66
|
-
try.search('f
|
65
|
+
try.search('1980…2001 a').ids.should == [3]
|
66
|
+
try.search('f…u 881').ids.should == [7]
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'can handle multiple range queries' do
|
70
|
-
try.search('1980
|
71
|
-
try.search('f
|
70
|
+
try.search('1980…2001 a…h').ids.should == [3,1]
|
71
|
+
try.search('f…u 881…1977').ids.should == [2,7]
|
72
72
|
end
|
73
73
|
|
74
74
|
it 'can be combined with partial queries' do
|
75
|
-
try.search('198* a
|
76
|
-
try.search('a
|
75
|
+
try.search('198* a…h').ids.should == [3]
|
76
|
+
try.search('a…h 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
|
129
|
+
try.search('hour:10…2').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
|
133
|
+
try.search('hour:0…11').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.
|
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-
|
11
|
+
date: 2014-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|