blacklight 6.20.0 → 7.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (428) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.jshintrc +3 -1
  4. data/.npmignore +23 -0
  5. data/.rubocop.yml +40 -16
  6. data/.rubocop_todo.yml +478 -382
  7. data/.travis.yml +28 -31
  8. data/CONTRIBUTING.md +50 -0
  9. data/Gemfile +5 -2
  10. data/README.md +22 -5
  11. data/Rakefile +3 -2
  12. data/VERSION +1 -1
  13. data/Vagrantfile +2 -0
  14. data/app/assets/images/blacklight/list.svg +1 -0
  15. data/app/assets/images/blacklight/search.svg +1 -0
  16. data/app/assets/javascripts/blacklight/blacklight.js +495 -57
  17. data/app/assets/stylesheets/blacklight/_balanced_list.scss +7 -12
  18. data/app/assets/stylesheets/blacklight/_blacklight_base.scss +18 -15
  19. data/app/assets/stylesheets/blacklight/_bookmark.scss +1 -13
  20. data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +31 -0
  21. data/app/assets/stylesheets/blacklight/_constraints.scss +17 -25
  22. data/app/assets/stylesheets/blacklight/_controls.scss +8 -16
  23. data/app/assets/stylesheets/blacklight/_facets.scss +66 -92
  24. data/app/assets/stylesheets/blacklight/_header.scss +60 -47
  25. data/app/assets/stylesheets/blacklight/_icons.scss +35 -0
  26. data/app/assets/stylesheets/blacklight/_layout.scss +0 -10
  27. data/app/assets/stylesheets/blacklight/_mixins.scss +15 -0
  28. data/app/assets/stylesheets/blacklight/_modal.scss +9 -17
  29. data/app/assets/stylesheets/blacklight/_pagination.scss +4 -13
  30. data/app/assets/stylesheets/blacklight/_search_form.scss +7 -0
  31. data/app/assets/stylesheets/blacklight/_search_history.scss +5 -13
  32. data/app/assets/stylesheets/blacklight/_search_results.scss +9 -8
  33. data/app/assets/stylesheets/blacklight/_twitter_typeahead.scss +1 -2
  34. data/app/assets/stylesheets/blacklight/blacklight.scss +1 -1
  35. data/app/builders/blacklight/action_builder.rb +57 -0
  36. data/app/controllers/bookmarks_controller.rb +2 -2
  37. data/app/controllers/catalog_controller.rb +2 -2
  38. data/app/controllers/concerns/blacklight/base.rb +0 -33
  39. data/app/controllers/concerns/blacklight/bookmarks.rb +20 -30
  40. data/app/controllers/concerns/blacklight/catalog.rb +256 -210
  41. data/app/controllers/concerns/blacklight/controller.rb +102 -124
  42. data/app/controllers/concerns/blacklight/default_component_configuration.rb +12 -43
  43. data/app/controllers/concerns/blacklight/facet.rb +22 -8
  44. data/app/controllers/concerns/blacklight/search_context.rb +11 -11
  45. data/app/controllers/concerns/blacklight/search_fields.rb +4 -14
  46. data/app/controllers/concerns/blacklight/search_history.rb +1 -6
  47. data/app/controllers/concerns/blacklight/searchable.rb +17 -0
  48. data/app/controllers/concerns/blacklight/token_based_user.rb +5 -7
  49. data/app/helpers/blacklight/blacklight_helper_behavior.rb +37 -119
  50. data/app/helpers/blacklight/catalog_helper_behavior.rb +103 -93
  51. data/app/helpers/blacklight/component_helper_behavior.rb +21 -21
  52. data/app/helpers/blacklight/configuration_helper_behavior.rb +30 -58
  53. data/app/helpers/blacklight/facets_helper_behavior.rb +79 -54
  54. data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +9 -11
  55. data/app/helpers/blacklight/icon_helper_behavior.rb +18 -0
  56. data/app/helpers/blacklight/layout_helper_behavior.rb +3 -3
  57. data/app/helpers/blacklight/render_constraints_helper_behavior.rb +8 -6
  58. data/app/helpers/blacklight/render_partials_helper_behavior.rb +207 -0
  59. data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +19 -11
  60. data/app/helpers/blacklight/suggest_helper_behavior.rb +1 -0
  61. data/app/helpers/blacklight/url_helper_behavior.rb +51 -42
  62. data/app/{assets/javascripts → javascript}/blacklight/autocomplete.js +3 -2
  63. data/app/javascript/blacklight/bookmark_toggle.js +25 -0
  64. data/app/javascript/blacklight/button_focus.js +9 -0
  65. data/app/javascript/blacklight/checkbox_submit.js +134 -0
  66. data/app/javascript/blacklight/core.js +41 -0
  67. data/app/javascript/blacklight/facet_load.js +22 -0
  68. data/app/{assets/javascripts/blacklight/ajax_modal.js → javascript/blacklight/modal.js} +62 -64
  69. data/app/javascript/blacklight/search_context.js +67 -0
  70. data/app/models/blacklight/facet_paginator.rb +3 -3
  71. data/app/models/blacklight/icon.rb +79 -0
  72. data/app/models/blacklight/suggest_search.rb +1 -1
  73. data/app/models/bookmark.rb +5 -10
  74. data/app/models/concerns/blacklight/configurable.rb +13 -13
  75. data/app/models/concerns/blacklight/document.rb +23 -39
  76. data/app/models/concerns/blacklight/document/active_model_shim.rb +8 -11
  77. data/app/models/concerns/blacklight/document/cache_key.rb +1 -1
  78. data/app/models/concerns/blacklight/document/dublin_core.rb +2 -2
  79. data/app/models/concerns/blacklight/document/email.rb +5 -5
  80. data/app/models/concerns/blacklight/document/extensions.rb +5 -5
  81. data/app/models/concerns/blacklight/document/semantic_fields.rb +9 -9
  82. data/app/models/concerns/blacklight/document/sms.rb +3 -3
  83. data/app/models/concerns/blacklight/user.rb +7 -6
  84. data/app/models/record_mailer.rb +8 -6
  85. data/app/models/search.rb +5 -7
  86. data/app/presenters/blacklight/document_presenter.rb +25 -140
  87. data/app/presenters/blacklight/field_presenter.rb +19 -14
  88. data/app/presenters/blacklight/index_presenter.rb +43 -71
  89. data/app/presenters/blacklight/json_presenter.rb +10 -14
  90. data/app/presenters/blacklight/link_alternate_presenter.rb +3 -1
  91. data/app/presenters/blacklight/rendering/abstract_step.rb +7 -5
  92. data/app/presenters/blacklight/rendering/helper_method.rb +10 -8
  93. data/app/presenters/blacklight/rendering/join.rb +5 -3
  94. data/app/presenters/blacklight/rendering/link_to_facet.rb +23 -19
  95. data/app/presenters/blacklight/rendering/microdata.rb +6 -3
  96. data/app/presenters/blacklight/rendering/pipeline.rb +27 -10
  97. data/app/presenters/blacklight/rendering/terminator.rb +2 -0
  98. data/app/presenters/blacklight/search_bar_presenter.rb +41 -0
  99. data/app/presenters/blacklight/show_presenter.rb +26 -72
  100. data/app/presenters/blacklight/thumbnail_presenter.rb +74 -0
  101. data/app/services/blacklight/document_factory.rb +13 -0
  102. data/app/services/blacklight/field_retriever.rb +26 -24
  103. data/app/services/blacklight/search_service.rb +153 -0
  104. data/app/values/blacklight/types.rb +31 -0
  105. data/app/views/blacklight/nav/_bookmark.html.erb +2 -2
  106. data/app/views/blacklight/nav/_search_history.html.erb +1 -1
  107. data/app/views/bookmarks/_tools.html.erb +2 -2
  108. data/app/views/bookmarks/index.html.erb +12 -13
  109. data/app/views/catalog/_bookmark_control.html.erb +27 -13
  110. data/app/views/catalog/_constraints.html.erb +6 -7
  111. data/app/views/catalog/_constraints_element.html.erb +6 -6
  112. data/app/views/catalog/_did_you_mean.html.erb +1 -1
  113. data/app/views/catalog/{_document_default.atom.builder → _document.atom.builder} +20 -19
  114. data/app/views/catalog/_document.html.erb +5 -3
  115. data/app/views/catalog/{_document_default.rss.builder → _document.rss.builder} +2 -0
  116. data/app/views/catalog/_document_action.html.erb +2 -1
  117. data/app/views/catalog/_email_form.html.erb +8 -4
  118. data/app/views/catalog/_facet_group.html.erb +19 -0
  119. data/app/views/catalog/_facet_index_navigation.html.erb +5 -4
  120. data/app/views/catalog/_facet_layout.html.erb +13 -8
  121. data/app/views/catalog/_facet_limit.html.erb +3 -2
  122. data/app/views/catalog/_facet_pagination.html.erb +8 -8
  123. data/app/views/catalog/_facet_pivot.html.erb +2 -2
  124. data/app/views/catalog/_facets.html.erb +3 -21
  125. data/app/views/catalog/_field.json.jbuilder +10 -0
  126. data/app/views/catalog/{_group_default.html.erb → _group.html.erb} +1 -1
  127. data/app/views/catalog/_home_text.html.erb +32 -36
  128. data/app/views/catalog/_index.html.erb +10 -0
  129. data/app/views/catalog/{_index_header_default.html.erb → _index_header.html.erb} +3 -3
  130. data/app/views/catalog/_per_page_widget.html.erb +7 -8
  131. data/app/views/catalog/_previous_next_doc.html.erb +6 -14
  132. data/app/views/catalog/_results_pagination.html.erb +2 -2
  133. data/app/views/catalog/_search_form.html.erb +12 -8
  134. data/app/views/catalog/_search_header.html.erb +0 -3
  135. data/app/views/catalog/_search_results.html.erb +10 -2
  136. data/app/views/catalog/_show.html.erb +8 -0
  137. data/app/views/catalog/{_show_header_default.html.erb → _show_header.html.erb} +0 -0
  138. data/app/views/catalog/_show_main_content.html.erb +4 -4
  139. data/app/views/catalog/_show_more_like_this.html.erb +1 -1
  140. data/app/views/catalog/_show_sidebar.html.erb +10 -8
  141. data/app/views/catalog/_show_tools.html.erb +10 -21
  142. data/app/views/catalog/_sms_form.html.erb +8 -4
  143. data/app/views/catalog/_sort_and_per_page.html.erb +3 -3
  144. data/app/views/catalog/_sort_widget.html.erb +8 -8
  145. data/app/views/catalog/_thumbnail.html.erb +5 -0
  146. data/app/views/catalog/_view_type_group.html.erb +2 -2
  147. data/app/views/catalog/_zero_results.html.erb +1 -1
  148. data/app/views/catalog/email.html.erb +5 -3
  149. data/app/views/catalog/email_success.html.erb +12 -8
  150. data/app/views/catalog/facet.html.erb +10 -8
  151. data/app/views/catalog/facet.json.jbuilder +2 -0
  152. data/app/views/catalog/index.atom.builder +28 -30
  153. data/app/views/catalog/index.html.erb +9 -11
  154. data/app/views/catalog/index.json.jbuilder +84 -3
  155. data/app/views/catalog/index.rss.builder +8 -6
  156. data/app/views/catalog/opensearch.xml.builder +12 -10
  157. data/app/views/catalog/show.html.erb +11 -6
  158. data/app/views/catalog/show.json.jbuilder +21 -0
  159. data/app/views/catalog/sms.html.erb +3 -1
  160. data/app/views/catalog/sms_success.html.erb +12 -8
  161. data/app/views/kaminari/blacklight/_first_page.html.erb +2 -2
  162. data/app/views/kaminari/blacklight/_gap.html.erb +2 -2
  163. data/app/views/kaminari/blacklight/_last_page.html.erb +2 -2
  164. data/app/views/kaminari/blacklight/_next_page.html.erb +5 -5
  165. data/app/views/kaminari/blacklight/_page.html.erb +5 -3
  166. data/app/views/kaminari/blacklight/_prev_page.html.erb +4 -4
  167. data/app/views/kaminari/blacklight_compact/_paginator.html.erb +4 -4
  168. data/app/views/layouts/blacklight.html.erb +14 -41
  169. data/app/views/layouts/blacklight/base.html.erb +40 -0
  170. data/app/views/layouts/catalog_result.html.erb +11 -0
  171. data/app/views/record_mailer/email_record.text.erb +6 -5
  172. data/app/views/search_history/index.html.erb +16 -21
  173. data/app/views/{_flash_msg.html.erb → shared/_flash_msg.html.erb} +5 -3
  174. data/app/views/shared/_header_navbar.html.erb +8 -13
  175. data/app/views/shared/_modal.html.erb +6 -0
  176. data/app/views/shared/_user_util_links.html.erb +22 -0
  177. data/blacklight.gemspec +8 -12
  178. data/config/i18n-tasks.yml +17 -0
  179. data/config/locales/blacklight.de.yml +87 -83
  180. data/config/locales/blacklight.en.yml +32 -29
  181. data/config/locales/blacklight.es.yml +31 -28
  182. data/config/locales/blacklight.fr.yml +33 -35
  183. data/config/locales/blacklight.hu.yml +226 -0
  184. data/config/locales/blacklight.it.yml +32 -28
  185. data/config/locales/blacklight.nl.yml +226 -0
  186. data/config/locales/blacklight.pt-BR.yml +41 -31
  187. data/config/locales/blacklight.sq.yml +21 -30
  188. data/config/locales/blacklight.zh.yml +20 -28
  189. data/config/routes.rb +2 -10
  190. data/db/migrate/20140202020202_create_bookmarks.rb +0 -1
  191. data/db/migrate/20140320000000_add_polymorphic_type_to_bookmarks.rb +1 -1
  192. data/lib/blacklight.rb +6 -4
  193. data/lib/blacklight/abstract_repository.rb +9 -9
  194. data/lib/blacklight/configuration.rb +106 -88
  195. data/lib/blacklight/configuration/context.rb +12 -1
  196. data/lib/blacklight/configuration/facet_field.rb +16 -9
  197. data/lib/blacklight/configuration/field.rb +32 -3
  198. data/lib/blacklight/configuration/fields.rb +15 -17
  199. data/lib/blacklight/configuration/null_field.rb +2 -0
  200. data/lib/blacklight/configuration/search_field.rb +2 -2
  201. data/lib/blacklight/configuration/sort_field.rb +2 -2
  202. data/lib/blacklight/configuration/view_config.rb +4 -0
  203. data/lib/blacklight/engine.rb +10 -10
  204. data/lib/blacklight/exceptions.rb +4 -7
  205. data/lib/blacklight/{utils.rb → nested_open_struct_with_hash_access.rb} +9 -81
  206. data/lib/blacklight/open_struct_with_hash_access.rb +49 -0
  207. data/lib/blacklight/parameters.rb +1 -1
  208. data/lib/blacklight/routes/exportable.rb +1 -3
  209. data/lib/blacklight/routes/searchable.rb +3 -3
  210. data/lib/blacklight/runtime_registry.rb +2 -0
  211. data/lib/blacklight/search_builder.rb +28 -35
  212. data/lib/blacklight/search_state.rb +10 -8
  213. data/lib/blacklight/solr.rb +2 -0
  214. data/{app/models/concerns → lib}/blacklight/solr/document.rb +8 -8
  215. data/{app/models → lib}/blacklight/solr/facet_paginator.rb +3 -3
  216. data/lib/blacklight/solr/repository.rb +4 -3
  217. data/lib/blacklight/solr/request.rb +1 -1
  218. data/lib/blacklight/solr/response.rb +29 -30
  219. data/lib/blacklight/solr/response/facets.rb +38 -31
  220. data/lib/blacklight/solr/response/group.rb +3 -3
  221. data/lib/blacklight/solr/response/group_response.rb +11 -1
  222. data/lib/blacklight/solr/response/more_like_this.rb +2 -2
  223. data/lib/blacklight/solr/response/pagination_methods.rb +12 -0
  224. data/lib/blacklight/solr/response/response.rb +2 -2
  225. data/lib/blacklight/solr/response/spelling.rb +4 -3
  226. data/lib/blacklight/solr/search_builder_behavior.rb +27 -31
  227. data/lib/blacklight/version.rb +1 -1
  228. data/lib/generators/blacklight/assets_generator.rb +28 -12
  229. data/lib/generators/blacklight/controller_generator.rb +4 -5
  230. data/lib/generators/blacklight/document_generator.rb +1 -1
  231. data/lib/generators/blacklight/install_generator.rb +15 -34
  232. data/lib/generators/blacklight/search_builder_generator.rb +1 -1
  233. data/lib/generators/blacklight/{solr5_generator.rb → solr_generator.rb} +12 -6
  234. data/{.solr_wrapper.yml → lib/generators/blacklight/templates/.solr_wrapper.yml} +0 -0
  235. data/lib/generators/blacklight/templates/alternate_controller.rb +4 -4
  236. data/lib/generators/blacklight/templates/blacklight.scss +0 -2
  237. data/lib/generators/blacklight/templates/catalog_controller.rb +57 -50
  238. data/lib/generators/blacklight/templates/config/blacklight.yml +1 -13
  239. data/{solr → lib/generators/blacklight/templates/solr}/conf/_rest_managed.json +0 -0
  240. data/{solr → lib/generators/blacklight/templates/solr}/conf/admin-extra.html +0 -0
  241. data/{solr → lib/generators/blacklight/templates/solr}/conf/elevate.xml +0 -0
  242. data/{solr → lib/generators/blacklight/templates/solr}/conf/mapping-ISOLatin1Accent.txt +0 -0
  243. data/{solr → lib/generators/blacklight/templates/solr}/conf/protwords.txt +0 -0
  244. data/lib/generators/blacklight/templates/solr/conf/schema.xml +388 -0
  245. data/{solr → lib/generators/blacklight/templates/solr}/conf/scripts.conf +0 -0
  246. data/lib/generators/blacklight/templates/solr/conf/solrconfig.xml +195 -0
  247. data/{solr → lib/generators/blacklight/templates/solr}/conf/spellings.txt +0 -0
  248. data/{solr → lib/generators/blacklight/templates/solr}/conf/stopwords.txt +0 -0
  249. data/{solr → lib/generators/blacklight/templates/solr}/conf/stopwords_en.txt +0 -0
  250. data/{solr → lib/generators/blacklight/templates/solr}/conf/synonyms.txt +0 -0
  251. data/{solr → lib/generators/blacklight/templates/solr}/conf/xslt/example.xsl +0 -0
  252. data/{solr → lib/generators/blacklight/templates/solr}/conf/xslt/example_atom.xsl +0 -0
  253. data/{solr → lib/generators/blacklight/templates/solr}/conf/xslt/example_rss.xsl +0 -0
  254. data/{solr → lib/generators/blacklight/templates/solr}/conf/xslt/luke.xsl +0 -0
  255. data/lib/generators/blacklight/test_support_generator.rb +10 -10
  256. data/lib/generators/blacklight/user_generator.rb +5 -6
  257. data/lib/railties/blacklight.rake +7 -6
  258. data/package-lock.json +2793 -0
  259. data/package.json +30 -0
  260. data/spec/controllers/alternate_controller_spec.rb +5 -4
  261. data/spec/controllers/application_controller_spec.rb +1 -5
  262. data/spec/controllers/blacklight/base_spec.rb +6 -3
  263. data/spec/controllers/blacklight/catalog/component_configuration_spec.rb +11 -7
  264. data/spec/controllers/blacklight/facet_spec.rb +1 -2
  265. data/spec/controllers/blacklight/search_fields_spec.rb +25 -34
  266. data/spec/controllers/bookmarks_controller_spec.rb +17 -13
  267. data/spec/controllers/catalog_controller_spec.rb +329 -161
  268. data/spec/controllers/search_history_controller_spec.rb +6 -6
  269. data/spec/features/alternate_controller_spec.rb +4 -4
  270. data/spec/features/autocomplete_spec.rb +4 -2
  271. data/spec/features/bookmarks_spec.rb +10 -10
  272. data/spec/features/did_you_mean_spec.rb +7 -12
  273. data/spec/features/facets_spec.rb +38 -17
  274. data/spec/features/record_view_spec.rb +12 -18
  275. data/spec/features/search_context_spec.rb +6 -7
  276. data/spec/features/search_crawler_spec.rb +3 -5
  277. data/spec/features/search_filters_spec.rb +100 -80
  278. data/spec/features/search_formats_spec.rb +4 -5
  279. data/spec/features/search_history_spec.rb +6 -29
  280. data/spec/features/search_pagination_spec.rb +4 -2
  281. data/spec/features/search_results_spec.rb +14 -12
  282. data/spec/features/search_sort_spec.rb +2 -2
  283. data/spec/features/search_spec.rb +8 -9
  284. data/spec/features/sitelinks_search_box.rb +4 -4
  285. data/{solr → spec/fixtures}/sample_solr_documents.yml +688 -688
  286. data/spec/helpers/{configuration_helper_spec.rb → blacklight/configuration_helper_behavior_spec.rb} +97 -98
  287. data/spec/helpers/{facets_helper_spec.rb → blacklight/facets_helper_behavior_spec.rb} +82 -73
  288. data/spec/helpers/{hash_as_hidden_fields_spec.rb → blacklight/hash_as_hidden_fields_behavior_spec.rb} +2 -2
  289. data/spec/helpers/blacklight/icon_helper_behavior_spec.rb +10 -0
  290. data/spec/helpers/{layout_helper_spec.rb → blacklight/layout_helper_behavior_spec.rb} +5 -5
  291. data/spec/helpers/{render_constraints_helper_spec.rb → blacklight/render_constraints_helper_behavior_spec.rb} +10 -6
  292. data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +92 -0
  293. data/spec/helpers/{search_history_constraints_helper_spec.rb → blacklight/search_history_constraints_helper_behavior_spec.rb} +29 -30
  294. data/spec/helpers/{suggest_helper_spec.rb → blacklight/suggest_helper_behavior_spec.rb} +9 -2
  295. data/spec/helpers/{url_helper_spec.rb → blacklight/url_helper_behavior_spec.rb} +61 -54
  296. data/spec/helpers/blacklight_helper_spec.rb +104 -151
  297. data/spec/helpers/catalog_helper_spec.rb +89 -105
  298. data/spec/i18n_spec.rb +18 -0
  299. data/spec/integration/generators/blacklight/{solr5_generator_spec.rb → solr_generator_spec.rb} +21 -13
  300. data/spec/lib/blacklight/configuration/facet_field_spec.rb +13 -0
  301. data/spec/lib/blacklight/configuration/field_spec.rb +15 -0
  302. data/spec/lib/blacklight/nested_open_struct_with_hash_access_spec.rb +17 -0
  303. data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +148 -0
  304. data/spec/lib/blacklight/parameters_spec.rb +4 -2
  305. data/spec/lib/blacklight/search_state_spec.rb +53 -36
  306. data/spec/lib/blacklight_spec.rb +14 -15
  307. data/spec/lib/tasks/blacklight_task_spec.rb +4 -6
  308. data/spec/models/blacklight/configurable_spec.rb +24 -27
  309. data/spec/models/blacklight/configuration/context_spec.rb +9 -10
  310. data/spec/models/blacklight/configuration_spec.rb +188 -165
  311. data/spec/models/blacklight/document/active_model_shim_spec.rb +15 -6
  312. data/spec/models/blacklight/document/cache_key_spec.rb +10 -3
  313. data/spec/models/blacklight/document/dublin_core_spec.rb +17 -20
  314. data/spec/models/blacklight/document/email_spec.rb +10 -10
  315. data/spec/models/blacklight/document/sms_spec.rb +10 -10
  316. data/spec/models/blacklight/document_spec.rb +10 -22
  317. data/spec/models/blacklight/facet_paginator_spec.rb +40 -30
  318. data/spec/models/blacklight/icon_spec.rb +82 -0
  319. data/spec/models/blacklight/search_builder_spec.rb +41 -26
  320. data/spec/models/blacklight/solr/document_spec.rb +224 -216
  321. data/spec/models/blacklight/solr/facet_paginator_spec.rb +6 -4
  322. data/spec/models/blacklight/solr/repository_spec.rb +50 -42
  323. data/spec/models/blacklight/solr/request_spec.rb +17 -18
  324. data/spec/models/blacklight/solr/response/facets_spec.rb +97 -60
  325. data/spec/models/blacklight/solr/response/group_response_spec.rb +29 -22
  326. data/spec/models/blacklight/solr/response/group_spec.rb +18 -25
  327. data/spec/models/blacklight/solr/response_spec.rb +72 -68
  328. data/spec/models/blacklight/solr/search_builder_spec.rb +150 -164
  329. data/spec/models/blacklight/suggest/response_spec.rb +2 -1
  330. data/spec/models/blacklight/suggest_search_spec.rb +4 -4
  331. data/spec/models/blacklight/user_spec.rb +9 -11
  332. data/spec/models/bookmark_spec.rb +7 -6
  333. data/spec/models/record_mailer_spec.rb +23 -21
  334. data/spec/models/search_spec.rb +19 -18
  335. data/spec/models/solr_document_spec.rb +33 -5
  336. data/spec/presenters/blacklight/document_presenter_spec.rb +86 -0
  337. data/spec/presenters/{index_presenter_spec.rb → blacklight/index_presenter_spec.rb} +25 -62
  338. data/spec/presenters/blacklight/json_presenter_spec.rb +59 -0
  339. data/spec/presenters/blacklight/link_alternate_presenter_spec.rb +3 -0
  340. data/spec/presenters/blacklight/search_bar_presenter_spec.rb +94 -0
  341. data/spec/presenters/{show_presenter_spec.rb → blacklight/show_presenter_spec.rb} +47 -62
  342. data/spec/presenters/pipeline_spec.rb +43 -16
  343. data/spec/presenters/thumbnail_presenter_spec.rb +174 -0
  344. data/spec/routing/catalog_routing_spec.rb +13 -31
  345. data/spec/services/blacklight/search_service_spec.rb +495 -0
  346. data/spec/spec_helper.rb +12 -24
  347. data/spec/support/features.rb +1 -1
  348. data/spec/support/features/session_helpers.rb +4 -4
  349. data/spec/test_app_templates/Gemfile.extra +2 -5
  350. data/spec/test_app_templates/lib/generators/test_app_generator.rb +12 -13
  351. data/spec/views/catalog/_constraints.html.erb_spec.rb +3 -6
  352. data/spec/views/catalog/_constraints_element.html.erb_spec.rb +17 -13
  353. data/spec/views/catalog/_document.html.erb_spec.rb +11 -11
  354. data/spec/views/catalog/_document_list.html.erb_spec.rb +2 -1
  355. data/spec/views/catalog/_facet_group.html.erb_spec.rb +82 -0
  356. data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +5 -5
  357. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +6 -6
  358. data/spec/views/catalog/_facets.html.erb_spec.rb +6 -46
  359. data/spec/views/catalog/{_index_default.erb_spec.rb → _index.html.erb_spec.rb} +14 -15
  360. data/spec/views/catalog/{_index_header_default.html.erb_spec.rb → _index_header.html.erb_spec.rb} +6 -9
  361. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +7 -30
  362. data/spec/views/catalog/_search_header.erb_spec.rb +1 -3
  363. data/spec/views/catalog/{_show_default.erb_spec.rb → _show.html.erb_spec.rb} +13 -14
  364. data/spec/views/catalog/_show_sidebar.erb_spec.rb +7 -10
  365. data/spec/views/catalog/_show_tools.html.erb_spec.rb +6 -6
  366. data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +1 -2
  367. data/spec/views/catalog/_sort_widget.html.erb_spec.rb +3 -1
  368. data/spec/views/catalog/{_thumbnail_default.erb_spec.rb → _thumbnail.html.erb_spec.rb} +7 -9
  369. data/spec/views/catalog/_view_type_group.html.erb_spec.rb +12 -10
  370. data/spec/views/catalog/email_success.html.erb_spec.rb +8 -0
  371. data/spec/views/catalog/facet.html.erb_spec.rb +4 -3
  372. data/spec/views/catalog/facet.json.jbuilder_spec.rb +3 -2
  373. data/spec/views/catalog/index.atom.builder_spec.rb +11 -6
  374. data/spec/views/catalog/index.html.erb_spec.rb +6 -8
  375. data/spec/views/catalog/index.json.jbuilder_spec.rb +119 -26
  376. data/spec/views/catalog/opensearch.xml.builder_spec.rb +1 -1
  377. data/spec/views/catalog/show.html.erb_spec.rb +8 -8
  378. data/spec/views/catalog/show.json.jbuilder_spec.rb +40 -0
  379. data/spec/views/catalog/sms_success.html.erb_spec.rb +8 -0
  380. data/spec/views/{_user_util_links.html.erb_spec.rb → shared/_user_util_links.html.erb_spec.rb} +4 -7
  381. data/tasks/blacklight.rake +9 -12
  382. data/template.demo.rb +4 -12
  383. metadata +178 -218
  384. data/app/assets/javascripts/blacklight/autofocus.js +0 -16
  385. data/app/assets/javascripts/blacklight/bookmark_toggle.js +0 -23
  386. data/app/assets/javascripts/blacklight/checkbox_submit.js +0 -139
  387. data/app/assets/javascripts/blacklight/collapsable.js +0 -9
  388. data/app/assets/javascripts/blacklight/core.js +0 -30
  389. data/app/assets/javascripts/blacklight/facet_load.js +0 -23
  390. data/app/assets/javascripts/blacklight/search_context.js +0 -42
  391. data/app/controllers/concerns/blacklight/request_builders.rb +0 -77
  392. data/app/controllers/concerns/blacklight/saved_searches.rb +0 -70
  393. data/app/controllers/concerns/blacklight/search_helper.rb +0 -161
  394. data/app/controllers/concerns/blacklight/suggest.rb +0 -25
  395. data/app/controllers/saved_searches_controller.rb +0 -4
  396. data/app/controllers/suggest_controller.rb +0 -4
  397. data/app/helpers/blacklight/deprecated_url_helper_behavior.rb +0 -57
  398. data/app/helpers/blacklight/render_partials_helper.rb +0 -205
  399. data/app/helpers/blacklight_configuration_helper.rb +0 -4
  400. data/app/helpers/blacklight_url_helper.rb +0 -4
  401. data/app/helpers/component_helper.rb +0 -4
  402. data/app/helpers/facets_helper.rb +0 -4
  403. data/app/helpers/hash_as_hidden_fields_helper.rb +0 -4
  404. data/app/helpers/layout_helper.rb +0 -4
  405. data/app/helpers/render_constraints_helper.rb +0 -4
  406. data/app/helpers/search_history_constraints_helper.rb +0 -4
  407. data/app/helpers/suggest_helper.rb +0 -4
  408. data/app/models/concerns/blacklight/solr/document/more_like_this.rb +0 -6
  409. data/app/views/_user_util_links.html.erb +0 -26
  410. data/app/views/blacklight/nav/_saved_searches.html.erb +0 -1
  411. data/app/views/catalog/_index_default.html.erb +0 -12
  412. data/app/views/catalog/_show_default.html.erb +0 -10
  413. data/app/views/catalog/_thumbnail_default.html.erb +0 -5
  414. data/app/views/saved_searches/index.html.erb +0 -32
  415. data/app/views/shared/_ajax_modal.html.erb +0 -6
  416. data/lib/generators/blacklight/solr4_generator.rb +0 -31
  417. data/lib/generators/blacklight/templates/config/jetty.yml +0 -13
  418. data/solr/conf/schema.xml +0 -629
  419. data/solr/conf/solrconfig.xml +0 -411
  420. data/spec/controllers/blacklight/search_helper_spec.rb +0 -489
  421. data/spec/controllers/saved_searches_controller_spec.rb +0 -32
  422. data/spec/controllers/suggest_controller_spec.rb +0 -17
  423. data/spec/features/saved_searches_spec.rb +0 -47
  424. data/spec/helpers/deprecated_url_helper_behavior_spec.rb +0 -101
  425. data/spec/lib/blacklight/utils_spec.rb +0 -167
  426. data/spec/models/blacklight/solr/document/more_like_this_spec.rb +0 -18
  427. data/spec/presenters/document_presenter_spec.rb +0 -438
  428. data/spec/support/backport_test.rb +0 -14
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require "spec_helper"
3
3
 
