picky 3.6.12 → 3.6.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,6 +11,8 @@ module Picky
11
11
  #
12
12
  class ExactFirst
13
13
 
14
+ # TODO Refactor!
15
+ #
14
16
  delegate :add,
15
17
  :qualifiers,
16
18
  :exact,
@@ -26,6 +28,10 @@ module Picky
26
28
  :load,
27
29
 
28
30
  :empty,
31
+ :prepared_index_file,
32
+ :tokenizer,
33
+ :cache,
34
+ :from,
29
35
 
30
36
  :bundle_for,
31
37
  :build_realtime_mapping,
@@ -4,6 +4,10 @@ require 'spec_helper'
4
4
 
5
5
  describe "exact first" do
6
6
 
7
+ before(:each) do
8
+ Picky::Indexes.clear_indexes
9
+ end
10
+
7
11
  it 'returns exact results first' do
8
12
  index = Picky::Index.new :exact_first do
9
13
  source { [] }
@@ -26,4 +30,28 @@ describe "exact first" do
26
30
  exact_first.search("disc").ids.should == [2, 1] # Not exact, so not first.
27
31
  end
28
32
 
33
+ it 'can do dumps/loads etc.' do
34
+ require 'ostruct'
35
+
36
+ data = Picky::Index.new :exact_first do
37
+ source { [
38
+ OpenStruct.new(id: 1, text: "discofox"),
39
+ OpenStruct.new(id: 2, text: "disco")
40
+ ] }
41
+ category :text, partial: Picky::Partial::Substring.new(from: 1)
42
+ end
43
+ normal = Picky::Search.new data
44
+ Picky::Indexes.index_for_tests
45
+
46
+ normal.search("disco").ids.should == [1, 2] # Ordering with which it was added.
47
+
48
+ data = Picky::Wrappers::Category::ExactFirst.wrap data
49
+ exact_first = Picky::Search.new data
50
+
51
+ Picky::Indexes.index_for_tests
52
+
53
+ exact_first.search("disco").ids.should == [2, 1] # Exact first.
54
+ exact_first.search("disc").ids.should == [1, 2] # Not exact, so not first.
55
+ end
56
+
29
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picky
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.12
4
+ version: 3.6.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70344058312240 !ruby/object:Gem::Requirement
16
+ requirement: &70225485191560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,21 +21,21 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70344058312240
24
+ version_requirements: *70225485191560
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: picky-client
27
- requirement: &70344058311560 !ruby/object:Gem::Requirement
27
+ requirement: &70225485190820 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: 3.6.12
32
+ version: 3.6.13
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70344058311560
35
+ version_requirements: *70225485190820
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rack
38
- requirement: &70344058310640 !ruby/object:Gem::Requirement
38
+ requirement: &70225485189940 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70344058310640
46
+ version_requirements: *70225485189940
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rack_fast_escape
49
- requirement: &70344058309960 !ruby/object:Gem::Requirement
49
+ requirement: &70225485189200 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70344058309960
57
+ version_requirements: *70225485189200
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: text
60
- requirement: &70344058309020 !ruby/object:Gem::Requirement
60
+ requirement: &70225485188260 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70344058309020
68
+ version_requirements: *70225485188260
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: yajl-ruby
71
- requirement: &70344058308480 !ruby/object:Gem::Requirement
71
+ requirement: &70225485187840 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70344058308480
79
+ version_requirements: *70225485187840
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: activesupport
82
- requirement: &70344058307980 !ruby/object:Gem::Requirement
82
+ requirement: &70225485187340 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '3.0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70344058307980
90
+ version_requirements: *70225485187340
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: unicorn
93
- requirement: &70344058323920 !ruby/object:Gem::Requirement
93
+ requirement: &70225485203280 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70344058323920
101
+ version_requirements: *70225485203280
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: sinatra
104
- requirement: &70344058323380 !ruby/object:Gem::Requirement
104
+ requirement: &70225485202700 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: '0'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *70344058323380
112
+ version_requirements: *70225485202700
113
113
  description: Fast Ruby semantic text search engine with comfortable single field interface.
114
114
  email: florian.hanke+picky@gmail.com
115
115
  executables: