ultrasphinx 1.5.2 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. data.tar.gz.sig +2 -3
  2. data/CHANGELOG +2 -0
  3. data/Manifest +134 -28
  4. data/TODO +0 -1
  5. data/examples/{app.multi → ap.multi} +1 -1
  6. data/examples/default.base +2 -0
  7. data/lib/ultrasphinx.rb +19 -17
  8. data/lib/ultrasphinx/configure.rb +36 -28
  9. data/lib/ultrasphinx/core_extensions.rb +11 -1
  10. data/lib/ultrasphinx/fields.rb +16 -9
  11. data/lib/ultrasphinx/hex_to_int.sql +15 -0
  12. data/lib/ultrasphinx/is_indexed.rb +9 -7
  13. data/lib/ultrasphinx/search.rb +27 -13
  14. data/lib/ultrasphinx/search/internals.rb +36 -16
  15. data/lib/ultrasphinx/spell.rb +13 -4
  16. data/lib/ultrasphinx/ultrasphinx.rb +30 -20
  17. data/tasks/ultrasphinx.rake +31 -6
  18. data/test/integration/app/README +182 -0
  19. data/test/integration/app/Rakefile +10 -0
  20. data/test/integration/app/app/controllers/addresses_controller.rb +85 -0
  21. data/test/integration/app/app/controllers/application.rb +7 -0
  22. data/test/integration/app/app/controllers/sellers_controller.rb +85 -0
  23. data/test/integration/app/app/controllers/states_controller.rb +85 -0
  24. data/test/integration/app/app/controllers/users_controller.rb +85 -0
  25. data/test/integration/app/app/helpers/addresses_helper.rb +2 -0
  26. data/test/integration/app/app/helpers/application_helper.rb +3 -0
  27. data/test/integration/app/app/helpers/sellers_helper.rb +28 -0
  28. data/test/integration/app/app/helpers/states_helper.rb +2 -0
  29. data/test/integration/app/app/helpers/users_helper.rb +2 -0
  30. data/test/integration/app/app/models/geo/address.rb +8 -0
  31. data/test/integration/app/app/models/geo/state.rb +5 -0
  32. data/test/integration/app/app/models/person/user.rb +9 -0
  33. data/test/integration/app/app/models/seller.rb +20 -0
  34. data/test/integration/app/app/views/addresses/edit.html.erb +12 -0
  35. data/test/integration/app/app/views/addresses/index.html.erb +18 -0
  36. data/test/integration/app/app/views/addresses/new.html.erb +11 -0
  37. data/test/integration/app/app/views/addresses/show.html.erb +3 -0
  38. data/test/integration/app/app/views/layouts/addresses.html.erb +17 -0
  39. data/test/integration/app/app/views/layouts/sellers.html.erb +17 -0
  40. data/test/integration/app/app/views/layouts/states.html.erb +17 -0
  41. data/test/integration/app/app/views/layouts/users.html.erb +17 -0
  42. data/test/integration/app/app/views/sellers/edit.html.erb +12 -0
  43. data/test/integration/app/app/views/sellers/index.html.erb +20 -0
  44. data/test/integration/app/app/views/sellers/new.html.erb +11 -0
  45. data/test/integration/app/app/views/sellers/show.html.erb +3 -0
  46. data/test/integration/app/app/views/states/edit.html.erb +12 -0
  47. data/test/integration/app/app/views/states/index.html.erb +19 -0
  48. data/test/integration/app/app/views/states/new.html.erb +11 -0
  49. data/test/integration/app/app/views/states/show.html.erb +3 -0
  50. data/test/integration/app/app/views/users/edit.html.erb +12 -0
  51. data/test/integration/app/app/views/users/index.html.erb +22 -0
  52. data/test/integration/app/app/views/users/new.html.erb +11 -0
  53. data/test/integration/app/app/views/users/show.html.erb +3 -0
  54. data/test/integration/app/config/boot.rb +45 -0
  55. data/test/integration/app/config/database.yml +21 -0
  56. data/test/integration/app/config/environment.rb +11 -0
  57. data/test/integration/app/config/environments/development.rb +7 -0
  58. data/test/integration/app/config/environments/production.rb +18 -0
  59. data/test/integration/app/config/environments/test.rb +19 -0
  60. data/test/integration/app/config/locomotive.yml +6 -0
  61. data/test/integration/app/config/routes.rb +33 -0
  62. data/test/integration/app/config/ultrasphinx/default.base +56 -0
  63. data/test/integration/app/config/ultrasphinx/development.conf +159 -0
  64. data/test/integration/app/config/ultrasphinx/development.conf.canonical +159 -0
  65. data/test/integration/app/db/migrate/001_create_users.rb +16 -0
  66. data/test/integration/app/db/migrate/002_create_sellers.rb +14 -0
  67. data/test/integration/app/db/migrate/003_create_addresses.rb +19 -0
  68. data/test/integration/app/db/migrate/004_create_states.rb +12 -0
  69. data/test/integration/app/db/migrate/005_add_capitalization_to_seller.rb +9 -0
  70. data/test/integration/app/db/migrate/006_add_deleted_to_user.rb +9 -0
  71. data/test/integration/app/db/migrate/007_add_lat_and_long_to_address.rb +11 -0
  72. data/test/integration/app/db/migrate/008_add_mission_statement_to_seller.rb +9 -0
  73. data/test/integration/app/db/schema.rb +45 -0
  74. data/test/integration/app/doc/README_FOR_APP +2 -0
  75. data/test/integration/app/public/404.html +30 -0
  76. data/test/integration/app/public/500.html +30 -0
  77. data/test/integration/app/public/dispatch.cgi +10 -0
  78. data/test/integration/app/public/dispatch.fcgi +24 -0
  79. data/test/integration/app/public/dispatch.rb +10 -0
  80. data/test/integration/app/public/favicon.ico +0 -0
  81. data/test/integration/app/public/images/rails.png +0 -0
  82. data/test/integration/app/public/index.html +277 -0
  83. data/test/integration/app/public/javascripts/application.js +2 -0
  84. data/test/integration/app/public/javascripts/controls.js +833 -0
  85. data/test/integration/app/public/javascripts/dragdrop.js +942 -0
  86. data/test/integration/app/public/javascripts/effects.js +1088 -0
  87. data/test/integration/app/public/javascripts/prototype.js +2515 -0
  88. data/test/integration/app/public/robots.txt +1 -0
  89. data/test/integration/app/public/stylesheets/scaffold.css +74 -0
  90. data/test/integration/app/script/about +3 -0
  91. data/test/integration/app/script/breakpointer +3 -0
  92. data/test/integration/app/script/console +3 -0
  93. data/test/integration/app/script/destroy +3 -0
  94. data/test/integration/app/script/generate +3 -0
  95. data/test/integration/app/script/performance/benchmarker +3 -0
  96. data/test/integration/app/script/performance/profiler +3 -0
  97. data/test/integration/app/script/plugin +3 -0
  98. data/test/integration/app/script/process/inspector +3 -0
  99. data/test/integration/app/script/process/reaper +3 -0
  100. data/test/integration/app/script/process/spawner +3 -0
  101. data/test/integration/app/script/runner +3 -0
  102. data/test/integration/app/script/server +3 -0
  103. data/test/integration/app/test/fixtures/addresses.yml +13 -0
  104. data/test/integration/app/test/fixtures/sellers.yml +11 -0
  105. data/test/integration/app/test/fixtures/states.yml +216 -0
  106. data/test/integration/app/test/fixtures/users.yml +11 -0
  107. data/test/integration/app/test/functional/addresses_controller_test.rb +57 -0
  108. data/test/integration/app/test/functional/sellers_controller_test.rb +57 -0
  109. data/test/integration/app/test/functional/states_controller_test.rb +57 -0
  110. data/test/integration/app/test/functional/users_controller_test.rb +57 -0
  111. data/test/integration/app/test/test_helper.rb +28 -0
  112. data/test/integration/app/test/unit/address_test.rb +10 -0
  113. data/test/integration/app/test/unit/seller_test.rb +10 -0
  114. data/test/integration/app/test/unit/state_test.rb +10 -0
  115. data/test/integration/app/test/unit/user_test.rb +10 -0
  116. data/test/integration/configure_test.rb +23 -0
  117. data/test/integration/search_test.rb +221 -0
  118. data/test/integration/server_test.rb +38 -0
  119. data/test/integration/spell_test.rb +15 -0
  120. data/test/setup.rb +12 -0
  121. data/test/test_all.rb +1 -0
  122. data/test/test_helper.rb +13 -24
  123. data/test/ts.multi +2 -0
  124. data/test/unit/parser_test.rb +86 -86
  125. data/ultrasphinx.gemspec +12 -5
  126. metadata +136 -30
  127. metadata.gz.sig +0 -0