4
- describe Blacklight::Solr::Response::GroupResponse do
5
-
4
+ RSpec.describe Blacklight::Solr::Response::GroupResponse, api: true do
6
5
  let(:response) do
7
6
  create_response(sample_response)
8
7
  end
@@ -12,7 +11,7 @@ describe Blacklight::Solr::Response::GroupResponse do
12
11
  end
13
12
 
14
13
  describe "groups" do
15
- it "should return an array of Groups" do
14
+ it "returns an array of Groups" do
16
15
  expect(response.grouped).to be_a Array
17
16
 
18
17
  expect(group.groups).to have(2).items
@@ -20,8 +19,7 @@ describe Blacklight::Solr::Response::GroupResponse do
20
19
  expect(group).to be_a Blacklight::Solr::Response::Group
21
20
  end
22
21
  end
23
- it "should include a list of SolrDocuments" do
24
-
22
+ it "includes a list of SolrDocuments" do
25
23
  group.groups.each do |group|
26
24
  group.docs.each do |doc|
27
25
  expect(doc).to be_a SolrDocument
@@ -29,9 +27,9 @@ describe Blacklight::Solr::Response::GroupResponse do
29
27
  end
30
28
  end
31
29
  end
32
-
30
+
33
31
  describe "total" do
34
- it "should return the ngroups value" do
32
+ it "returns the ngroups value" do
35
33
  expect(group.total).to eq 3
