sunspot_rails 2.0.0.pre.120720 → 2.0.0.pre.120924

Sign up to get free protection for your applications and to get access to all the features.
Files changed (293) hide show
  1. data/.gitignore +10 -6
  2. data/.travis.yml +35 -0
  3. data/README.md +863 -0
  4. data/Rakefile +32 -12
  5. data/ci/travis.sh +67 -0
  6. data/sunspot/.gitignore +13 -0
  7. data/sunspot/Gemfile +5 -0
  8. data/sunspot/History.txt +258 -0
  9. data/{LICENSE → sunspot/LICENSE} +0 -0
  10. data/sunspot/Rakefile +13 -0
  11. data/sunspot/TODO +13 -0
  12. data/sunspot/lib/light_config.rb +40 -0
  13. data/sunspot/lib/sunspot.rb +579 -0
  14. data/sunspot/lib/sunspot/adapters.rb +349 -0
  15. data/sunspot/lib/sunspot/batcher.rb +62 -0
  16. data/sunspot/lib/sunspot/class_set.rb +23 -0
  17. data/sunspot/lib/sunspot/composite_setup.rb +202 -0
  18. data/sunspot/lib/sunspot/configuration.rb +53 -0
  19. data/sunspot/lib/sunspot/data_extractor.rb +50 -0
  20. data/sunspot/lib/sunspot/dsl.rb +5 -0
  21. data/sunspot/lib/sunspot/dsl/adjustable.rb +47 -0
  22. data/sunspot/lib/sunspot/dsl/field_group.rb +57 -0
  23. data/sunspot/lib/sunspot/dsl/field_query.rb +345 -0
  24. data/sunspot/lib/sunspot/dsl/fields.rb +103 -0
  25. data/sunspot/lib/sunspot/dsl/fulltext.rb +243 -0
  26. data/sunspot/lib/sunspot/dsl/function.rb +27 -0
  27. data/sunspot/lib/sunspot/dsl/functional.rb +44 -0
  28. data/sunspot/lib/sunspot/dsl/more_like_this_query.rb +56 -0
  29. data/sunspot/lib/sunspot/dsl/paginatable.rb +32 -0
  30. data/sunspot/lib/sunspot/dsl/query_facet.rb +36 -0
  31. data/sunspot/lib/sunspot/dsl/restriction.rb +25 -0
  32. data/sunspot/lib/sunspot/dsl/restriction_with_near.rb +160 -0
  33. data/sunspot/lib/sunspot/dsl/scope.rb +214 -0
  34. data/sunspot/lib/sunspot/dsl/search.rb +30 -0
  35. data/sunspot/lib/sunspot/dsl/standard_query.rb +122 -0
  36. data/sunspot/lib/sunspot/field.rb +193 -0
  37. data/sunspot/lib/sunspot/field_factory.rb +129 -0
  38. data/sunspot/lib/sunspot/indexer.rb +136 -0
  39. data/sunspot/lib/sunspot/query.rb +11 -0
  40. data/sunspot/lib/sunspot/query/abstract_field_facet.rb +55 -0
  41. data/sunspot/lib/sunspot/query/bbox.rb +15 -0
  42. data/sunspot/lib/sunspot/query/boost_query.rb +24 -0
  43. data/sunspot/lib/sunspot/query/common_query.rb +96 -0
  44. data/sunspot/lib/sunspot/query/composite_fulltext.rb +36 -0
  45. data/sunspot/lib/sunspot/query/connective.rb +206 -0
  46. data/sunspot/lib/sunspot/query/date_field_facet.rb +14 -0
  47. data/sunspot/lib/sunspot/query/dismax.rb +132 -0
  48. data/sunspot/lib/sunspot/query/field_facet.rb +41 -0
  49. data/sunspot/lib/sunspot/query/field_group.rb +37 -0
  50. data/sunspot/lib/sunspot/query/filter.rb +38 -0
  51. data/sunspot/lib/sunspot/query/function_query.rb +52 -0
  52. data/sunspot/lib/sunspot/query/geo.rb +53 -0
  53. data/sunspot/lib/sunspot/query/geofilt.rb +16 -0
  54. data/sunspot/lib/sunspot/query/highlighting.rb +62 -0
  55. data/sunspot/lib/sunspot/query/more_like_this.rb +61 -0
  56. data/sunspot/lib/sunspot/query/more_like_this_query.rb +12 -0
  57. data/sunspot/lib/sunspot/query/pagination.rb +42 -0
  58. data/sunspot/lib/sunspot/query/query_facet.rb +53 -0
  59. data/sunspot/lib/sunspot/query/range_facet.rb +15 -0
  60. data/sunspot/lib/sunspot/query/restriction.rb +308 -0
  61. data/sunspot/lib/sunspot/query/scope.rb +9 -0
  62. data/sunspot/lib/sunspot/query/sort.rb +109 -0
  63. data/sunspot/lib/sunspot/query/sort_composite.rb +34 -0
  64. data/sunspot/lib/sunspot/query/standard_query.rb +16 -0
  65. data/sunspot/lib/sunspot/query/text_field_boost.rb +17 -0
  66. data/sunspot/lib/sunspot/schema.rb +151 -0
  67. data/sunspot/lib/sunspot/search.rb +9 -0
  68. data/sunspot/lib/sunspot/search/abstract_search.rb +286 -0
  69. data/sunspot/lib/sunspot/search/date_facet.rb +35 -0
  70. data/sunspot/lib/sunspot/search/facet_row.rb +27 -0
  71. data/sunspot/lib/sunspot/search/field_facet.rb +88 -0
  72. data/sunspot/lib/sunspot/search/field_group.rb +70 -0
  73. data/sunspot/lib/sunspot/search/group.rb +54 -0
  74. data/sunspot/lib/sunspot/search/highlight.rb +38 -0
  75. data/sunspot/lib/sunspot/search/hit.rb +150 -0
  76. data/sunspot/lib/sunspot/search/hit_enumerable.rb +68 -0
  77. data/sunspot/lib/sunspot/search/more_like_this_search.rb +31 -0
  78. data/sunspot/lib/sunspot/search/paginated_collection.rb +57 -0
  79. data/sunspot/lib/sunspot/search/query_facet.rb +67 -0
  80. data/sunspot/lib/sunspot/search/range_facet.rb +37 -0
  81. data/sunspot/lib/sunspot/search/standard_search.rb +21 -0
  82. data/sunspot/lib/sunspot/session.rb +262 -0
  83. data/sunspot/lib/sunspot/session_proxy.rb +95 -0
  84. data/sunspot/lib/sunspot/session_proxy/abstract_session_proxy.rb +29 -0
  85. data/sunspot/lib/sunspot/session_proxy/class_sharding_session_proxy.rb +66 -0
  86. data/sunspot/lib/sunspot/session_proxy/id_sharding_session_proxy.rb +89 -0
  87. data/sunspot/lib/sunspot/session_proxy/master_slave_session_proxy.rb +43 -0
  88. data/sunspot/lib/sunspot/session_proxy/retry_5xx_session_proxy.rb +67 -0
  89. data/sunspot/lib/sunspot/session_proxy/sharding_session_proxy.rb +222 -0
  90. data/sunspot/lib/sunspot/session_proxy/silent_fail_session_proxy.rb +42 -0
  91. data/sunspot/lib/sunspot/session_proxy/thread_local_session_proxy.rb +37 -0
  92. data/sunspot/lib/sunspot/setup.rb +350 -0
  93. data/sunspot/lib/sunspot/text_field_setup.rb +29 -0
  94. data/sunspot/lib/sunspot/type.rb +393 -0
  95. data/sunspot/lib/sunspot/util.rb +252 -0
  96. data/sunspot/lib/sunspot/version.rb +3 -0
  97. data/sunspot/script/console +10 -0
  98. data/sunspot/spec/api/adapters_spec.rb +68 -0
  99. data/sunspot/spec/api/batcher_spec.rb +112 -0
  100. data/sunspot/spec/api/binding_spec.rb +50 -0
  101. data/sunspot/spec/api/class_set_spec.rb +24 -0
  102. data/sunspot/spec/api/hit_enumerable_spec.rb +47 -0
  103. data/sunspot/spec/api/indexer/attributes_spec.rb +149 -0
  104. data/sunspot/spec/api/indexer/batch_spec.rb +72 -0
  105. data/sunspot/spec/api/indexer/dynamic_fields_spec.rb +42 -0
  106. data/sunspot/spec/api/indexer/fixed_fields_spec.rb +57 -0
  107. data/sunspot/spec/api/indexer/fulltext_spec.rb +43 -0
  108. data/sunspot/spec/api/indexer/removal_spec.rb +53 -0
  109. data/sunspot/spec/api/indexer/spec_helper.rb +1 -0
  110. data/sunspot/spec/api/indexer_spec.rb +14 -0
  111. data/sunspot/spec/api/query/advanced_manipulation_examples.rb +35 -0
  112. data/sunspot/spec/api/query/connectives_examples.rb +201 -0
  113. data/sunspot/spec/api/query/dsl_spec.rb +18 -0
  114. data/sunspot/spec/api/query/dynamic_fields_examples.rb +165 -0
  115. data/sunspot/spec/api/query/faceting_examples.rb +497 -0
  116. data/sunspot/spec/api/query/fulltext_examples.rb +313 -0
  117. data/sunspot/spec/api/query/function_spec.rb +79 -0
  118. data/sunspot/spec/api/query/geo_examples.rb +68 -0
  119. data/sunspot/spec/api/query/group_spec.rb +32 -0
  120. data/sunspot/spec/api/query/highlighting_examples.rb +245 -0
  121. data/sunspot/spec/api/query/more_like_this_spec.rb +140 -0
  122. data/sunspot/spec/api/query/ordering_pagination_examples.rb +116 -0
  123. data/sunspot/spec/api/query/scope_examples.rb +275 -0
  124. data/sunspot/spec/api/query/spatial_examples.rb +27 -0
  125. data/sunspot/spec/api/query/spec_helper.rb +1 -0
  126. data/sunspot/spec/api/query/standard_spec.rb +29 -0
  127. data/sunspot/spec/api/query/text_field_scoping_examples.rb +30 -0
  128. data/sunspot/spec/api/query/types_spec.rb +20 -0
  129. data/sunspot/spec/api/search/dynamic_fields_spec.rb +33 -0
  130. data/sunspot/spec/api/search/faceting_spec.rb +360 -0
  131. data/sunspot/spec/api/search/highlighting_spec.rb +69 -0
  132. data/sunspot/spec/api/search/hits_spec.rb +147 -0
  133. data/sunspot/spec/api/search/paginated_collection_spec.rb +36 -0
  134. data/sunspot/spec/api/search/results_spec.rb +72 -0
  135. data/sunspot/spec/api/search/search_spec.rb +23 -0
  136. data/sunspot/spec/api/search/spec_helper.rb +1 -0
  137. data/sunspot/spec/api/session_proxy/class_sharding_session_proxy_spec.rb +85 -0
  138. data/sunspot/spec/api/session_proxy/id_sharding_session_proxy_spec.rb +30 -0
  139. data/sunspot/spec/api/session_proxy/master_slave_session_proxy_spec.rb +41 -0
  140. data/sunspot/spec/api/session_proxy/retry_5xx_session_proxy_spec.rb +78 -0
  141. data/sunspot/spec/api/session_proxy/sharding_session_proxy_spec.rb +77 -0
  142. data/sunspot/spec/api/session_proxy/silent_fail_session_proxy_spec.rb +24 -0
  143. data/sunspot/spec/api/session_proxy/spec_helper.rb +9 -0
  144. data/sunspot/spec/api/session_proxy/thread_local_session_proxy_spec.rb +39 -0
  145. data/sunspot/spec/api/session_spec.rb +232 -0
  146. data/sunspot/spec/api/spec_helper.rb +3 -0
  147. data/sunspot/spec/api/sunspot_spec.rb +29 -0
  148. data/sunspot/spec/ext.rb +11 -0
  149. data/sunspot/spec/helpers/indexer_helper.rb +17 -0
  150. data/sunspot/spec/helpers/integration_helper.rb +8 -0
  151. data/sunspot/spec/helpers/mock_session_helper.rb +13 -0
  152. data/sunspot/spec/helpers/query_helper.rb +26 -0
  153. data/sunspot/spec/helpers/search_helper.rb +68 -0
  154. data/sunspot/spec/integration/dynamic_fields_spec.rb +57 -0
  155. data/sunspot/spec/integration/faceting_spec.rb +330 -0
  156. data/sunspot/spec/integration/field_grouping_spec.rb +100 -0
  157. data/sunspot/spec/integration/geospatial_spec.rb +96 -0
  158. data/sunspot/spec/integration/highlighting_spec.rb +44 -0
  159. data/sunspot/spec/integration/indexing_spec.rb +55 -0
  160. data/sunspot/spec/integration/keyword_search_spec.rb +317 -0
  161. data/sunspot/spec/integration/local_search_spec.rb +64 -0
  162. data/sunspot/spec/integration/more_like_this_spec.rb +43 -0
  163. data/sunspot/spec/integration/scoped_search_spec.rb +386 -0
  164. data/sunspot/spec/integration/stored_fields_spec.rb +12 -0
  165. data/sunspot/spec/integration/test_pagination.rb +43 -0
  166. data/sunspot/spec/integration/unicode_spec.rb +15 -0
  167. data/sunspot/spec/mocks/adapters.rb +33 -0
  168. data/sunspot/spec/mocks/blog.rb +3 -0
  169. data/sunspot/spec/mocks/comment.rb +21 -0
  170. data/sunspot/spec/mocks/connection.rb +126 -0
  171. data/sunspot/spec/mocks/mock_adapter.rb +30 -0
  172. data/sunspot/spec/mocks/mock_class_sharding_session_proxy.rb +24 -0
  173. data/sunspot/spec/mocks/mock_record.rb +52 -0
  174. data/sunspot/spec/mocks/mock_sharding_session_proxy.rb +15 -0
  175. data/sunspot/spec/mocks/photo.rb +11 -0
  176. data/sunspot/spec/mocks/post.rb +86 -0
  177. data/sunspot/spec/mocks/super_class.rb +2 -0
  178. data/sunspot/spec/mocks/user.rb +13 -0
  179. data/sunspot/spec/spec_helper.rb +40 -0
  180. data/sunspot/sunspot.gemspec +37 -0
  181. data/sunspot/tasks/rdoc.rake +27 -0
  182. data/sunspot/tasks/schema.rake +19 -0
  183. data/{dev_tasks → sunspot/tasks}/todo.rake +0 -0
  184. data/sunspot_rails/.gitignore +7 -0
  185. data/{.rspec → sunspot_rails/.rspec} +0 -0
  186. data/{History.txt → sunspot_rails/History.txt} +0 -0
  187. data/sunspot_rails/LICENSE +18 -0
  188. data/{MIT-LICENSE → sunspot_rails/MIT-LICENSE} +0 -0
  189. data/{README.rdoc → sunspot_rails/README.rdoc} +0 -0
  190. data/sunspot_rails/Rakefile +17 -0
  191. data/{TODO → sunspot_rails/TODO} +0 -0
  192. data/{dev_tasks → sunspot_rails/dev_tasks}/rdoc.rake +0 -0
  193. data/{dev_tasks → sunspot_rails/dev_tasks}/release.rake +0 -0
  194. data/{dev_tasks → sunspot_rails/dev_tasks}/spec.rake +0 -0
  195. data/sunspot_rails/dev_tasks/todo.rake +4 -0
  196. data/{gemfiles → sunspot_rails/gemfiles}/rails-2.3.14 +0 -0
  197. data/{gemfiles → sunspot_rails/gemfiles}/rails-3.0.15 +0 -0
  198. data/{gemfiles → sunspot_rails/gemfiles}/rails-3.1.6 +0 -0
  199. data/{gemfiles → sunspot_rails/gemfiles}/rails-3.2.6 +0 -0
  200. data/{generators → sunspot_rails/generators}/sunspot/sunspot_generator.rb +0 -0
  201. data/{generators → sunspot_rails/generators}/sunspot/templates/sunspot.yml +0 -0
  202. data/{install.rb → sunspot_rails/install.rb} +0 -0
  203. data/{lib → sunspot_rails/lib}/generators/sunspot_rails.rb +0 -0
  204. data/{lib → sunspot_rails/lib}/generators/sunspot_rails/install/install_generator.rb +0 -0
  205. data/{lib → sunspot_rails/lib}/generators/sunspot_rails/install/templates/config/sunspot.yml +0 -0
  206. data/{lib → sunspot_rails/lib}/sunspot/rails.rb +0 -0
  207. data/{lib → sunspot_rails/lib}/sunspot/rails/adapters.rb +5 -0
  208. data/{lib → sunspot_rails/lib}/sunspot/rails/configuration.rb +0 -0
  209. data/{lib → sunspot_rails/lib}/sunspot/rails/init.rb +0 -0
  210. data/{lib → sunspot_rails/lib}/sunspot/rails/log_subscriber.rb +12 -0
  211. data/{lib → sunspot_rails/lib}/sunspot/rails/railtie.rb +5 -0
  212. data/{lib → sunspot_rails/lib}/sunspot/rails/railties/controller_runtime.rb +0 -0
  213. data/{lib → sunspot_rails/lib}/sunspot/rails/request_lifecycle.rb +0 -0
  214. data/{lib → sunspot_rails/lib}/sunspot/rails/searchable.rb +10 -6
  215. data/{lib → sunspot_rails/lib}/sunspot/rails/server.rb +0 -0
  216. data/{lib → sunspot_rails/lib}/sunspot/rails/solr_instrumentation.rb +0 -0
  217. data/{lib → sunspot_rails/lib}/sunspot/rails/solr_logging.rb +0 -0
  218. data/{lib → sunspot_rails/lib}/sunspot/rails/spec_helper.rb +0 -0
  219. data/{lib → sunspot_rails/lib}/sunspot/rails/stub_session_proxy.rb +0 -0
  220. data/{lib → sunspot_rails/lib}/sunspot/rails/tasks.rb +0 -0
  221. data/{lib → sunspot_rails/lib}/sunspot_rails.rb +0 -0
  222. data/{spec → sunspot_rails/spec}/configuration_spec.rb +0 -0
  223. data/{spec → sunspot_rails/spec}/model_lifecycle_spec.rb +0 -0
  224. data/{spec → sunspot_rails/spec}/model_spec.rb +0 -0
  225. data/{spec → sunspot_rails/spec}/rails_template/app/controllers/application_controller.rb +0 -0
  226. data/{spec → sunspot_rails/spec}/rails_template/app/controllers/posts_controller.rb +0 -0
  227. data/{spec → sunspot_rails/spec}/rails_template/app/models/author.rb +0 -0
  228. data/{spec → sunspot_rails/spec}/rails_template/app/models/blog.rb +0 -0
  229. data/{spec → sunspot_rails/spec}/rails_template/app/models/location.rb +0 -0
  230. data/{spec → sunspot_rails/spec}/rails_template/app/models/photo_post.rb +0 -0
  231. data/{spec → sunspot_rails/spec}/rails_template/app/models/post.rb +0 -0
  232. data/{spec → sunspot_rails/spec}/rails_template/app/models/post_with_auto.rb +0 -0
  233. data/{spec → sunspot_rails/spec}/rails_template/app/models/post_with_default_scope.rb +0 -0
  234. data/{spec → sunspot_rails/spec}/rails_template/config/boot.rb +0 -0
  235. data/{spec → sunspot_rails/spec}/rails_template/config/preinitializer.rb +0 -0
  236. data/{spec → sunspot_rails/spec}/rails_template/config/routes.rb +0 -0
  237. data/{spec → sunspot_rails/spec}/rails_template/config/sunspot.yml +0 -0
  238. data/{spec → sunspot_rails/spec}/rails_template/db/schema.rb +0 -0
  239. data/{spec → sunspot_rails/spec}/request_lifecycle_spec.rb +0 -0
  240. data/{spec → sunspot_rails/spec}/schema.rb +0 -0
  241. data/{spec → sunspot_rails/spec}/searchable_spec.rb +0 -0
  242. data/{spec → sunspot_rails/spec}/server_spec.rb +0 -0
  243. data/{spec → sunspot_rails/spec}/session_spec.rb +0 -0
  244. data/{spec → sunspot_rails/spec}/shared_examples/indexed_after_save.rb +0 -0
  245. data/{spec → sunspot_rails/spec}/shared_examples/not_indexed_after_save.rb +0 -0
  246. data/{spec → sunspot_rails/spec}/spec_helper.rb +0 -0
  247. data/{spec → sunspot_rails/spec}/stub_session_proxy_spec.rb +0 -0
  248. data/{sunspot_rails.gemspec → sunspot_rails/sunspot_rails.gemspec} +0 -0
  249. data/sunspot_solr/Gemfile +3 -0
  250. data/sunspot_solr/README.rdoc +24 -0
  251. data/sunspot_solr/bin/sunspot-installer +20 -0
  252. data/sunspot_solr/bin/sunspot-solr +80 -0
  253. data/sunspot_solr/lib/sunspot/solr/installer.rb +25 -0
  254. data/sunspot_solr/lib/sunspot/solr/installer/config_installer.rb +46 -0
  255. data/sunspot_solr/lib/sunspot/solr/installer/task_helper.rb +13 -0
  256. data/sunspot_solr/lib/sunspot/solr/java.rb +10 -0
  257. data/sunspot_solr/lib/sunspot/solr/railtie.rb +15 -0
  258. data/sunspot_solr/lib/sunspot/solr/server.rb +223 -0
  259. data/sunspot_solr/lib/sunspot/solr/tasks.rb +49 -0
  260. data/sunspot_solr/lib/sunspot_solr.rb +5 -0
  261. data/sunspot_solr/solr/README.txt +42 -0
  262. data/sunspot_solr/solr/etc/jetty.xml +219 -0
  263. data/sunspot_solr/solr/etc/webdefault.xml +379 -0
  264. data/sunspot_solr/solr/lib/jetty-6.1.26-patched-JETTY-1340.jar +0 -0
  265. data/sunspot_solr/solr/lib/jetty-util-6.1.26-patched-JETTY-1340.jar +0 -0
  266. data/sunspot_solr/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
  267. data/sunspot_solr/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
  268. data/sunspot_solr/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
  269. data/sunspot_solr/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
  270. data/sunspot_solr/solr/lib/servlet-api-2.5-20081211.jar +0 -0
  271. data/sunspot_solr/solr/solr/.gitignore +1 -0
  272. data/sunspot_solr/solr/solr/README.txt +54 -0
  273. data/sunspot_solr/solr/solr/conf/admin-extra.html +31 -0
  274. data/sunspot_solr/solr/solr/conf/elevate.xml +36 -0
  275. data/sunspot_solr/solr/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  276. data/sunspot_solr/solr/solr/conf/protwords.txt +21 -0
  277. data/sunspot_solr/solr/solr/conf/schema.xml +250 -0
  278. data/sunspot_solr/solr/solr/conf/scripts.conf +24 -0
  279. data/sunspot_solr/solr/solr/conf/solrconfig.xml +934 -0
  280. data/sunspot_solr/solr/solr/conf/spellings.txt +2 -0
  281. data/sunspot_solr/solr/solr/conf/stopwords.txt +58 -0
  282. data/sunspot_solr/solr/solr/conf/synonyms.txt +31 -0
  283. data/sunspot_solr/solr/solr/conf/xslt/example.xsl +132 -0
  284. data/sunspot_solr/solr/solr/conf/xslt/example_atom.xsl +67 -0
  285. data/sunspot_solr/solr/solr/conf/xslt/example_rss.xsl +66 -0
  286. data/sunspot_solr/solr/solr/conf/xslt/luke.xsl +337 -0
  287. data/sunspot_solr/solr/start.jar +0 -0
  288. data/sunspot_solr/solr/webapps/solr.war +0 -0
  289. data/sunspot_solr/spec/server_spec.rb +98 -0
  290. data/sunspot_solr/spec/spec_helper.rb +18 -0
  291. data/sunspot_solr/sunspot_solr.gemspec +37 -0
  292. data/tools/gem_tasks.rb +69 -0
  293. metadata +356 -177