@@ -0,0 +1 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
@@ -0,0 +1,74 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ .fieldWithErrors {
20
+ padding: 2px;
21
+ background-color: red;
22
+ display: table;
23
+ }
24
+
25
+ #errorExplanation {
26
+ width: 400px;
27
+ border: 2px solid red;
28
+ padding: 7px;
29
+ padding-bottom: 12px;
30
+ margin-bottom: 20px;
31
+ background-color: #f0f0f0;
32
+ }
33
+
34
+ #errorExplanation h2 {
35
+ text-align: left;
36
+ font-weight: bold;
37
+ padding: 5px 5px 5px 15px;
38
+ font-size: 12px;
39
+ margin: -7px;
40
+ background-color: #c00;
41
+ color: #fff;
42
+ }
43
+
44
+ #errorExplanation p {
45
+ color: #333;
46
+ margin-bottom: 0;
47
+ padding: 5px;
48
+ }
49
+
50
+ #errorExplanation ul li {
51
+ font-size: 12px;
52
+ list-style: square;
53
+ }
54
+
55
+ div.uploadStatus {
56
+ margin: 5px;
57
+ }
58
+
59
+ div.progressBar {
60
+ margin: 5px;
61
+ }
62
+
63
+ div.progressBar div.border {
64
+ background-color: #fff;
65
+ border: 1px solid grey;
66
+ width: 100%;
67
+ }
68
+
69
+ div.progressBar div.background {
70
+ background-color: #333;
71
+ height: 18px;
72
+ width: 0%;
73
+ }
74
+
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/about'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/breakpointer'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/console'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/destroy'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/generate'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/benchmarker'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/profiler'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/plugin'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/inspector'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/reaper'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/spawner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/runner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/server'
@@ -0,0 +1,13 @@
1
+ <% 1.upto(40) do |num| %>
2
+ <%="address#{num}:" %>
3
+ id: <%= num %>
4
+ user_id: <%= num %>
5
+ name: <%= "Chicago Branch Office #{num}" %>
6
+ line_1: "3344 Airport Road"
7
+ line_2: "Suite 122"
8
+ city: "Chicago"
9
+ state_id: 15
10
+ province_region: "Cook County"
11
+ zip_postal_code: "43554"
12
+ country_id: 2
13
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <% 1.upto(20) do |num| %>
2
+ <%="seller#{num}:" %>
3
+ id: <%= num %>
4
+ user_id: <%= num %>
5
+ company_name: <%= "seller#{num}" %>
6
+ capitalization: <%= num * 1.548 %>
7
+ mission_statement: <%= %w(Add value through developing superior products.).sort_by(&:rand).join(" ") %>
8
+ created_at: <%= (Time.now - num.weeks).to_s :db %>
9
+ updated_at: <%= (Time.now - num.days).to_s :db %>
10
+ <% end %>
11
+
@@ -0,0 +1,216 @@
1
+ AA:<% id = 0 %>
2
+ id: <%= (id=id+1).to_s %>
3
+ name: AA
4
+ abbreviation: AA
5
+ AE:
6
+ id: <%= (id=id+1).to_s %>
7
+ name: AE
8
+ abbreviation: AE
9
+ AP:
10
+ id: <%= (id=id+1).to_s %>
11
+ name: AP
12
+ abbreviation: AP
13
+ AL:
14
+ id: <%= (id=id+1).to_s %>
15
+ name: Alabama
16
+ abbreviation: AL
17
+ AK:
18
+ id: <%= (id=id+1).to_s %>
19
+ name: Alaska
20
+ abbreviation: AK
21
+ AZ:
22
+ id: <%= (id=id+1).to_s %>
23
+ name: Arizona
24
+ abbreviation: AZ
25
+ AR:
26
+ id: <%= (id=id+1).to_s %>
27
+ name: Arkansas
28
+ abbreviation: AR
29
+ CA:
30
+ id: <%= (id=id+1).to_s %>
31
+ name: California
32
+ abbreviation: CA
33
+ CO:
34
+ id: <%= (id=id+1).to_s %>
35
+ name: Colorado
36
+ abbreviation: CO
37
+ CT:
38
+ id: <%= (id=id+1).to_s %>
39
+ name: Connecticut
40
+ abbreviation: CT
41
+ DE:
42
+ id: <%= (id=id+1).to_s %>
43
+ name: Delaware
44
+ abbreviation: DE
45
+ DC:
46
+ id: <%= (id=id+1).to_s %>
47
+ name: District of Columbia
48
+ abbreviation: DC
49
+ FL:
50
+ id: <%= (id=id+1).to_s %>
51
+ name: Florida
52
+ abbreviation: FL
53
+ GA:
54
+ id: <%= (id=id+1).to_s %>
55
+ name: Georgia
56
+ abbreviation: GA
57
+ HI:
58
+ id: <%= (id=id+1).to_s %>
59
+ name: Hawaii
60
+ abbreviation: HI
61
+ ID:
62
+ id: <%= (id=id+1).to_s %>
63
+ name: Idaho
64
+ abbreviation: ID
65
+ IL:
66
+ id: <%= (id=id+1).to_s %>
67
+ name: Illinois
68
+ abbreviation: IL
69
+ IN:
70
+ id: <%= (id=id+1).to_s %>
71
+ name: Indiana
72
+ abbreviation: IN
73
+ IA:
74
+ id: <%= (id=id+1).to_s %>
75
+ name: Iowa
76
+ abbreviation: IA
77
+ KS:
78
+ id: <%= (id=id+1).to_s %>
79
+ name: Kansas
80
+ abbreviation: KS
81
+ KY:
82
+ id: <%= (id=id+1).to_s %>
83
+ name: Kentucky
84
+ abbreviation: KY
85
+ LA:
86
+ id: <%= (id=id+1).to_s %>
87
+ name: Louisiana
88
+ abbreviation: LA
89
+ ME:
90
+ id: <%= (id=id+1).to_s %>
91
+ name: Maine
92
+ abbreviation: ME
93
+ MD:
94
+ id: <%= (id=id+1).to_s %>
95
+ name: Maryland
96
+ abbreviation: MD
97
+ MA:
98
+ id: <%= (id=id+1).to_s %>
99
+ name: Massachusetts
100
+ abbreviation: MA
101
+ MI:
102
+ id: <%= (id=id+1).to_s %>
103
+ name: Michigan
104
+ abbreviation: MI
105
+ MN:
106
+ id: <%= (id=id+1).to_s %>
107
+ name: Minnesota
108
+ abbreviation: MN
109
+ MS:
110
+ id: <%= (id=id+1).to_s %>
111
+ name: Mississippi
112
+ abbreviation: MS
113
+ MO:
114
+ id: <%= (id=id+1).to_s %>
115
+ name: Missouri
116
+ abbreviation: MO
117
+ MT:
118
+ id: <%= (id=id+1).to_s %>
119
+ name: Montana
120
+ abbreviation: MT
121
+ NE:
122
+ id: <%= (id=id+1).to_s %>
123
+ name: Nebraska
124
+ abbreviation: NE
125
+ NV:
126
+ id: <%= (id=id+1).to_s %>
127
+ name: Nevada
128
+ abbreviation: NV
129
+ NH:
130
+ id: <%= (id=id+1).to_s %>
131
+ name: New Hampshire
132
+ abbreviation: NH
133
+ NJ:
134
+ id: <%= (id=id+1).to_s %>
135
+ name: New Jersey
136
+ abbreviation: NJ
137
+ NM:
138
+ id: <%= (id=id+1).to_s %>
139
+ name: New Mexico
140
+ abbreviation: NM
141
+ NY:
142
+ id: <%= (id=id+1).to_s %>
143
+ name: New York
144
+ abbreviation: NY
145
+ NC:
146
+ id: <%= (id=id+1).to_s %>
147
+ name: North Carolina
148
+ abbreviation: NC
149
+ ND:
150
+ id: <%= (id=id+1).to_s %>
151
+ name: North Dakota
152
+ abbreviation: ND
153
+ OH:
154
+ id: <%= (id=id+1).to_s %>
155
+ name: Ohio
156
+ abbreviation: OH
157
+ OK:
158
+ id: <%= (id=id+1).to_s %>
159
+ name: Oklahoma
160
+ abbreviation: OK
161
+ OR:
162
+ id: <%= (id=id+1).to_s %>
163
+ name: Oregon
164
+ abbreviation: OR
165
+ PA:
166
+ id: <%= (id=id+1).to_s %>
167
+ name: Pennsylvania
168
+ abbreviation: PA
169
+ RI:
170
+ id: <%= (id=id+1).to_s %>
171
+ name: Rhode Island
172
+ abbreviation: RI
173
+ SC:
174
+ id: <%= (id=id+1).to_s %>
175
+ name: South Carolina
176
+ abbreviation: SC
177
+ SD:
178
+ id: <%= (id=id+1).to_s %>
179
+ name: South Dakota
180
+ abbreviation: SD
181
+ TN:
182
+ id: <%= (id=id+1).to_s %>
183
+ name: Tennessee
184
+ abbreviation: TN
185
+ TX:
186
+ id: <%= (id=id+1).to_s %>
187
+ name: Texas
188
+ abbreviation: TX
189
+ UT:
190
+ id: <%= (id=id+1).to_s %>
191
+ name: Utah
192
+ abbreviation: UT
193
+ VT:
194
+ id: <%= (id=id+1).to_s %>
195
+ name: Vermont
196
+ abbreviation: VT
197
+ VA:
198
+ id: <%= (id=id+1).to_s %>
199
+ name: Virginia
200
+ abbreviation: VA
201
+ WA:
202
+ id: <%= (id=id+1).to_s %>
203
+ name: Washington
204
+ abbreviation: WA
205
+ WV:
206
+ id: <%= (id=id+1).to_s %>
207
+ name: West Virginia
208
+ abbreviation: WV
209
+ WI:
210
+ id: <%= (id=id+1).to_s %>
211
+ name: Wisconsin
212
+ abbreviation: WI
213
+ WY:
214
+ id: <%= (id=id+1).to_s %>
215
+ name: Wyoming
216
+ abbreviation: WY
@@ -0,0 +1,11 @@
1
+ <% 1.upto(41) do |num| %>
2
+ <%="user#{num}:" %>
3
+ id: <%= num.to_s %>
4
+ login: <%= "user#{num}" %>
5
+ crypted_password: "2fdefe5c83d80a03a828dd65e90cfff65f0fb42d043a254ca2cad6af968d0e15" #password
6
+ email: <%= "user#{num}@test.com" %>
7
+ salt: "1000"
8
+ created_at: <%= (Time.now - 30).to_s :db %>
9
+ updated_at: <%= Time.now.to_s :db %>
10
+ deleted: <%= num == 41 ? true : false %>
11
+ <% end %>
@@ -0,0 +1,57 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+ require 'addresses_controller'
3
+
4
+ # Re-raise errors caught by the controller.
5
+ class AddressesController; def rescue_action(e) raise e end; end
6
+
7
+ class AddressesControllerTest < Test::Unit::TestCase
8
+ fixtures :addresses
9
+
10
+ def setup
11
+ @controller = AddressesController.new
12
+ @request = ActionController::TestRequest.new
13
+ @response = ActionController::TestResponse.new
14
+ end
15
+
16
+ def test_should_get_index
17
+ get :index
18
+ assert_response :success
19
+ assert assigns(:addresses)
20
+ end
21
+
22
+ def test_should_get_new
23
+ get :new
24
+ assert_response :success
25
+ end
26
+
27
+ def test_should_create_address
28
+ assert_difference('Address.count') do
29
+ post :create, :address => { }
30
+ end
31
+
32
+ assert_redirected_to address_path(assigns(:address))
33
+ end
34
+
35
+ def test_should_show_address
36
+ get :show, :id => 1
37
+ assert_response :success
38
+ end
39
+
40
+ def test_should_get_edit
41
+ get :edit, :id => 1
42
+ assert_response :success
43
+ end
44
+
45
+ def test_should_update_address
46
+ put :update, :id => 1, :address => { }
47
+ assert_redirected_to address_path(assigns(:address))
48
+ end
49
+
50
+ def test_should_destroy_address
51
+ assert_difference('Address.count', -1) do
52
+ delete :destroy, :id => 1
53
+ end
54
+
55
+ assert_redirected_to addresses_path
56
+ end
57
+ end