36
34
  end
37
35
  end
@@ -41,30 +39,43 @@ describe Blacklight::Solr::Response::GroupResponse do
41
39
  expect(group).to respond_to :aggregations
42
40
  end
43
41
  end
44
-
42
+
45
43
  describe "rows" do
46
- it "should get the rows from the response" do
44
+ it "gets the rows from the response" do
47
45
  expect(group.rows).to eq 3
48
46
  end
49
47
  end
50
48
 
51
49
  describe "group_field" do
52
- it "should be the field name for the current group" do
50
+ it "is the field name for the current group" do
53
51
  expect(group.group_field).to eq "result_group_ssi"
54
52
  end
55
53
  end
56
54
 
57
55
  describe "group_limit" do
58
- it "should be the number of documents to return for a group" do
56
+ it "is the number of documents to return for a group" do
59
57
  expect(group.group_limit).to eq 5
60
58
  end
61
59
  end
62
-
60
+
63
61
  describe "empty?" do
64
62
  it "uses the total from this object" do
65
63
  expect(group.empty?).to be false
66
64
  end
67
65
  end
66
+
67
+ describe "entry_name" do
68
+ it "accesses a custom field grouped i18n key" do
69
+ allow(I18n).to receive(:t).with(
70
+ 'blacklight.entry_name.grouped.result_group_ssi',
71
+ default: :'blacklight.entry_name.grouped.default'
72
+ ).and_return('cool group')
73
+ expect(group.entry_name(count: 2)).to eq 'cool groups'
74
+ end
75
+ it "falls back to default group key" do
76
+ expect(group.entry_name(count: 2)).to eq 'grouped results'
77
+ end
78
+ end
68
79
  end