data/Rakefile CHANGED
@@ -1,17 +1,37 @@
1
- require 'rake'
1
+ desc 'Release Sunspot, Sunspot::Rails and Sunspot::Solr to Gemcutter'
2
+ task :release do
3
+ FileUtils.cp('README.md', 'sunspot/')
2
4
 
3
- begin
4
- require 'rdoc/task'
5
- rescue LoadError
6
- require 'rake/rdoctask'
7
- end
5
+ require File.expand_path('../sunspot/lib/sunspot/version', __FILE__)
8
6
 
9
- if File.exist?(sunspot_lib = File.expand_path(File.join(File.dirname(__FILE__), '..', 'sunspot', 'lib')))
10
- STDERR.puts("Using sunspot lib at #{sunspot_lib}")
11
- $: << sunspot_lib
12
- end
7
+ version_tag = "v#{Sunspot::VERSION}"
8
+ system "git tag -am 'Release version #{Sunspot::VERSION}' '#{version_tag}'"
9
+ system "git push origin #{version_tag}:#{version_tag}"
10
+
11
+ FileUtils.cd 'sunspot' do
12
+ system "gem build sunspot.gemspec"
13
+ system "gem push sunspot-#{Sunspot::VERSION}.gem"
14
+ FileUtils.rm "sunspot-#{Sunspot::VERSION}.gem"
15
+ end
13
16
 
