nxa-sunspot 0.10.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. data/History.txt +153 -0
  2. data/LICENSE +18 -0
  3. data/README.rdoc +191 -0
  4. data/Rakefile +9 -0
  5. data/TODO +14 -0
  6. data/VERSION.yml +4 -0
  7. data/bin/sunspot-configure-solr +40 -0
  8. data/bin/sunspot-solr +95 -0
  9. data/lib/light_config.rb +40 -0
  10. data/lib/sunspot.rb +488 -0
  11. data/lib/sunspot/adapters.rb +265 -0
  12. data/lib/sunspot/composite_setup.rb +188 -0
  13. data/lib/sunspot/configuration.rb +56 -0
  14. data/lib/sunspot/data_extractor.rb +50 -0
  15. data/lib/sunspot/dsl.rb +4 -0
  16. data/lib/sunspot/dsl/field_query.rb +150 -0
  17. data/lib/sunspot/dsl/fields.rb +100 -0
  18. data/lib/sunspot/dsl/fulltext.rb +228 -0
  19. data/lib/sunspot/dsl/query.rb +162 -0
  20. data/lib/sunspot/dsl/query_facet.rb +36 -0
  21. data/lib/sunspot/dsl/restriction.rb +25 -0
  22. data/lib/sunspot/dsl/scope.rb +225 -0
  23. data/lib/sunspot/dsl/search.rb +30 -0
  24. data/lib/sunspot/field.rb +181 -0
  25. data/lib/sunspot/field_factory.rb +144 -0
  26. data/lib/sunspot/indexer.rb +133 -0
  27. data/lib/sunspot/query.rb +9 -0
  28. data/lib/sunspot/query/abstract_field_facet.rb +43 -0
  29. data/lib/sunspot/query/boost_query.rb +20 -0
  30. data/lib/sunspot/query/connective.rb +189 -0
  31. data/lib/sunspot/query/date_field_facet.rb +14 -0
  32. data/lib/sunspot/query/dismax.rb +88 -0
  33. data/lib/sunspot/query/field_facet.rb +9 -0
  34. data/lib/sunspot/query/highlighting.rb +55 -0
  35. data/lib/sunspot/query/local.rb +27 -0
  36. data/lib/sunspot/query/pagination.rb +38 -0
  37. data/lib/sunspot/query/query.rb +86 -0
  38. data/lib/sunspot/query/query_facet.rb +16 -0
  39. data/lib/sunspot/query/restriction.rb +254 -0
  40. data/lib/sunspot/query/scope.rb +9 -0
  41. data/lib/sunspot/query/sort.rb +105 -0
  42. data/lib/sunspot/query/sort_composite.rb +33 -0
  43. data/lib/sunspot/query/text_field_boost.rb +15 -0
  44. data/lib/sunspot/schema.rb +147 -0
  45. data/lib/sunspot/search.rb +216 -0
  46. data/lib/sunspot/search/date_facet.rb +35 -0
  47. data/lib/sunspot/search/facet_row.rb +27 -0
  48. data/lib/sunspot/search/field_facet.rb +44 -0
  49. data/lib/sunspot/search/highlight.rb +38 -0
  50. data/lib/sunspot/search/hit.rb +117 -0
  51. data/lib/sunspot/search/query_facet.rb +62 -0
  52. data/lib/sunspot/session.rb +236 -0
  53. data/lib/sunspot/setup.rb +323 -0
  54. data/lib/sunspot/text_field_setup.rb +29 -0
  55. data/lib/sunspot/type.rb +204 -0
  56. data/lib/sunspot/util.rb +210 -0
  57. data/solr/etc/jetty.xml +212 -0
  58. data/solr/etc/webdefault.xml +379 -0
  59. data/solr/lib/jetty-6.1.3.jar +0 -0
  60. data/solr/lib/jetty-util-6.1.3.jar +0 -0
  61. data/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
  62. data/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
  63. data/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
  64. data/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
  65. data/solr/lib/servlet-api-2.5-6.1.3.jar +0 -0
  66. data/solr/solr/conf/elevate.xml +36 -0
  67. data/solr/solr/conf/protwords.txt +21 -0
  68. data/solr/solr/conf/schema.xml +64 -0
  69. data/solr/solr/conf/solrconfig.xml +725 -0
  70. data/solr/solr/conf/stopwords.txt +57 -0
  71. data/solr/solr/conf/synonyms.txt +31 -0
  72. data/solr/solr/lib/geoapi-nogenerics-2.1-M2.jar +0 -0
  73. data/solr/solr/lib/gt2-referencing-2.3.1.jar +0 -0
  74. data/solr/solr/lib/jsr108-0.01.jar +0 -0
  75. data/solr/solr/lib/locallucene.jar +0 -0
  76. data/solr/solr/lib/localsolr.jar +0 -0
  77. data/solr/start.jar +0 -0
  78. data/solr/webapps/solr.war +0 -0
  79. data/spec/api/adapters_spec.rb +33 -0
  80. data/spec/api/indexer/attributes_spec.rb +110 -0
  81. data/spec/api/indexer/batch_spec.rb +46 -0
  82. data/spec/api/indexer/dynamic_fields_spec.rb +33 -0
  83. data/spec/api/indexer/fixed_fields_spec.rb +57 -0
  84. data/spec/api/indexer/fulltext_spec.rb +43 -0
  85. data/spec/api/indexer/removal_spec.rb +46 -0
  86. data/spec/api/indexer/spec_helper.rb +1 -0
  87. data/spec/api/indexer_spec.rb +4 -0
  88. data/spec/api/query/adjust_params_spec.rb +37 -0
  89. data/spec/api/query/connectives_spec.rb +176 -0
  90. data/spec/api/query/dsl_spec.rb +12 -0
  91. data/spec/api/query/dynamic_fields_spec.rb +149 -0
  92. data/spec/api/query/faceting_spec.rb +296 -0
  93. data/spec/api/query/fulltext_spec.rb +281 -0
  94. data/spec/api/query/highlighting_spec.rb +225 -0
  95. data/spec/api/query/local_spec.rb +62 -0
  96. data/spec/api/query/ordering_pagination_spec.rb +95 -0
  97. data/spec/api/query/scope_spec.rb +266 -0
  98. data/spec/api/query/spec_helper.rb +1 -0
  99. data/spec/api/query/text_field_scoping_spec.rb +30 -0
  100. data/spec/api/query/types_spec.rb +20 -0
  101. data/spec/api/search/dynamic_fields_spec.rb +27 -0
  102. data/spec/api/search/faceting_spec.rb +242 -0
  103. data/spec/api/search/highlighting_spec.rb +65 -0
  104. data/spec/api/search/hits_spec.rb +67 -0
  105. data/spec/api/search/results_spec.rb +52 -0
  106. data/spec/api/search/search_spec.rb +23 -0
  107. data/spec/api/search/spec_helper.rb +1 -0
  108. data/spec/api/session_spec.rb +198 -0
  109. data/spec/api/spec_helper.rb +1 -0
  110. data/spec/api/sunspot_spec.rb +18 -0
  111. data/spec/helpers/indexer_helper.rb +29 -0
  112. data/spec/helpers/query_helper.rb +13 -0
  113. data/spec/helpers/search_helper.rb +78 -0
  114. data/spec/integration/dynamic_fields_spec.rb +55 -0
  115. data/spec/integration/faceting_spec.rb +188 -0
  116. data/spec/integration/highlighting_spec.rb +22 -0
  117. data/spec/integration/indexing_spec.rb +7 -0
  118. data/spec/integration/keyword_search_spec.rb +245 -0
  119. data/spec/integration/local_search_spec.rb +56 -0
  120. data/spec/integration/scoped_search_spec.rb +303 -0
  121. data/spec/integration/spec_helper.rb +7 -0
  122. data/spec/integration/stored_fields_spec.rb +10 -0
  123. data/spec/integration/test_pagination.rb +32 -0
  124. data/spec/mocks/adapters.rb +32 -0
  125. data/spec/mocks/blog.rb +3 -0
  126. data/spec/mocks/comment.rb +19 -0
  127. data/spec/mocks/connection.rb +106 -0
  128. data/spec/mocks/mock_adapter.rb +30 -0
  129. data/spec/mocks/mock_record.rb +48 -0
  130. data/spec/mocks/photo.rb +11 -0
  131. data/spec/mocks/post.rb +75 -0
  132. data/spec/mocks/super_class.rb +2 -0
  133. data/spec/mocks/user.rb +8 -0
  134. data/spec/spec_helper.rb +68 -0
  135. data/tasks/gemspec.rake +42 -0
  136. data/tasks/rcov.rake +28 -0
  137. data/tasks/rdoc.rake +22 -0
  138. data/tasks/schema.rake +19 -0
  139. data/tasks/spec.rake +24 -0
  140. data/tasks/todo.rake +4 -0
  141. data/templates/schema.xml.erb +36 -0
  142. metadata +319 -0