69
80
 
70
81
  def create_response(response, params = {})
@@ -72,14 +83,10 @@ def create_response(response, params = {})
72
83
  end
73
84
 
74
85
  def sample_response
75
- {"responseHeader" => {"params" =>{"rows" => 3, "group.limit" => 5}},
76
- "grouped" =>
77
- {'result_group_ssi' =>
78
- {'groups' => [{'groupValue'=>"Group 1", 'doclist'=>{'numFound'=>2, 'docs'=>[{:id=>1}]}},
79
- {'groupValue'=>"Group 2", 'doclist'=>{'numFound'=>3, 'docs'=>[{:id=>2}, :id=>3]}}
80
- ],
81
- 'ngroups' => "3"
82
- }
83
- }
84
- }
86
+ { "responseHeader" => { "params" => { "rows" => 3, "group.limit" => 5 } },
87
+ "grouped" =>
88
+ { 'result_group_ssi' =>
89
+ { 'groups' => [{ 'groupValue' => "Group 1", 'doclist' => { 'numFound' => 2, 'docs' => [{ id: 1 }] } },
90
+ { 'groupValue' => "Group 2", 'doclist' => { 'numFound' => 3, 'docs' => [{ id: 2 }, id: 3] } }],
91
+ 'ngroups' => "3" } } }
85
92
  end
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
  require "spec_helper"
3
3
 
4
- describe Blacklight::Solr::Response::Group do
5
-
4
+ RSpec.describe Blacklight::Solr::Response::Group, api: true do
5
+ subject do
6
+ group.groups.first
7
+ end
8
+
6
9
  let(:response) do
7
10
  create_response(sample_response)
8
11
  end
@@ -11,46 +14,40 @@ describe Blacklight::Solr::Response::Group do
11
14
  response.grouped.find { |x| x.key == "result_group_ssi" }
12
15
  end
13
16
 
14
- subject do
15
- group.groups.first
16
- end
17
-
18
17
  describe "#doclist" do
19
- it "should be the raw list of documents from solr" do
18
+ it "is the raw list of documents from solr" do
20
19
  expect(subject.doclist).to be_a Hash
21
20
  expect(subject.doclist['docs'].first[:id]).to eq 1
22
21
  end
23
22
  end
24
23
 
25
24
  describe "#total" do
26
- it "should be the number of results found in a group" do
25
+ it "is the number of results found in a group" do
27
26
  expect(subject.total).to eq 2
28
27
  end
29
28
  end
30
29
 
31
30
  describe "#start" do
32
- it "should be the offset for the results in the group" do
31
+ it "is the offset for the results in the group" do
33
32
  expect(subject.start).to eq 0