14
- task :environment do
17
+ FileUtils.cd 'sunspot_rails' do
18
+ system "gem build sunspot_rails.gemspec"
19
+ system "gem push sunspot_rails-#{Sunspot::VERSION}.gem"
20
+ FileUtils.rm("sunspot_rails-#{Sunspot::VERSION}.gem")
21
+ end
22
+
23
+ FileUtils.cd 'sunspot_solr' do
24
+ system "gem build sunspot_solr.gemspec"
25
+ system "gem push sunspot_solr-#{Sunspot::VERSION}.gem"
26
+ FileUtils.rm("sunspot_solr-#{Sunspot::VERSION}.gem")
27
+ end
15
28
  end
16
29
 
17
- FileList['dev_tasks/*.rake', 'lib/sunspot/rails/tasks.rb'].each { |file| load(file) }
30
+
31
+ desc 'Run all the tests'
32
+ task :default do
33
+ exit system([ "GEM=sunspot ci/travis.sh",
34
+ "GEM=sunspot_rails RAILS=3.0.15 ci/travis.sh",
35
+ "GEM=sunspot_rails RAILS=3.1.6 ci/travis.sh",
36
+ "GEM=sunspot_rails RAILS=3.2.6 ci/travis.sh" ].join(" && ")) ? 0 : 1
37
+ end
data/ci/travis.sh ADDED
@@ -0,0 +1,67 @@
1
+ #!/bin/sh
2
+
3
+ set +e
4
+
5
+ solr_responding() {
6
+ port=$1
7
+ curl -o /dev/null "http://localhost:$port/solr/admin/ping" > /dev/null 2>&1
8
+ }
9
+
10
+ wait_until_solr_responds() {
11
+ port=$1
12
+ while ! solr_responding $1; do
13
+ /bin/echo -n "."
14
+ sleep 1
15
+ done
16
+ }
17
+
18
+ case $GEM in
19
+ "sunspot")
20
+
21
+ cd sunspot
22
+ /bin/echo -n "Starting Solr on port 8983 for Sunspot specs..."
23
+ bundle install --quiet --path vendor/bundle
24
+ if [ -f sunspot-solr.pid ]; then bundle exec sunspot-solr stop || true; fi
25
+
26
+ bundle exec sunspot-solr start -p 8983 -d /tmp/solr
27
+ wait_until_solr_responds 8983
28
+ /bin/echo "done."
29
+
30
+ # Invoke the sunspot specs
31
+ bundle exec rake spec
32
+ rv=$?
33
+
34
+ /bin/echo -n "Stopping Solr... "
35
+ bundle exec sunspot-solr stop
36
+ /bin/echo "done."
37
+
38
+ exit $rv
39
+ ;;
40
+
41
+ "sunspot_rails")
42
+
43
+ cd sunspot
44
+ /bin/echo -n "Starting Solr on port 8983 for Sunspot specs..."
45
+ bundle install --quiet --path vendor/bundle
46
+ if [ -f sunspot-solr.pid ]; then bundle exec sunspot-solr stop || true; fi
47
+
48
+ bundle exec sunspot-solr start -p 8983 -d /tmp/solr
49
+ wait_until_solr_responds 8983
50
+ /bin/echo "done."
51
+
52
+ # Install gems for test Rails application
53
+ cd ../sunspot_rails
54
+ rake spec RAILS=$RAILS
55
+ rv=$?
56
+
57
+ # Cleanup Solr
58
+ /bin/echo -n "Stopping Solr... "
59
+ cd ../sunspot
60
+ bundle exec sunspot-solr stop
61
+ /bin/echo "done."
62
+
63
+ exit $rv
64
+ ;;
65
+
66
+ *)
67
+ esac
@@ -0,0 +1,13 @@
1
+ sunspot-solr.pid
2
+ *.swp
3
+ *.swo
4
+ *~
5
+ coverage
6
+ pkg
7
+ /doc
8
+ .DS_Store
9
+
10
+ .yardoc
11
+ README.rdoc
12
+ .bundle
13
+ Gemfile.lock
data/sunspot/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'sunspot_solr', :path => File.expand_path('../../sunspot_solr', __FILE__)
4
+
5
+ gemspec
@@ -0,0 +1,258 @@
1
+ == 2.0.0
2
+ * Adds support for field grouping (Andy Lindeman)
3
+ * Adds support for native geospatial searches and ordering (Eric Tang, Bruno Miranda, Andy Lindeman)
4
+ * Bundled Solr installation (`sunspot_solr`) is version 3.5.0 (Chris Parker)
5
+ * Adds #query_time method to retrieve the Solr query time in
6
+ milliseconds (Jason Weathered)
7
+ * Fixes syntax of highlighting when used with nested dismax queries (Marco Crepaldi)
8
+ * Adds ability to nest `Sunspot.batch` calls (Thorbjørn Hermansen)
9
+ * Adds `open_timeout` and `read_timeout` configuration options (Rob Di
10
+ Marco)
11
+ * Adds `offset` options to facets (Federico Gonzalez)
12
+ * Adds `Retry5xxSessionProxy` to retry requests when an internal server error
13
+ occurs (Nick Zadrozny)
14
+ * Adds support for range queries (Jan Ulrich)
15
+ * Allows custom field names specified with :as to be symbols (David Oliver)
16
+ * Add field exclusion when faceting (Cuong Hoang)
17
+
18
+ == 1.3.0 2011-11-26
19
+ * Requests to Solr use HTTP POST verb by default to avoid issues when the query string grows too large for GET (Johan Van Ryseghem)
20
+ * `sunspot.yml` supports ERB (Andrew Cholakian)
21
+ * An error is raised when attempting to run the packaged Solr if Java is not available (Lucas Parry)
22
+ * Pagination operates correctly without dependency on `will_paginate` (Larry Sprock, Dave Krupinski)
23
+ * Stored boolean fields with `false` value are returned correctly (yipdw)
24
+ * `highlight` accepts `:formatter` and `:fragmenter` parameters (Jeremy McNevin)
25
+ * Default `headerBufferSize` is increased for packaged Solr make sure the limit is not reached during large queries (gjb83)
26
+ * Packaged Solr respects the `data_path` configuration setting from `sunspot.yml` (djmaze)
27
+ * Packaged Solr correctly uses the `pid_dir` configuration option from `sunspot.yml` (Russen Guggemos)
28
+ * Specs run correctly in 1.9.2 (Larry Sprock)
29
+ * Documentation improvements (Thibaut Barrère, gjb83, Breno Santos Salgado)
30
+ * Adds :offset option to paginate method (Benjamin Fleischer)
31
+ * Requires rsolr 1.0.6, which fixes issues with Unicode characters
32
+ returned by Solr
33
+
34
+ == 1.2.1 2010-12-28
35
+ * Decreased default reindexing batch size from 500 to 50
36
+
37
+ == 1.2.0 2010-12-28
38
+ * Replace solr-spatial-light with client-side geohash-based spatial search
39
+ * Override Solr field naming conventions using :as option
40
+ * Delegate #id method directly to calling context inside DSL
41
+ * Create a SilentFailSessionProxy that rescues exceptions on write operations.
42
+ * Inclusion by identity
43
+ * Solr optimize command
44
+ * Ignore negative :limit option for query facets
45
+ * Eliminated value sorting for range scopes
46
+ * Correctly cast stored boolean values if they are booleans
47
+ * Correctly cast and return stored values for multi-valued fields
48
+
49
+ == 1.1.0 2010-04-01
50
+ * MoreLikeThis support
51
+ * Allow multiple fulltext queries in one search
52
+ * Function queries
53
+ * Update solr-spatial-light to 0.0.6 build
54
+ * Support for :prefix when faceting.
55
+ * Allow specification of solr jar
56
+ * Updated reindex task to allow setting of batch size and list of models to index
57
+ * Use a '*:*' query for deleting the entire index
58
+ * Ability to specify custom request handler for queries
59
+ * Gracefully handle nonexistent search result
60
+
61
+ == 1.0.4 2010-03-19
62
+ * Update solr-spatial-light to 0.0.5
63
+ * Fix NullPointerException in repeated geo search
64
+ * Fix missing distances in repeated geo search
65
+ * Don't query the data store more than once when results are missing
66
+
67
+ == 1.0.2 2010-03-11
68
+ * Restore Hit#distance for result geo distance
69
+ * Remove :distance special sort
70
+ * Quote reserved keywords in boolean queries
71
+ * Add Search#facets accessor to retrieve all facets
72
+
73
+ == 1.0.1 2010-03-05
74
+ * Copy all needed config files when sunspot-installer run with force option
75
+
76
+ == 1.0.0 2010-03-03
77
+ * Multiselect Field Faceting
78
+ * Named field facets
79
+ * Upgrade to Solr 1.4
80
+ * Deletion by query
81
+ * Allow :latitude and :longitude as coordinate method names
82
+ * Assumed inconsistency
83
+ * Support for TrieField numeric/time types
84
+ * Built-in Session Proxies: Thread-local, master/slave, sharding
85
+ * Give DSL blocks access to calling context
86
+ * Create sunspot-installer executable, which modifies an existing
87
+ schema/solrconfig to work with Sunspot
88
+ * Support for Long and Double types
89
+ * new_search method accepts DSL block
90
+ * Sunspot::Server now a real class that manages embedded Sunspot instance
91
+ * Add Search#each_hit_with_result method
92
+ * Able to access stored dynamic fields
93
+ * Access dynamic facets using the #facet method
94
+ * Remove accidental existence of dynamic_text fields
95
+ * Upgrade to RSolr 0.12.1
96
+ * Switch from LocalSolr to solr-spatial-light
97
+ * Turn off request logging in Jetty for default Solr install
98
+ * Full support for class-reloading of Sunspot-setup classes
99
+ * Support time ranges outside of 32-bit range
100
+ * Remove sunspot-configure-solr executable
101
+ * new_search method accepts DSL block
102
+
103
+ == 0.10.8 2009-11-24
104
+ * Strictly enforce RSolr 0.9.6 gem dependency (newer ones broken)
105
+
106
+ == 0.10.7 2009-11-16
107
+ * Ignore boost_fields that don't apply
108
+ * Ability to specify text_fields inside connectives
109
+ * Fix bug with newlines in strings incorrectly being considered multi-value
110
+ * Compatibility with RSolr 0.10.1
111
+ * Remove commented-out code entirely
112
+
113
+ == 0.10.6 2009-11-05
114
+ * Support more dismax parameters
115
+ * Support multiple boost queries
116
+ * Allow "extra" facet rows
117
+ * Allow exclusion of fulltext fields
118
+ * Allow specification of per-field highlighting params
119
+ * Specify coordinates using block extraction
120
+ * Return empty array if no highlights available
121
+ * Get stored text fields from hits
122
+ * Update docs to reflect a requirement of at least one search type
123
+ * added --max-memory and --min-memory parameters to sunspot-solr
124
+ * LocalLucene and LocalSolr compatible with Java 1.5
125
+
126
+ == 0.10.5 2009-10-22
127
+ * Fix highlighting for multiple-model search
128
+
129
+ == 0.10.4 2009-10-20
130
+ * Add adjust_params method, allowing experts to manually edit Solr params
131
+ * Track adds and deletes separately in session, and expose delete_dirty? method
132
+ * Allow clients to inject a singleton session proxy
133
+
134
+ == 0.10.3 2009-10-15
135
+ * Contiguous, not continuous
136
+ * Fail fast if less-than-1 radius passed for local search
137
+
138
+ == 0.10.2 2009-10-09
139
+ * Add Sunspot.config.xml_builder option, which is passed to RSolr
140
+
141
+ == 0.10.1 2009-10-08
142
+ * Fix directory bugs in sunspot-solr executable
143
+
144
+ == 0.10.0 2009-10-08
145
+ * Support for geographical search using LocalSolr
146
+ * Support for keyword highlighting, with custom deferred formatting
147
+ * New fulltext DSL for specifying advanced dismax options
148
+ * Support boost queries
149
+ * Support for search-time field boost
150
+ * Support for phrase fields
151
+ * Support for prefix queries
152
+ * Set default search-time field boost in setup
153
+ * Restrict field facet to a set of desired values
154
+ * Query facets support all facet options
155
+ * Allow scoping by text fields
156
+ * Support executing searches repeatedly
157
+ * Allow setting of Solr URL for integration tests in environment variable
158
+ * Add support for master/slave configurations
159
+ * Added logging options to sunspot-solr executable
160
+ * Added default solr config file location to Sunspot::Configuration
161
+ * Informative, non-firehose Search#inspect
162
+ * No longer require arguments to #paginate
163
+ * Silently ignore keyword calls with nil/blank/whitespace keywords
164
+ * Don't require that all searched types have a referenced field
165
+ * Correct backwards ranges
166
+ * Raise descriptive error if no types passed to search
167
+ * Handle empty query facets, query facet rows, and connectives
168
+ * Quote values in range restrictions if they contain spaces
169
+ * Fix bug in Sunspot::Util.full_const_get
170
+ * Remove support for :other option in time faceting
171
+ * Remove order_by_random() method
172
+ * Removed options and Query from public API
173
+ * Use built-in optparse instead of optiflag in bin/sunspot-solr
174
+ * Remove dependency on haml and use erb since it is only used to generate one file
175
+
176
+ == 0.9.0 2009-07-21
177
+ * Use Dismax parser for keyword search
178
+ * Field and document boosting
179
+ * Specify which fields to search in keyword search
180
+ * Allow indexing of multiple values in text fields
181
+ * Access keyword relevance score in Hit objects
182
+ * Allow stored fields, retrieve stored values from Hit objects
183
+ * Support more values in shorthand restrictions
184
+ * Disjunctions and conjunctions
185
+ * Random ordering
186
+ * Control all options for field facets
187
+ * Time range facets
188
+ * Get referenced objects from facets on foreign keys
189
+ * Facet by class
190
+ * Batch indexing
191
+ * New Date field type
192
+ * Direct access to data accessors
193
+ * Executable to configure production Solr instances
194
+ * Replace solr-ruby with RSolr
195
+ * Remove accidental ActiveSupport dependency
196
+
197
+ == 0.8.9 2009-06-23
198
+ * Fix OrderedHash bug in older versions of ActiveSupport
199
+
200
+ == 0.8.8 2009-06-15
201
+ * Escape type names to support namespaced classes
202
+ * Fix bug with anonymous modules in Ruby 1.9
203
+
204
+ == 0.8.7 2009-06-10
205
+ * Add --pid-dir option for sunspot-solr executable
206
+
207
+ == 0.8.5 2009-06-09
208
+ * Added dependencies for sunspot-solr executable to gem dependencies
209
+ * Search for adapters using class ancestors rather than superclasses
210
+
211
+ == 0.8.3 2009-06-03
212
+ * Index objects passed as a collection in a single HTTP request
213
+
214
+ == 0.8.2 2009-05-27
215
+ * Allow specification of Solr home when using sunspot-solr
216
+
217
+ == 0.8.1 2009-05-26
218
+ * Add Search#execute! to public API
219
+
220
+ == 0.8.0 2009-05-22
221
+ * Access query API directly; instantiate search without running it
222
+ * Dynamic fields
223
+ * Search blocks can be evaluated in calling context
224
+
225
+ == 0.7.3 2009-05-06
226
+ * Better exception handling when class doesn't have adapter/setup
227
+
228
+ == 0.7.2 2009-04-29
229
+ * Dirty sessions
230
+
231
+ == 0.7.1 2009-04-29
232
+ * Removed extlib dependency from gemspec
233
+
234
+ == 0.7.0 2009-04-28
235
+ * Less magic in the DSL
236
+ * Restrict by empty values
237
+ * Negative scoping using without() method
238
+ * Exclusion by object identity using without(instance)
239
+ * Support for faceting
240
+ * Explicit commits
241
+ * Boolean field type
242
+ * Attribute field flexibility
243
+ * Virtual field blocks can be evaluated in calling context
244
+ * Order available by multiple fields
245
+ * New adapter API
246
+ * Got rid of builder API
247
+ * Full documentation
248
+
249
+ == 0.0.2 2009-02-14
250
+ * Run sunspot's built-in Solr instance using
251
+ sunspot-solr executable
252
+ * Search hash interpretation delegated to
253
+ Builder object
254
+
255
+ == 0.0.1 2008-12-11
256
+ * Initial release
257
+ * Define indexing for any class using DSL
258
+ * Search indexed classes using DSL
File without changes
data/sunspot/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ Dir['tasks/**/*.rake'].each { |t| load t }
6
+
7
+ desc "Run all examples"
8
+ RSpec::Core::RakeTask.new(:spec) do |t|
9
+ t.rspec_opts = '--format documentation'
10
+ t.ruby_opts = "-W1"
11
+ end
12
+
13
+ task :default => :spec
data/sunspot/TODO ADDED
@@ -0,0 +1,13 @@
1
+ === Sunspot 1.1.x ===
2
+ * commitWithin (needs support from RSolr, currently available in master)
3
+ * commit options (non-blocking, etc.)
4
+
5
+ === Someday ===
6
+ * Shorthand arguments to Sunspot#search
7
+ * Rudimentary fulltext prefixing support
8
+
9
+ === Solr 1.5 ===
10
+ * Field Collapsing (SOLR-236)
11
+ * Support for official spatial support (SOLR-773)
12
+ * Support sorting by function
13
+ * Support string constants in functions
@@ -0,0 +1,40 @@
1
+ module LightConfig
2
+ class Configuration
3
+ def initialize(&block)
4
+ @properties = {}
5
+ ::LightConfig::Builder.new(self).instance_eval(&block)
6
+ singleton = (class <<self; self; end)
7
+ @properties.keys.each do |property|
8
+ singleton.module_eval do
9
+ define_method property do
10
+ @properties[property]
11
+ end
12
+
13
+ define_method "#{property}=" do |value|
14
+ @properties[property] = value
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+ class Builder
22
+ def initialize(configuration)
23
+ @configuration = configuration
24
+ end
25
+
26
+ def method_missing(method, *args, &block)
27
+ raise ArgumentError("wrong number of arguments(#{args.length} for 1)") unless args.length < 2
28
+ value = if block then ::LightConfig::Configuration.new(&block)
29
+ else args.first
30
+ end
31
+ @configuration.instance_variable_get(:@properties)[method] = value
32
+ end
33
+ end
34
+
35
+ class <<self
36
+ def build(&block)
37
+ LightConfig::Configuration.new(&block)
38
+ end
39
+ end
40
+ end