@@ -0,0 +1,62 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+
3
+ describe 'local query' do
4
+ it 'sets query type to geo when geo search performed' do
5
+ session.search Post do
6
+ near [40.7, -73.5], 5
7
+ end
8
+ connection.should have_last_search_with(:qt => 'geo')
9
+ end
10
+
11
+ it 'sets lat and lng when geo search is performed' do
12
+ session.search Post do
13
+ near [40.7, -73.5], 5
14
+ end
15
+ connection.should have_last_search_with(:lat => 40.7, :long => -73.5)
16
+ end
17
+
18
+ it 'sets radius when geo search is performed' do
19
+ session.search Post do
20
+ near [40.7, -73.5], 5
21
+ end
22
+ connection.should have_last_search_with(:radius => 5)
23
+ end
24
+
25
+ it 'puts all scope parameters into :q parameter when geo search is performed' do
26
+ session.search Post do
27
+ with :blog_id, 1
28
+ near [40.7, -73.5], 5
29
+ end
30
+ connection.should have_last_search_with(:q => '(type:Post AND blog_id_i:1)')
31
+ end
32
+
33
+ it 'raises error if keywords specified in local search' do
34
+ lambda do
35
+ session.search Post do
36
+ keywords 'fail'
37
+ near [40.7, -73.5], 5
38
+ end
39
+ end.should raise_error(Sunspot::IllegalSearchError)
40
+ end
41
+
42
+ [
43
+ [:lat, :lng],
44
+ [:lat, :lon],
45
+ [:lat, :long]
46
+ ].each do |lat_attr, lng_attr|
47
+ it "sets coordinates using #{lat_attr.inspect}, #{lng_attr.inspect}" do
48
+ session.search Post do
49
+ near OpenStruct.new(lat_attr => 40.7, lng_attr => -73.5), 5
50
+ end
51
+ connection.should have_last_search_with(:lat => 40.7, :long => -73.5)
52
+ end
53
+ end
54
+
55
+ it 'raises ArgumentError if radius is less than 1' do
56
+ lambda do
57
+ session.search Post do
58
+ near [40, -70], 0.5
59
+ end
60
+ end.should raise_error(ArgumentError)
61
+ end
62
+ end
@@ -0,0 +1,95 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+
3
+ describe 'ordering and pagination' do
4
+ it 'paginates using default per_page when page not provided' do
5
+ session.search Post
6
+ connection.should have_last_search_with(:rows => 30)
7
+ end
8
+
9
+ it 'paginates using default per_page when page provided' do
10
+ session.search Post do
11
+ paginate :page => 2
12
+ end
13
+ connection.should have_last_search_with(:rows => 30, :start => 30)
14
+ end
15
+
16
+ it 'paginates using provided per_page' do
17
+ session.search Post do
18
+ paginate :page => 4, :per_page => 15
19
+ end
20
+ connection.should have_last_search_with(:rows => 15, :start => 45)
21
+ end
22
+
23
+ it 'defaults to page 1 if no :page argument given' do
24
+ session.search Post do
25
+ paginate :per_page => 15
26
+ end
27
+ connection.should have_last_search_with(:rows => 15, :start => 0)
28
+ end
29
+
30
+ it 'paginates from string argument' do
31
+ session.search Post do
32
+ paginate :page => '3', :per_page => '15'
33
+ end
34
+ connection.should have_last_search_with(:rows => 15, :start => 30)
35
+ end
36
+
37
+ it 'orders by a single field' do
38
+ session.search Post do
39
+ order_by :average_rating, :desc
40
+ end
41
+ connection.should have_last_search_with(:sort => 'average_rating_f desc')
42
+ end
43
+
44
+ it 'orders by multiple fields' do
45
+ session.search Post do
46
+ order_by :average_rating, :desc
47
+ order_by :sort_title, :asc
48
+ end
49
+ connection.should have_last_search_with(:sort => 'average_rating_f desc, sort_title_s asc')
50
+ end
51
+
52
+ it 'orders by random' do
53
+ session.search Post do
54
+ order_by :random
55
+ end
56
+ connection.searches.last[:sort].should =~ /^random_\d+ asc$/
57
+ end
58
+
59
+ it 'orders by score' do
60
+ session.search Post do
61
+ order_by :score, :desc
62
+ end
63
+ connection.should have_last_search_with(:sort => 'score desc')
64
+ end
65
+
66
+ it 'orders by geo distance' do
67
+ session.search Post do
68
+ order_by :distance, :asc
69
+ end
70
+ end
71
+
72
+ it 'throws an ArgumentError if a bogus order direction is given' do
73
+ lambda do
74
+ session.search Post do
75
+ order_by :sort_title, :sideways
76
+ end
77
+ end.should raise_error(ArgumentError)
78
+ end
79
+
80
+ it 'does not allow ordering by multiple-value fields' do
81
+ lambda do
82
+ session.search Post do
83
+ order_by :category_ids
84
+ end
85
+ end.should raise_error(ArgumentError)
86
+ end
87
+
88
+ it 'raises ArgumentError if bogus argument given to paginate' do
89
+ lambda do
90
+ session.search Post do
91
+ paginate :page => 4, :ugly => :puppy
92
+ end
93
+ end.should raise_error(ArgumentError)
94
+ end
95
+ end
@@ -0,0 +1,266 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+
3
+ describe 'scoped query', :type => :query do
4
+ it 'adds a no-op query to :q parameter when no :q provided' do
5
+ session.search Post do
6
+ with :title, 'My Pet Post'
7
+ end
8
+ connection.should have_last_search_with(:q => '*:*')
9
+ end
10
+
11
+ it 'scopes by exact match with a string' do
12
+ session.search Post do
13
+ with :title, 'My Pet Post'
14
+ end
15
+ connection.should have_last_search_including(:fq, 'title_ss:My\ Pet\ Post')
16
+ end
17
+
18
+ it 'scopes by exact match with time' do
19
+ time = Time.parse('1983-07-08 05:00:00 -0400')
20
+ session.search Post do
21
+ with :published_at, time
22
+ end
23
+ connection.should have_last_search_including(
24
+ :fq,
25
+ 'published_at_d:1983\-07\-08T09\:00\:00Z'
26
+ )
27
+ end
28
+
29
+ it 'scopes by exact match with date' do
30
+ date = Date.new(1983, 7, 8)
31
+ session.search Post do
32
+ with :expire_date, date
33
+ end
34
+ connection.should have_last_search_including(
35
+ :fq,
36
+ 'expire_date_d:1983\-07\-08T00\:00\:00Z'
37
+ )
38
+ end
39
+
40
+ it 'scopes by exact match with boolean' do
41
+ session.search Post do
42
+ with :featured, false
43
+ end
44
+ connection.should have_last_search_including(:fq, 'featured_b:false')
45
+ end
46
+
47
+ it 'scopes by less than match with float' do
48
+ session.search Post do
49
+ with(:average_rating).less_than 3.0
50
+ end
51
+ connection.should have_last_search_including(:fq, 'average_rating_f:[* TO 3\.0]')
52
+ end
53
+
54
+ it 'should quote string with space in a less than match' do
55
+ session.search Post do
56
+ with(:title).less_than('test value')
57
+ end
58
+ connection.should have_last_search_including(:fq, 'title_ss:[* TO "test\ value"]')
59
+ end
60
+
61
+ it 'scopes by greater than match with float' do
62
+ session.search Post do
63
+ with(:average_rating).greater_than 3.0
64
+ end
65
+ connection.should have_last_search_including(:fq, 'average_rating_f:[3\.0 TO *]')
66
+ end
67
+
68
+ it 'scopes by short-form between match with integers' do
69
+ session.search Post do
70
+ with :blog_id, 2..4
71
+ end
72
+ connection.should have_last_search_including(:fq, 'blog_id_i:[2 TO 4]')
73
+ end
74
+
75
+ it 'scopes by between match with float' do
76
+ session.search Post do
77
+ with(:average_rating).between 2.0..4.0
78
+ end
79
+ connection.should have_last_search_including(:fq, 'average_rating_f:[2\.0 TO 4\.0]')
80
+ end
81
+
82
+ it 'automatically sorts ranges in between matches' do
83
+ session.search Post do
84
+ with(:blog_id).between(4..2)
85
+ end
86
+ connection.should have_last_search_including(:fq, 'blog_id_i:[2 TO 4]')
87
+ end
88
+
89
+ it 'scopes by any match with integer' do
90
+ session.search Post do
91
+ with(:category_ids).any_of [2, 7, 12]
92
+ end
93
+ connection.should have_last_search_including(:fq, 'category_ids_im:(2 OR 7 OR 12)')
94
+ end
95
+
96
+ it 'scopes by short-form any-of match with integers' do
97
+ session.search Post do
98
+ with :category_ids, [2, 7, 12]
99
+ end
100
+ connection.should have_last_search_including(:fq, 'category_ids_im:(2 OR 7 OR 12)')
101
+ end
102
+
103
+ it 'scopes by all match with integer' do
104
+ session.search Post do
105
+ with(:category_ids).all_of [2, 7, 12]
106
+ end
107
+ connection.should have_last_search_including(:fq, 'category_ids_im:(2 AND 7 AND 12)')
108
+ end
109
+
110
+ it 'scopes by prefix match with string' do
111
+ session.search Post do
112
+ with(:title).starting_with('tes')
113
+ end
114
+ connection.should have_last_search_including(:fq, 'title_ss:tes*')
115
+ end
116
+
117
+ it 'scopes by not equal match with string' do
118
+ session.search Post do
119
+ without :title, 'Bad Post'
120
+ end
121
+ connection.should have_last_search_including(:fq, '-title_ss:Bad\ Post')
122
+ end
123
+
124
+ it 'scopes by not less than match with float' do
125
+ session.search Post do
126
+ without(:average_rating).less_than 3.0
127
+ end
128
+ connection.should have_last_search_including(:fq, '-average_rating_f:[* TO 3\.0]')
129
+ end
130
+
131
+ it 'scopes by not greater than match with float' do
132
+ session.search Post do
133
+ without(:average_rating).greater_than 3.0
134
+ end
135
+ connection.should have_last_search_including(:fq, '-average_rating_f:[3\.0 TO *]')
136
+ end
137
+
138
+ it 'scopes by not between match with shorthand' do
139
+ session.search Post do
140
+ without(:blog_id, 2..4)
141
+ end
142
+ connection.should have_last_search_including(:fq, '-blog_id_i:[2 TO 4]')
143
+ end
144
+
145
+ it 'scopes by not between match with float' do
146
+ session.search Post do
147
+ without(:average_rating).between 2.0..4.0
148
+ end
149
+ connection.should have_last_search_including(:fq, '-average_rating_f:[2\.0 TO 4\.0]')
150
+ end
151
+
152
+ it 'scopes by not any match with integer' do
153
+ session.search Post do
154
+ without(:category_ids).any_of [2, 7, 12]
155
+ end
156
+ connection.should have_last_search_including(:fq, '-category_ids_im:(2 OR 7 OR 12)')
157
+ end
158
+
159
+ it 'scopes by not all match with integer' do
160
+ session.search Post do
161
+ without(:category_ids).all_of [2, 7, 12]
162
+ end
163
+ connection.should have_last_search_including(:fq, '-category_ids_im:(2 AND 7 AND 12)')
164
+ end
165
+
166
+ it 'scopes by empty field' do
167
+ session.search Post do
168
+ with :average_rating, nil
169
+ end
170
+ connection.should have_last_search_including(:fq, '-average_rating_f:[* TO *]')
171
+ end
172
+
173
+ it 'scopes by non-empty field' do
174
+ session.search Post do
175
+ without :average_rating, nil
176
+ end
177
+ connection.should have_last_search_including(:fq, 'average_rating_f:[* TO *]')
178
+ end
179
+
180
+ it 'excludes by object identity' do
181
+ post = Post.new
182
+ session.search Post do
183
+ without post
184
+ end
185
+ connection.should have_last_search_including(:fq, "-id:Post\\ #{post.id}")
186
+ end
187
+
188
+ it 'excludes multiple objects passed as varargs by object identity' do
189
+ post1, post2 = Post.new, Post.new
190
+ session.search Post do
191
+ without post1, post2
192
+ end
193
+ connection.should have_last_search_including(
194
+ :fq,
195
+ "-id:Post\\ #{post1.id}",
196
+ "-id:Post\\ #{post2.id}"
197
+ )
198
+ end
199
+
200
+ it 'excludes multiple objects passed as array by object identity' do
201
+ posts = [Post.new, Post.new]
202
+ session.search Post do
203
+ without posts
204
+ end
205
+ connection.should have_last_search_including(
206
+ :fq,
207
+ "-id:Post\\ #{posts.first.id}",
208
+ "-id:Post\\ #{posts.last.id}"
209
+ )
210
+ end
211
+
212
+ it 'allows scoping on fields common to all types' do
213
+ time = Time.parse('1983-07-08 05:00:00 -0400')
214
+ session.search Post, Namespaced::Comment do
215
+ with :published_at, time
216
+ end
217
+ connection.should have_last_search_including(:fq, 'published_at_d:1983\-07\-08T09\:00\:00Z')
218
+ end
219
+
220
+ it 'allows scoping on field not common to all types' do
221
+ session.search Post, Namespaced::Comment do
222
+ with :blog_id, 1
223
+ end
224
+ connection.should have_last_search_including(:fq, 'blog_id_i:1')
225
+ end
226
+
227
+ it 'raises Sunspot::UnrecognizedFieldError if search scoped to field configured differently between types' do
228
+ lambda do
229
+ session.search Post, Namespaced::Comment do
230
+ with :average_rating, 2.2 # this is a float in Post but an integer in Comment
231
+ end
232
+ end.should raise_error(Sunspot::UnrecognizedFieldError)
233
+ end
234
+
235
+ it 'raises Sunspot::UnrecognizedFieldError if a text field that does not exist for any type is specified' do
236
+ lambda do
237
+ session.search Post, Namespaced::Comment do
238
+ keywords 'fulltext', :fields => :bogus
239
+ end
240
+ end.should raise_error(Sunspot::UnrecognizedFieldError)
241
+ end
242
+
243
+ it 'raises Sunspot::UnrecognizedFieldError for nonexistant fields in block scope' do
244
+ lambda do
245
+ session.search Post do
246
+ with :bogus, 'Field'
247
+ end
248
+ end.should raise_error(Sunspot::UnrecognizedFieldError)
249
+ end
250
+
251
+ it 'raises NoMethodError if bogus operator referenced' do
252
+ lambda do
253
+ session.search Post do
254
+ with(:category_ids).resembling :bogus_condition
255
+ end
256
+ end.should raise_error(NoMethodError)
257
+ end
258
+
259
+ it 'should raise ArgumentError if more than two arguments passed to scope method' do
260
+ lambda do
261
+ session.search Post do
262
+ with(:category_ids, 4, 5)
263
+ end
264
+ end.should raise_error(ArgumentError)
265
+ end
266
+ end
@@ -0,0 +1 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
@@ -0,0 +1,30 @@
1
+ describe 'scoping with text fields', :type => :query do
2
+ it 'should scope with a text field' do
3
+ session.search(Post) do
4
+ text_fields do
5
+ with(:body, 'test')
6
+ end
7
+ end
8
+ connection.should have_last_search_including(:fq, 'body_texts:test')
9
+ end
10
+
11
+ it 'should raise an UnrecognizedFieldError if differently configured text field is used' do
12
+ lambda do
13
+ session.search(Post, Namespaced::Comment) do
14
+ text_fields do
15
+ with(:body, 'test')
16
+ end
17
+ end
18
+ end.should raise_error(Sunspot::UnrecognizedFieldError)
19
+ end
20
+
21
+ it 'should raise an UnrecognizedFieldError if no field exists' do
22
+ lambda do
23
+ session.search(Post) do
24
+ text_fields do
25
+ with(:bogus, 'test')
26
+ end
27
+ end
28
+ end.should raise_error(Sunspot::UnrecognizedFieldError)
29
+ end
30
+ end