34
33
  end
35
34
  end
36
35
 
37
36
  describe "#docs" do
38
- it "should be a list of SolrDocuments" do
37
+ it "is a list of SolrDocuments" do
39
38
  subject.docs.each do |doc|
40
39
  expect(doc).to be_a_kind_of SolrDocument
41
40
  end
42
-
41
+
43
42
  expect(subject.docs.first.id).to eq 1
44
43
  end
45
44
  end
46
45
 
47
46
  describe "#field" do
48
- it "should be the field the group belongs to" do
47
+ it "is the field the group belongs to" do
49
48
  expect(subject.field).to eq "result_group_ssi"
50
49
  end
51
50
  end
52
-
53
-
54
51
  end
55
52
 
56
53
  def create_response(response, params = {})
@@ -58,14 +55,10 @@ def create_response(response, params = {})
58
55
  end
59
56
 
60
57
  def sample_response
61
- {"responseHeader" => {"params" =>{"rows" => 3, "group.limit" => 5}},
62
- "grouped" =>
63
- {'result_group_ssi' =>
64
- {'groups' => [{'groupValue'=>"Group 1", 'doclist'=>{'numFound'=>2, 'start' => 0, 'docs'=>[{:id=>1}, {:id => 'x'}]}},
65
- {'groupValue'=>"Group 2", 'doclist'=>{'numFound'=>3, 'docs'=>[{:id=>2}, :id=>3]}}
66
- ],
67
- 'ngroups' => "3"
68
- }
69
- }
70
- }
71
- end
58
+ { "responseHeader" => { "params" => { "rows" => 3, "group.limit" => 5 } },
59
+ "grouped" =>
60
+ { 'result_group_ssi' =>
61
+ { 'groups' => [{ 'groupValue' => "Group 1", 'doclist' => { 'numFound' => 2, 'start' => 0, 'docs' => [{ id: 1 }, { id: 'x' }] } },
62
+ { 'groupValue' => "Group 2", 'doclist' => { 'numFound' => 3, 'docs' => [{ id: 2 }, id: 3] } }],
63
+ 'ngroups' => "3" } } }
64
+ end
@@ -1,37 +1,40 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- RSpec.describe Blacklight::Solr::Response do
3
+ RSpec.describe Blacklight::Solr::Response, api: true do
4
4
  let(:raw_response) { eval(mock_query_response) }
5
5
 
6
+ let(:config) { Blacklight::Configuration.new }
7
+
6
8
  let(:r) do
7
- Blacklight::Solr::Response.new(raw_response,
8
- raw_response['params'])
9
+ described_class.new(raw_response,
10
+ raw_response['params'],
11
+ blacklight_config: config)
9
12
  end
10
13
 
11
- it 'should create a valid response' do
14
+ it 'creates a valid response' do
12
15
  expect(r).to respond_to(:header)
13
16
  end
14
17
 
15
- it 'should have accurate pagination numbers' do
18
+ it 'has accurate pagination numbers' do
16
19
  expect(r.rows).to eq 11
17
20
  expect(r.total).to eq 26
18
21
  expect(r.start).to eq 0
19
22
  end
20
23
 
21
- it 'should create a valid response class' do
24
+ it 'creates a valid response class' do
22
25
  expect(r).to respond_to(:response)
23
26
  expect(r.docs).to have(11).docs
24
27
  expect(r.params[:echoParams]).to eq 'EXPLICIT'
25
-
28
+
26
29
  expect(r).to be_a(Blacklight::Solr::Response::Facets)
27
30
  end
28
31
 
29
- it 'should provide facet helpers' do
32
+ it 'provides facet helpers' do
30
33
  expect(r.aggregations.size).to eq 2
31
34
 
32
- field_names = r.aggregations.collect{|key, facet|facet.name}
35
+ field_names = r.aggregations.collect { |_key, facet| facet.name }
33
36
  expect(field_names.include?('cat')).to be true
34
- expect(field_names.include?('manu')).to be true
37
+ expect(field_names.include?('manu')).to be true
35
38
 
36
39
  first_facet = r.aggregations['cat']
37
40
  expect(first_facet.name).to eq 'cat'
@@ -45,7 +48,7 @@ RSpec.describe Blacklight::Solr::Response do
45
48
 
46
49
  expect(received).to eq expected
47
50
 
48
- r.aggregations.each do |key, facet|
51
+ r.aggregations.each do |_key, facet|
49
52
  expect(facet).to respond_to :name
50
53
  expect(facet).to respond_to :sort
51
54
  expect(facet).to respond_to :offset
@@ -57,12 +60,15 @@ RSpec.describe Blacklight::Solr::Response do
57
60
  end
58
61
  end
59
62
 
60
- it "should provide kaminari pagination helpers" do
63
+ it "provides kaminari pagination helpers" do
61
64
  expect(r.limit_value).to eq(r.rows)
62
65
  expect(r.offset_value).to eq(r.start)
63
66
  expect(r.total_count).to eq(r.total)
64
67
  expect(r.next_page).to eq(r.current_page + 1)
65
68
  expect(r.prev_page).to eq(nil)
69
+ expect(r.entry_name(count: 1)).to eq 'entry'
70
+ expect(r.entry_name(count: 2)).to eq 'entries'
71
+ expect(r.size).to eq 26
66
72
  if Kaminari.config.respond_to? :max_pages
67
73
  expect(r.max_pages).to be_nil
68
74
  end
@@ -70,177 +76,175 @@ RSpec.describe Blacklight::Solr::Response do
70
76
  end
71
77
 
72
78
  describe "FacetItem" do
73
- it "should work with a field,value tuple" do
79
+ it "works with a field,value tuple" do
74
80
  item = Blacklight::Solr::Response::Facets::FacetItem.new('value', 15)
75
81
  expect(item.value).to eq 'value'
76
82
  expect(item.hits).to eq 15
77
83
  end
78
84
 
79
- it "should work with a field,value + hash triple" do
80
- item = Blacklight::Solr::Response::Facets::FacetItem.new('value', 15, :a => 1, :value => 'ignored')
85
+ it "works with a field,value + hash triple" do
86
+ item = Blacklight::Solr::Response::Facets::FacetItem.new('value', 15, a: 1, value: 'ignored')
81
87
  expect(item.value).to eq 'value'
82
88
  expect(item.hits).to eq 15
83
89
  expect(item.a).to eq 1
84
90
  end
85
91
 
86
- it "should work like an openstruct" do
87
- item = Blacklight::Solr::Response::Facets::FacetItem.new(:value => 'value', :hits => 15)
88
-
92
+ it "works like an openstruct" do
93
+ item = Blacklight::Solr::Response::Facets::FacetItem.new(value: 'value', hits: 15)
94
+
89
95
  expect(item.hits).to eq 15
90
96
  expect(item.value).to eq 'value'
91
97
  expect(item).to be_a_kind_of(OpenStruct)
92
98
  end
93
99
 
94
- it "should provide a label accessor" do
95
- item = Blacklight::Solr::Response::Facets::FacetItem.new('value', :hits => 15)
100
+ it "provides a label accessor" do
101
+ item = Blacklight::Solr::Response::Facets::FacetItem.new('value', hits: 15)
96
102
  expect(item.label).to eq 'value'
97
103
  end
98
104
 
99
- it "should use a provided label" do
100
- item = Blacklight::Solr::Response::Facets::FacetItem.new('value', 15, :label => 'custom label')
105
+ it "uses a provided label" do
106
+ item = Blacklight::Solr::Response::Facets::FacetItem.new('value', 15, label: 'custom label')
101
107
  expect(item.label).to eq 'custom label'
102
-
103
108
  end
104
-
105
109
  end
106
110
 
107
- it 'should return the correct value when calling facet_by_field_name' do
111
+ it 'returns the correct value when calling facet_by_field_name' do
108
112
  facet = r.aggregations['cat']
109
113
  expect(facet.name).to eq 'cat'
110
114
  end
111
115
 
112
- it 'should provide the responseHeader params' do
116
+ it 'provides the responseHeader params' do
113
117
  raw_response = eval(mock_query_response)
114
118
  raw_response['responseHeader']['params']['test'] = :test
115
- r = Blacklight::Solr::Response.new(raw_response, raw_response['params'])
119
+ r = described_class.new(raw_response, raw_response['params'])
116
120
  expect(r.params['test']).to eq :test
117
121
  end
118
122
 
119
- it 'should provide the solr-returned params and "rows" should be 11' do
123
+ it 'provides the solr-returned params and "rows" should be 11' do
120
124
  raw_response = eval(mock_query_response)
121
- r = Blacklight::Solr::Response.new(raw_response, {})
125
+ r = described_class.new(raw_response, {})
122
126
  expect(r.params[:rows].to_s).to eq '11'
123
- expect(r.params[:sort]).to eq 'title_sort asc, pub_date_sort desc'
127
+ expect(r.params[:sort]).to eq 'title_si asc, pub_date_si desc'
124
128
  end
125
129
 
126
- it 'should provide the ruby request params if responseHeader["params"] does not exist' do
130
+ it 'provides the ruby request params if responseHeader["params"] does not exist' do
127
131
  raw_response = eval(mock_query_response)
128
132
  raw_response.delete 'responseHeader'
129
- r = Blacklight::Solr::Response.new(raw_response, :rows => 999, :sort => 'score desc, pub_date_sort desc, title_sort asc')
133
+ r = described_class.new(raw_response, rows: 999, sort: 'score desc, pub_date_si desc, title_si asc')
130
134
  expect(r.params[:rows].to_s).to eq '999'
131
- expect(r.params[:sort]).to eq 'score desc, pub_date_sort desc, title_sort asc'
135
+ expect(r.params[:sort]).to eq 'score desc, pub_date_si desc, title_si asc'
132
136
  end
133
137
 
134
- it 'should provide spelling suggestions for regular spellcheck results' do
138
+ it 'provides spelling suggestions for regular spellcheck results' do
135
139
  raw_response = eval(mock_response_with_spellcheck)
136
- r = Blacklight::Solr::Response.new(raw_response, {})
140
+ r = described_class.new(raw_response, {})
137
141
  expect(r.spelling.words).to include("dell")
138
142
  expect(r.spelling.words).to include("ultrasharp")
139
143
  end
140
144
 
141
- it 'should provide spelling suggestions for extended spellcheck results' do
145
+ it 'provides spelling suggestions for extended spellcheck results' do
142
146
  raw_response = eval(mock_response_with_spellcheck_extended)
143
- r = Blacklight::Solr::Response.new(raw_response, {})
147
+ r = described_class.new(raw_response, {})
144
148
  expect(r.spelling.words).to include("dell")
145
149
  expect(r.spelling.words).to include("ultrasharp")
146
150
  end
147
151
 
148
- it 'should provide no spelling suggestions when extended results and suggestion frequency is the same as original query frequency' do
152
+ it 'provides no spelling suggestions when extended results and suggestion frequency is the same as original query frequency' do
149
153
  raw_response = eval(mock_response_with_spellcheck_same_frequency)
150
- r = Blacklight::Solr::Response.new(raw_response, {})
154
+ r = described_class.new(raw_response, {})
151
155
  expect(r.spelling.words).to eq []
152
156
  end
153
157
 
154
158
  context "pre solr 5 spellcheck collation syntax" do
155
- it 'should provide spelling suggestions for a regular spellcheck results with a collation' do
159
+ it 'provides spelling suggestions for a regular spellcheck results with a collation' do
156
160
  raw_response = eval(mock_response_with_spellcheck_collation)
157
- r = Blacklight::Solr::Response.new(raw_response, {})
161
+ r = described_class.new(raw_response, {})
158
162
  expect(r.spelling.words).to include("dell")
159
163
  expect(r.spelling.words).to include("ultrasharp")
160
164
  end
161
165
 
162
- it 'should provide spelling suggestion collation' do
166
+ it 'provides spelling suggestion collation' do
163
167
  raw_response = eval(mock_response_with_spellcheck_collation)
164
- r = Blacklight::Solr::Response.new(raw_response, {})
168
+ r = described_class.new(raw_response, {})
165
169
  expect(r.spelling.collation).to eq 'dell ultrasharp'
166
170
  end
167
171
  end
168
172
 
169
173
  context "solr 5 spellcheck collation syntax" do
170
- it 'should provide spelling suggestions for a regular spellcheck results with a collation' do
174
+ it 'provides spelling suggestions for a regular spellcheck results with a collation' do
171
175
  raw_response = eval(mock_response_with_spellcheck_collation_solr5)
172
- r = Blacklight::Solr::Response.new(raw_response, {})
176
+ r = described_class.new(raw_response, {})
173
177
  expect(r.spelling.words).to include("dell")
174
178
  expect(r.spelling.words).to include("ultrasharp")
175
179
  end
176
180
 
177
- it 'should provide spelling suggestion collation' do
181
+ it 'provides spelling suggestion collation' do
178
182
  raw_response = eval(mock_response_with_spellcheck_collation_solr5)
179
- r = Blacklight::Solr::Response.new(raw_response, {})
183
+ r = described_class.new(raw_response, {})
180
184
  expect(r.spelling.collation).to eq 'dell ultrasharp'
181
185
  end
182
186
  end
183
187
 
184
188
  context 'solr 6.5 spellcheck collation syntax' do
185
- it 'should provide spelling suggestions for a regular spellcheck results with a collation' do
189
+ it 'provides spelling suggestions for a regular spellcheck results with a collation' do
186
190
  raw_response = eval(mock_response_with_spellcheck_collation_solr65)
187
- r = Blacklight::Solr::Response.new(raw_response, {})
191
+ r = described_class.new(raw_response, {})
188
192
  expect(r.spelling.words).to include("dell")
189
193
  expect(r.spelling.words).to include("ultrasharp")
190
194
  end
191
195
  end
192
196
 
193
- it "should provide MoreLikeThis suggestions" do
197
+ it "provides MoreLikeThis suggestions" do
194
198
  raw_response = eval(mock_response_with_more_like_this)
195
- r = Blacklight::Solr::Response.new(raw_response, {})
196
- expect(r.more_like(double(:id => '79930185'))).to have(2).items
199
+ r = described_class.new(raw_response, {})
200
+ expect(r.more_like(double(id: '79930185'))).to have(2).items
197
201
  end
198
202
 
199
- it "should be empty when the response has no results" do
200
- r = Blacklight::Solr::Response.new({}, {})
201
- allow(r).to receive_messages(:total => 0)
203
+ it "is empty when the response has no results" do
204
+ r = described_class.new({}, {})
205
+ allow(r).to receive_messages(total: 0)
202
206
  expect(r).to be_empty
203
207
  end
204
-
208
+
205
209
  describe "#export_formats" do
206
- it "should collect the unique export formats for the current response" do
207
- r = Blacklight::Solr::Response.new({}, {})
208
- allow(r).to receive_messages(documents: [double(:export_formats => { a: 1, b: 2}), double(:export_formats => { b: 1, c: 2})])
209
- expect(r.export_formats).to include :a, :b
210
+ it "collects the unique export formats for the current response" do
211
+ r = described_class.new({}, {})
212
+ allow(r).to receive_messages(documents: [double(export_formats: { a: 1, b: 2 }), double(export_formats: { b: 1, c: 2 })])
213
+ expect(r.export_formats).to include :a, :b
210
214
  end
211
215
  end
212
216
 
213
217
  def mock_query_response
214
- %({'responseHeader'=>{'status'=>0,'QTime'=>5,'params'=>{'facet.limit'=>'10','wt'=>'ruby','rows'=>'11','facet'=>'true','facet.field'=>['cat','manu'],'echoParams'=>'EXPLICIT','q'=>'*:*','facet.sort'=>'true', 'sort'=>'title_sort asc, pub_date_sort desc'}},'response'=>{'numFound'=>26,'start'=>0,'docs'=>[{'id'=>'SP2514N','inStock'=>true,'manu'=>'Samsung Electronics Co. Ltd.','name'=>'Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133','popularity'=>6,'price'=>92.0,'sku'=>'SP2514N','timestamp'=>'2009-03-20T14:42:49.795Z','cat'=>['electronics','hard drive'],'spell'=>['Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133'],'features'=>['7200RPM, 8MB cache, IDE Ultra ATA-133','NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor']},{'id'=>'6H500F0','inStock'=>true,'manu'=>'Maxtor Corp.','name'=>'Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300','popularity'=>6,'price'=>350.0,'sku'=>'6H500F0','timestamp'=>'2009-03-20T14:42:49.877Z','cat'=>['electronics','hard drive'],'spell'=>['Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300'],'features'=>['SATA 3.0Gb/s, NCQ','8.5ms seek','16MB cache']},{'id'=>'F8V7067-APL-KIT','inStock'=>false,'manu'=>'Belkin','name'=>'Belkin Mobile Power Cord for iPod w/ Dock','popularity'=>1,'price'=>19.95,'sku'=>'F8V7067-APL-KIT','timestamp'=>'2009-03-20T14:42:49.937Z','weight'=>4.0,'cat'=>['electronics','connector'],'spell'=>['Belkin Mobile Power Cord for iPod w/ Dock'],'features'=>['car power adapter, white']},{'id'=>'IW-02','inStock'=>false,'manu'=>'Belkin','name'=>'iPod & iPod Mini USB 2.0 Cable','popularity'=>1,'price'=>11.5,'sku'=>'IW-02','timestamp'=>'2009-03-20T14:42:49.944Z','weight'=>2.0,'cat'=>['electronics','connector'],'spell'=>['iPod & iPod Mini USB 2.0 Cable'],'features'=>['car power adapter for iPod, white']},{'id'=>'MA147LL/A','inStock'=>true,'includes'=>'earbud headphones, USB cable','manu'=>'Apple Computer Inc.','name'=>'Apple 60 GB iPod with Video Playback Black','popularity'=>10,'price'=>399.0,'sku'=>'MA147LL/A','timestamp'=>'2009-03-20T14:42:49.962Z','weight'=>5.5,'cat'=>['electronics','music'],'spell'=>['Apple 60 GB iPod with Video Playback Black'],'features'=>['iTunes, Podcasts, Audiobooks','Stores up to 15,000 songs, 25,000 photos, or 150 hours of video','2.5-inch, 320x240 color TFT LCD display with LED backlight','Up to 20 hours of battery life','Plays AAC, MP3, WAV, AIFF, Audible, Apple Lossless, H.264 video','Notes, Calendar, Phone book, Hold button, Date display, Photo wallet, Built-in games, JPEG photo playback, Upgradeable firmware, USB 2.0 compatibility, Playback speed control, Rechargeable capability, Battery level indication']},{'id'=>'TWINX2048-3200PRO','inStock'=>true,'manu'=>'Corsair Microsystems Inc.','name'=>'CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail','popularity'=>5,'price'=>185.0,'sku'=>'TWINX2048-3200PRO','timestamp'=>'2009-03-20T14:42:49.99Z','cat'=>['electronics','memory'],'spell'=>['CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail'],'features'=>['CAS latency 2, 2-3-3-6 timing, 2.75v, unbuffered, heat-spreader']},{'id'=>'VS1GB400C3','inStock'=>true,'manu'=>'Corsair Microsystems Inc.','name'=>'CORSAIR ValueSelect 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - Retail','popularity'=>7,'price'=>74.99,'sku'=>'VS1GB400C3','timestamp'=>'2009-03-20T14:42:50Z','cat'=>['electronics','memory'],'spell'=>['CORSAIR ValueSelect 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - Retail']},{'id'=>'VDBDB1A16','inStock'=>true,'manu'=>'A-DATA Technology Inc.','name'=>'A-DATA V-Series 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - OEM','popularity'=>5,'sku'=>'VDBDB1A16','timestamp'=>'2009-03-20T14:42:50.004Z','cat'=>['electronics','memory'],'spell'=>['A-DATA V-Series 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - OEM'],'features'=>['CAS latency 3, 2.7v']},{'id'=>'3007WFP','inStock'=>true,'includes'=>'USB cable','manu'=>'Dell, Inc.','name'=>'Dell Widescreen UltraSharp 3007WFP','popularity'=>6,'price'=>2199.0,'sku'=>'3007WFP','timestamp'=>'2009-03-20T14:42:50.017Z','weight'=>401.6,'cat'=>['electronics','monitor'],'spell'=>['Dell Widescreen UltraSharp 3007WFP'],'features'=>['30" TFT active matrix LCD, 2560 x 1600, .25mm dot pitch, 700:1 contrast']},{'id'=>'VA902B','inStock'=>true,'manu'=>'ViewSonic Corp.','name'=>'ViewSonic VA902B - flat panel display - TFT - 19"','popularity'=>6,'price'=>279.95,'sku'=>'VA902B','timestamp'=>'2009-03-20T14:42:50.034Z','weight'=>190.4,'cat'=>['electronics','monitor'],'spell'=>['ViewSonic VA902B - flat panel display - TFT - 19"'],'features'=>['19" TFT active matrix LCD, 8ms response time, 1280 x 1024 native resolution']},{'id'=>'0579B002','inStock'=>true,'manu'=>'Canon Inc.','name'=>'Canon PIXMA MP500 All-In-One Photo Printer','popularity'=>6,'price'=>179.99,'sku'=>'0579B002','timestamp'=>'2009-03-20T14:42:50.062Z','weight'=>352.0,'cat'=>['electronics','multifunction printer','printer','scanner','copier'],'spell'=>['Canon PIXMA MP500 All-In-One Photo Printer'],'features'=>['Multifunction ink-jet color photo printer','Flatbed scanner, optical scan resolution of 1,200 x 2,400 dpi','2.5" color LCD preview screen','Duplex Copying','Printing speed up to 29ppm black, 19ppm color','Hi-Speed USB','memory card: CompactFlash, Micro Drive, SmartMedia, Memory Stick, Memory Stick Pro, SD Card, and MultiMediaCard']}]},'facet_counts'=>{'facet_queries'=>{},'facet_fields'=>{'cat'=>['electronics',14,'memory',3,'card',2,'connector',2,'drive',2,'graphics',2,'hard',2,'monitor',2,'search',2,'software',2],'manu'=>['inc',8,'apach',2,'belkin',2,'canon',2,'comput',2,'corp',2,'corsair',2,'foundat',2,'microsystem',2,'softwar',2]},'facet_dates'=>{}}})
218
+ %({'responseHeader'=>{'status'=>0,'QTime'=>5,'params'=>{'facet.limit'=>'10','wt'=>'ruby','rows'=>'11','facet'=>'true','facet.field'=>['cat','manu'],'echoParams'=>'EXPLICIT','q'=>'*:*','facet.sort'=>'true', 'sort'=>'title_si asc, pub_date_si desc'}},'response'=>{'numFound'=>26,'start'=>0,'docs'=>[{'id'=>'SP2514N','inStock'=>true,'manu'=>'Samsung Electronics Co. Ltd.','name'=>'Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133','popularity'=>6,'price'=>92.0,'sku'=>'SP2514N','timestamp'=>'2009-03-20T14:42:49.795Z','cat'=>['electronics','hard drive'],'spell'=>['Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133'],'features'=>['7200RPM, 8MB cache, IDE Ultra ATA-133','NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor']},{'id'=>'6H500F0','inStock'=>true,'manu'=>'Maxtor Corp.','name'=>'Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300','popularity'=>6,'price'=>350.0,'sku'=>'6H500F0','timestamp'=>'2009-03-20T14:42:49.877Z','cat'=>['electronics','hard drive'],'spell'=>['Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300'],'features'=>['SATA 3.0Gb/s, NCQ','8.5ms seek','16MB cache']},{'id'=>'F8V7067-APL-KIT','inStock'=>false,'manu'=>'Belkin','name'=>'Belkin Mobile Power Cord for iPod w/ Dock','popularity'=>1,'price'=>19.95,'sku'=>'F8V7067-APL-KIT','timestamp'=>'2009-03-20T14:42:49.937Z','weight'=>4.0,'cat'=>['electronics','connector'],'spell'=>['Belkin Mobile Power Cord for iPod w/ Dock'],'features'=>['car power adapter, white']},{'id'=>'IW-02','inStock'=>false,'manu'=>'Belkin','name'=>'iPod & iPod Mini USB 2.0 Cable','popularity'=>1,'price'=>11.5,'sku'=>'IW-02','timestamp'=>'2009-03-20T14:42:49.944Z','weight'=>2.0,'cat'=>['electronics','connector'],'spell'=>['iPod & iPod Mini USB 2.0 Cable'],'features'=>['car power adapter for iPod, white']},{'id'=>'MA147LL/A','inStock'=>true,'includes'=>'earbud headphones, USB cable','manu'=>'Apple Computer Inc.','name'=>'Apple 60 GB iPod with Video Playback Black','popularity'=>10,'price'=>399.0,'sku'=>'MA147LL/A','timestamp'=>'2009-03-20T14:42:49.962Z','weight'=>5.5,'cat'=>['electronics','music'],'spell'=>['Apple 60 GB iPod with Video Playback Black'],'features'=>['iTunes, Podcasts, Audiobooks','Stores up to 15,000 songs, 25,000 photos, or 150 hours of video','2.5-inch, 320x240 color TFT LCD display with LED backlight','Up to 20 hours of battery life','Plays AAC, MP3, WAV, AIFF, Audible, Apple Lossless, H.264 video','Notes, Calendar, Phone book, Hold button, Date display, Photo wallet, Built-in games, JPEG photo playback, Upgradeable firmware, USB 2.0 compatibility, Playback speed control, Rechargeable capability, Battery level indication']},{'id'=>'TWINX2048-3200PRO','inStock'=>true,'manu'=>'Corsair Microsystems Inc.','name'=>'CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail','popularity'=>5,'price'=>185.0,'sku'=>'TWINX2048-3200PRO','timestamp'=>'2009-03-20T14:42:49.99Z','cat'=>['electronics','memory'],'spell'=>['CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail'],'features'=>['CAS latency 2, 2-3-3-6 timing, 2.75v, unbuffered, heat-spreader']},{'id'=>'VS1GB400C3','inStock'=>true,'manu'=>'Corsair Microsystems Inc.','name'=>'CORSAIR ValueSelect 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - Retail','popularity'=>7,'price'=>74.99,'sku'=>'VS1GB400C3','timestamp'=>'2009-03-20T14:42:50Z','cat'=>['electronics','memory'],'spell'=>['CORSAIR ValueSelect 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - Retail']},{'id'=>'VDBDB1A16','inStock'=>true,'manu'=>'A-DATA Technology Inc.','name'=>'A-DATA V-Series 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - OEM','popularity'=>5,'sku'=>'VDBDB1A16','timestamp'=>'2009-03-20T14:42:50.004Z','cat'=>['electronics','memory'],'spell'=>['A-DATA V-Series 1GB 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) System Memory - OEM'],'features'=>['CAS latency 3, 2.7v']},{'id'=>'3007WFP','inStock'=>true,'includes'=>'USB cable','manu'=>'Dell, Inc.','name'=>'Dell Widescreen UltraSharp 3007WFP','popularity'=>6,'price'=>2199.0,'sku'=>'3007WFP','timestamp'=>'2009-03-20T14:42:50.017Z','weight'=>401.6,'cat'=>['electronics','monitor'],'spell'=>['Dell Widescreen UltraSharp 3007WFP'],'features'=>['30" TFT active matrix LCD, 2560 x 1600, .25mm dot pitch, 700:1 contrast']},{'id'=>'VA902B','inStock'=>true,'manu'=>'ViewSonic Corp.','name'=>'ViewSonic VA902B - flat panel display - TFT - 19"','popularity'=>6,'price'=>279.95,'sku'=>'VA902B','timestamp'=>'2009-03-20T14:42:50.034Z','weight'=>190.4,'cat'=>['electronics','monitor'],'spell'=>['ViewSonic VA902B - flat panel display - TFT - 19"'],'features'=>['19" TFT active matrix LCD, 8ms response time, 1280 x 1024 native resolution']},{'id'=>'0579B002','inStock'=>true,'manu'=>'Canon Inc.','name'=>'Canon PIXMA MP500 All-In-One Photo Printer','popularity'=>6,'price'=>179.99,'sku'=>'0579B002','timestamp'=>'2009-03-20T14:42:50.062Z','weight'=>352.0,'cat'=>['electronics','multifunction printer','printer','scanner','copier'],'spell'=>['Canon PIXMA MP500 All-In-One Photo Printer'],'features'=>['Multifunction ink-jet color photo printer','Flatbed scanner, optical scan resolution of 1,200 x 2,400 dpi','2.5" color LCD preview screen','Duplex Copying','Printing speed up to 29ppm black, 19ppm color','Hi-Speed USB','memory card: CompactFlash, Micro Drive, SmartMedia, Memory Stick, Memory Stick Pro, SD Card, and MultiMediaCard']}]},'facet_counts'=>{'facet_queries'=>{},'facet_fields'=>{'cat'=>['electronics',14,'memory',3,'card',2,'connector',2,'drive',2,'graphics',2,'hard',2,'monitor',2,'search',2,'software',2],'manu'=>['inc',8,'apach',2,'belkin',2,'canon',2,'comput',2,'corp',2,'corsair',2,'foundat',2,'microsystem',2,'softwar',2]},'facet_dates'=>{}}})
215
219
  end
216
220
 
217
221
  # These spellcheck responses are all Solr 1.4 responses
218
222
  def mock_response_with_spellcheck
219
- %|{'responseHeader'=>{'status'=>0,'QTime'=>9,'params'=>{'spellcheck'=>'true','spellcheck.collate'=>'true','wt'=>'ruby','q'=>'hell ultrashar'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']},'collation','dell ultrasharp']}}|
223
+ %({'responseHeader'=>{'status'=>0,'QTime'=>9,'params'=>{'spellcheck'=>'true','spellcheck.collate'=>'true','wt'=>'ruby','q'=>'hell ultrashar'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']},'collation','dell ultrasharp']}})
220
224
  end
221
225
 
222
226
  def mock_response_with_spellcheck_extended
223
- %|{'responseHeader'=>{'status'=>0,'QTime'=>8,'params'=>{'spellcheck'=>'true','spellcheck.collate'=>'true','wt'=>'ruby','spellcheck.extendedResults'=>'true','q'=>'hell ultrashar'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'origFreq'=>0,'suggestion'=>[{'word'=>'dell','freq'=>1}]},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'origFreq'=>0,'suggestion'=>[{'word'=>'ultrasharp','freq'=>1}]},'correctlySpelled',false,'collation','dell ultrasharp']}}|
227
+ %({'responseHeader'=>{'status'=>0,'QTime'=>8,'params'=>{'spellcheck'=>'true','spellcheck.collate'=>'true','wt'=>'ruby','spellcheck.extendedResults'=>'true','q'=>'hell ultrashar'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'origFreq'=>0,'suggestion'=>[{'word'=>'dell','freq'=>1}]},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'origFreq'=>0,'suggestion'=>[{'word'=>'ultrasharp','freq'=>1}]},'correctlySpelled',false,'collation','dell ultrasharp']}})
224
228
  end
225
229
 
226
230
  def mock_response_with_spellcheck_same_frequency
227
- %|{'responseHeader'=>{'status'=>0,'QTime'=>8,'params'=>{'spellcheck'=>'true','spellcheck.collate'=>'true','wt'=>'ruby','spellcheck.extendedResults'=>'true','q'=>'hell ultrashar'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'origFreq'=>1,'suggestion'=>[{'word'=>'dell','freq'=>1}]},'ultrashard',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'origFreq'=>1,'suggestion'=>[{'word'=>'ultrasharp','freq'=>1}]},'correctlySpelled',false,'collation','dell ultrasharp']}}|
231
+ %({'responseHeader'=>{'status'=>0,'QTime'=>8,'params'=>{'spellcheck'=>'true','spellcheck.collate'=>'true','wt'=>'ruby','spellcheck.extendedResults'=>'true','q'=>'hell ultrashar'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'origFreq'=>1,'suggestion'=>[{'word'=>'dell','freq'=>1}]},'ultrashard',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'origFreq'=>1,'suggestion'=>[{'word'=>'ultrasharp','freq'=>1}]},'correctlySpelled',false,'collation','dell ultrasharp']}})
228
232
  end
229
233
 
230
234
  # it can be the case that extended results are off and collation is on
231
235
  def mock_response_with_spellcheck_collation
232
- %|{'responseHeader'=>{'status'=>0,'QTime'=>3,'params'=>{'spellspellcheck.build'=>'true','spellcheck'=>'true','q'=>'hell','spellcheck.q'=>'hell ultrashar','wt'=>'ruby','spellcheck.collate'=>'true'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']},'collation','dell ultrasharp']}}|
236
+ %({'responseHeader'=>{'status'=>0,'QTime'=>3,'params'=>{'spellspellcheck.build'=>'true','spellcheck'=>'true','q'=>'hell','spellcheck.q'=>'hell ultrashar','wt'=>'ruby','spellcheck.collate'=>'true'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']},'collation','dell ultrasharp']}})
233
237
  end
234
238
 
235
239
  def mock_response_with_spellcheck_collation_solr5
236
- %|{'responseHeader'=>{'status'=>0,'QTime'=>3,'params'=>{'spellspellcheck.build'=>'true','spellcheck'=>'true','q'=>'hell','spellcheck.q'=>'hell ultrashar','wt'=>'ruby','spellcheck.collate'=>'true'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']}],'collations'=>['collation','dell ultrasharp']}}|
240
+ %({'responseHeader'=>{'status'=>0,'QTime'=>3,'params'=>{'spellspellcheck.build'=>'true','spellcheck'=>'true','q'=>'hell','spellcheck.q'=>'hell ultrashar','wt'=>'ruby','spellcheck.collate'=>'true'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>['hell',{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar',{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']}],'collations'=>['collation','dell ultrasharp']}})
237
241
  end
238
242
 
239
243
  def mock_response_with_spellcheck_collation_solr65
240
- %|{'responseHeader'=>{'status'=>0,'QTime'=>3,'params'=>{'spellspellcheck.build'=>'true','spellcheck'=>'true','q'=>'hell','spellcheck.q'=>'hell ultrashar','wt'=>'ruby','spellcheck.collate'=>'true'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>{'hell'=>{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar'=>{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']}},'collations'=>['collation','dell ultrasharp']}}|
244
+ %({'responseHeader'=>{'status'=>0,'QTime'=>3,'params'=>{'spellspellcheck.build'=>'true','spellcheck'=>'true','q'=>'hell','spellcheck.q'=>'hell ultrashar','wt'=>'ruby','spellcheck.collate'=>'true'}},'response'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'spellcheck'=>{'suggestions'=>{'hell'=>{'numFound'=>1,'startOffset'=>0,'endOffset'=>4,'suggestion'=>['dell']},'ultrashar'=>{'numFound'=>1,'startOffset'=>5,'endOffset'=>14,'suggestion'=>['ultrasharp']}},'collations'=>['collation','dell ultrasharp']}})
241
245
  end
242
246
 
243
247
  def mock_response_with_more_like_this
244
- %({'responseHeader'=>{'status'=>0,'QTime'=>8,'params'=>{'facet'=>'false','mlt.mindf'=>'1','mlt.fl'=>'subject_t','fl'=>'id','mlt.count'=>'3','mlt.mintf'=>'0','mlt'=>'true','q.alt'=>'*:*','qt'=>'search','wt'=>'ruby'}},'response'=>{'numFound'=>30,'start'=>0,'docs'=>[{'id'=>'00282214'},{'id'=>'00282371'},{'id'=>'00313831'},{'id'=>'00314247'},{'id'=>'43037890'},{'id'=>'53029833'},{'id'=>'77826928'},{'id'=>'78908283'},{'id'=>'79930185'},{'id'=>'85910001'}]},'moreLikeThis'=>{'00282214'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'00282371'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'00313831'=>{'numFound'=>1,'start'=>0,'docs'=>[{'id'=>'96933325'}]},'00314247'=>{'numFound'=>3,'start'=>0,'docs'=>[{'id'=>'2008543486'},{'id'=>'96933325'},{'id'=>'2009373513'}]},'43037890'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'53029833'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'77826928'=>{'numFound'=>1,'start'=>0,'docs'=>[{'id'=>'94120425'}]},'78908283'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'79930185'=>{'numFound'=>2,'start'=>0,'docs'=>[{'id'=>'94120425'},{'id'=>'2007020969'}]},'85910001'=>{'numFound'=>0,'start'=>0,'docs'=>[]}}})
248
+ %({'responseHeader'=>{'status'=>0,'QTime'=>8,'params'=>{'facet'=>'false','mlt.mindf'=>'1','mlt.fl'=>'subject_tsim','fl'=>'id','mlt.count'=>'3','mlt.mintf'=>'0','mlt'=>'true','q.alt'=>'*:*','qt'=>'search','wt'=>'ruby'}},'response'=>{'numFound'=>30,'start'=>0,'docs'=>[{'id'=>'00282214'},{'id'=>'00282371'},{'id'=>'00313831'},{'id'=>'00314247'},{'id'=>'43037890'},{'id'=>'53029833'},{'id'=>'77826928'},{'id'=>'78908283'},{'id'=>'79930185'},{'id'=>'85910001'}]},'moreLikeThis'=>{'00282214'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'00282371'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'00313831'=>{'numFound'=>1,'start'=>0,'docs'=>[{'id'=>'96933325'}]},'00314247'=>{'numFound'=>3,'start'=>0,'docs'=>[{'id'=>'2008543486'},{'id'=>'96933325'},{'id'=>'2009373513'}]},'43037890'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'53029833'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'77826928'=>{'numFound'=>1,'start'=>0,'docs'=>[{'id'=>'94120425'}]},'78908283'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'79930185'=>{'numFound'=>2,'start'=>0,'docs'=>[{'id'=>'94120425'},{'id'=>'2007020969'}]},'85910001'=>{'numFound'=>0,'start'=>0,'docs'=>[]}}})
245
249
  end
246
250
  end