blacklight 6.21.0 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.npmignore +23 -0
- data/.rubocop.yml +40 -16
- data/.rubocop_todo.yml +479 -375
- data/.solr_wrapper.yml +9 -2
- data/.travis.yml +23 -27
- data/Gemfile +3 -4
- data/README.md +22 -5
- data/Rakefile +3 -2
- data/VERSION +1 -1
- data/Vagrantfile +2 -0
- data/app/assets/images/blacklight/list.svg +1 -0
- data/app/assets/images/blacklight/search.svg +1 -0
- data/app/assets/javascripts/blacklight/blacklight.js +497 -57
- data/app/assets/stylesheets/blacklight/_balanced_list.scss +7 -12
- data/app/assets/stylesheets/blacklight/_blacklight_base.scss +18 -15
- data/app/assets/stylesheets/blacklight/_bookmark.scss +1 -13
- data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +27 -0
- data/app/assets/stylesheets/blacklight/_constraints.scss +17 -25
- data/app/assets/stylesheets/blacklight/_controls.scss +8 -16
- data/app/assets/stylesheets/blacklight/_facets.scss +64 -93
- data/app/assets/stylesheets/blacklight/_header.scss +35 -48
- data/app/assets/stylesheets/blacklight/_icons.scss +35 -0
- data/app/assets/stylesheets/blacklight/_layout.scss +0 -10
- data/app/assets/stylesheets/blacklight/_mixins.scss +15 -0
- data/app/assets/stylesheets/blacklight/_modal.scss +9 -17
- data/app/assets/stylesheets/blacklight/_pagination.scss +2 -17
- data/app/assets/stylesheets/blacklight/_search_form.scss +7 -0
- data/app/assets/stylesheets/blacklight/_search_history.scss +5 -13
- data/app/assets/stylesheets/blacklight/_search_results.scss +9 -8
- data/app/assets/stylesheets/blacklight/_twitter_typeahead.scss +1 -2
- data/app/assets/stylesheets/blacklight/blacklight.scss +1 -1
- data/app/builders/blacklight/action_builder.rb +57 -0
- data/app/controllers/bookmarks_controller.rb +2 -2
- data/app/controllers/catalog_controller.rb +2 -2
- data/app/controllers/concerns/blacklight/base.rb +0 -33
- data/app/controllers/concerns/blacklight/bookmarks.rb +19 -30
- data/app/controllers/concerns/blacklight/catalog.rb +263 -210
- data/app/controllers/concerns/blacklight/controller.rb +102 -124
- data/app/controllers/concerns/blacklight/default_component_configuration.rb +12 -43
- data/app/controllers/concerns/blacklight/facet.rb +3 -0
- data/app/controllers/concerns/blacklight/search_context.rb +11 -11
- data/app/controllers/concerns/blacklight/search_fields.rb +4 -14
- data/app/controllers/concerns/blacklight/search_history.rb +1 -6
- data/app/controllers/concerns/blacklight/token_based_user.rb +5 -7
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +36 -118
- data/app/helpers/blacklight/catalog_helper_behavior.rb +94 -88
- data/app/helpers/blacklight/component_helper_behavior.rb +19 -19
- data/app/helpers/blacklight/configuration_helper_behavior.rb +30 -57
- data/app/helpers/blacklight/facets_helper_behavior.rb +55 -51
- data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +9 -11
- data/app/helpers/blacklight/icon_helper_behavior.rb +18 -0
- data/app/helpers/blacklight/layout_helper_behavior.rb +3 -10
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +8 -6
- data/app/helpers/blacklight/render_partials_helper_behavior.rb +195 -0
- data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +19 -11
- data/app/helpers/blacklight/suggest_helper_behavior.rb +1 -0
- data/app/helpers/blacklight/url_helper_behavior.rb +50 -41
- data/app/{assets/javascripts → javascript}/blacklight/autocomplete.js +3 -2
- data/app/javascript/blacklight/bookmark_toggle.js +25 -0
- data/app/{assets/javascripts → javascript}/blacklight/checkbox_submit.js +66 -71
- data/app/{assets/javascripts → javascript}/blacklight/collapsable.js +1 -1
- data/app/javascript/blacklight/core.js +41 -0
- data/app/{assets/javascripts → javascript}/blacklight/facet_load.js +6 -6
- data/app/{assets/javascripts/blacklight/ajax_modal.js → javascript/blacklight/modal.js} +62 -64
- data/app/{assets/javascripts → javascript}/blacklight/search_context.js +10 -3
- data/app/models/blacklight/facet_paginator.rb +3 -3
- data/app/models/blacklight/icon.rb +56 -0
- data/app/models/blacklight/solr/facet_paginator.rb +3 -3
- data/app/models/blacklight/suggest_search.rb +1 -1
- data/app/models/bookmark.rb +5 -10
- data/app/models/concerns/blacklight/configurable.rb +13 -13
- data/app/models/concerns/blacklight/document.rb +23 -39
- data/app/models/concerns/blacklight/document/active_model_shim.rb +8 -11
- data/app/models/concerns/blacklight/document/cache_key.rb +1 -1
- data/app/models/concerns/blacklight/document/dublin_core.rb +2 -2
- data/app/models/concerns/blacklight/document/email.rb +1 -1
- data/app/models/concerns/blacklight/document/extensions.rb +5 -5
- data/app/models/concerns/blacklight/document/semantic_fields.rb +9 -9
- data/app/models/concerns/blacklight/document/sms.rb +1 -1
- data/app/models/concerns/blacklight/solr/document.rb +8 -8
- data/app/models/concerns/blacklight/user.rb +7 -6
- data/app/models/record_mailer.rb +5 -6
- data/app/models/search.rb +5 -7
- data/app/presenters/blacklight/document_presenter.rb +25 -140
- data/app/presenters/blacklight/field_presenter.rb +7 -5
- data/app/presenters/blacklight/index_presenter.rb +41 -70
- data/app/presenters/blacklight/json_presenter.rb +10 -14
- data/app/presenters/blacklight/link_alternate_presenter.rb +3 -1
- data/app/presenters/blacklight/rendering/abstract_step.rb +7 -5
- data/app/presenters/blacklight/rendering/helper_method.rb +10 -8
- data/app/presenters/blacklight/rendering/join.rb +5 -3
- data/app/presenters/blacklight/rendering/link_to_facet.rb +23 -19
- data/app/presenters/blacklight/rendering/microdata.rb +6 -3
- data/app/presenters/blacklight/rendering/pipeline.rb +7 -5
- data/app/presenters/blacklight/rendering/terminator.rb +2 -0
- data/app/presenters/blacklight/search_bar_presenter.rb +39 -0
- data/app/presenters/blacklight/show_presenter.rb +26 -72
- data/app/presenters/blacklight/thumbnail_presenter.rb +74 -0
- data/app/services/blacklight/document_factory.rb +13 -0
- data/app/services/blacklight/field_retriever.rb +26 -24
- data/app/services/blacklight/search_service.rb +152 -0
- data/app/values/blacklight/types.rb +31 -0
- data/app/views/blacklight/nav/_bookmark.html.erb +2 -2
- data/app/views/blacklight/nav/_search_history.html.erb +1 -1
- data/app/views/bookmarks/_tools.html.erb +2 -2
- data/app/views/bookmarks/index.html.erb +12 -13
- data/app/views/catalog/_bookmark_control.html.erb +26 -10
- data/app/views/catalog/_citation.html.erb +18 -23
- data/app/views/catalog/_constraints.html.erb +6 -7
- data/app/views/catalog/_constraints_element.html.erb +6 -6
- data/app/views/catalog/_did_you_mean.html.erb +1 -1
- data/app/views/catalog/{_document_default.atom.builder → _document.atom.builder} +19 -18
- data/app/views/catalog/_document.html.erb +5 -3
- data/app/views/catalog/{_document_default.rss.builder → _document.rss.builder} +2 -0
- data/app/views/catalog/_document_action.html.erb +2 -1
- data/app/views/catalog/_email_form.html.erb +8 -4
- data/app/views/catalog/_facet_index_navigation.html.erb +5 -4
- data/app/views/catalog/_facet_layout.html.erb +6 -10
- data/app/views/catalog/_facet_limit.html.erb +3 -2
- data/app/views/catalog/_facet_pagination.html.erb +8 -8
- data/app/views/catalog/_facet_pivot.html.erb +2 -2
- data/app/views/catalog/_facets.html.erb +9 -12
- data/app/views/catalog/_field.json.jbuilder +10 -0
- data/app/views/catalog/{_group_default.html.erb → _group.html.erb} +1 -1
- data/app/views/catalog/_home_text.html.erb +32 -36
- data/app/views/catalog/_index.html.erb +10 -0
- data/app/views/catalog/{_index_header_default.html.erb → _index_header.html.erb} +3 -3
- data/app/views/catalog/_per_page_widget.html.erb +6 -7
- data/app/views/catalog/_previous_next_doc.html.erb +6 -14
- data/app/views/catalog/_results_pagination.html.erb +2 -2
- data/app/views/catalog/_search_form.html.erb +12 -8
- data/app/views/catalog/_search_header.html.erb +0 -3
- data/app/views/catalog/_search_results.html.erb +6 -2
- data/app/views/catalog/_show.html.erb +8 -0
- data/app/views/catalog/{_show_header_default.html.erb → _show_header.html.erb} +0 -0
- data/app/views/catalog/_show_main_content.html.erb +4 -4
- data/app/views/catalog/_show_more_like_this.html.erb +1 -1
- data/app/views/catalog/_show_sidebar.html.erb +3 -3
- data/app/views/catalog/_show_tools.html.erb +10 -12
- data/app/views/catalog/_sms_form.html.erb +8 -4
- data/app/views/catalog/_sort_and_per_page.html.erb +3 -3
- data/app/views/catalog/_sort_widget.html.erb +7 -7
- data/app/views/catalog/_thumbnail.html.erb +5 -0
- data/app/views/catalog/_view_type_group.html.erb +2 -2
- data/app/views/catalog/_zero_results.html.erb +1 -1
- data/app/views/catalog/citation.html.erb +1 -1
- data/app/views/catalog/citation.js.erb +9 -1
- data/app/views/catalog/email.html.erb +5 -3
- data/app/views/catalog/email_success.html.erb +12 -8
- data/app/views/catalog/facet.html.erb +10 -8
- data/app/views/catalog/facet.json.jbuilder +2 -0
- data/app/views/catalog/index.atom.builder +13 -16
- data/app/views/catalog/index.html.erb +9 -11
- data/app/views/catalog/index.json.jbuilder +84 -3
- data/app/views/catalog/index.rss.builder +7 -5
- data/app/views/catalog/opensearch.xml.builder +12 -10
- data/app/views/catalog/show.html.erb +11 -6
- data/app/views/catalog/show.json.jbuilder +21 -0
- data/app/views/catalog/sms.html.erb +3 -1
- data/app/views/catalog/sms_success.html.erb +12 -8
- data/app/views/kaminari/blacklight/_first_page.html.erb +2 -2
- data/app/views/kaminari/blacklight/_gap.html.erb +2 -2
- data/app/views/kaminari/blacklight/_last_page.html.erb +2 -2
- data/app/views/kaminari/blacklight/_next_page.html.erb +5 -5
- data/app/views/kaminari/blacklight/_page.html.erb +5 -3
- data/app/views/kaminari/blacklight/_prev_page.html.erb +4 -4
- data/app/views/kaminari/blacklight_compact/_paginator.html.erb +4 -4
- data/app/views/layouts/blacklight.html.erb +14 -41
- data/app/views/layouts/blacklight/base.html.erb +35 -0
- data/app/views/layouts/catalog_result.html.erb +11 -0
- data/app/views/search_history/index.html.erb +16 -21
- data/app/views/{_flash_msg.html.erb → shared/_flash_msg.html.erb} +0 -0
- data/app/views/shared/_header_navbar.html.erb +8 -13
- data/app/views/shared/_modal.html.erb +6 -0
- data/app/views/shared/_user_util_links.html.erb +22 -0
- data/blacklight.gemspec +8 -10
- data/config/i18n-tasks.yml +17 -0
- data/config/locales/blacklight.de.yml +71 -82
- data/config/locales/blacklight.en.yml +15 -27
- data/config/locales/blacklight.es.yml +14 -26
- data/config/locales/blacklight.fr.yml +16 -33
- data/config/locales/blacklight.hu.yml +212 -0
- data/config/locales/blacklight.it.yml +15 -26
- data/config/locales/blacklight.nl.yml +212 -0
- data/config/locales/blacklight.pt-BR.yml +24 -29
- data/config/locales/blacklight.sq.yml +4 -28
- data/config/locales/blacklight.zh.yml +3 -25
- data/config/routes.rb +2 -10
- data/db/migrate/20140202020202_create_bookmarks.rb +0 -1
- data/db/migrate/20140320000000_add_polymorphic_type_to_bookmarks.rb +1 -1
- data/lib/blacklight.rb +6 -4
- data/lib/blacklight/abstract_repository.rb +9 -9
- data/lib/blacklight/configuration.rb +99 -88
- data/lib/blacklight/configuration/context.rb +12 -1
- data/lib/blacklight/configuration/facet_field.rb +16 -9
- data/lib/blacklight/configuration/field.rb +32 -3
- data/lib/blacklight/configuration/fields.rb +15 -17
- data/lib/blacklight/configuration/null_field.rb +2 -0
- data/lib/blacklight/configuration/search_field.rb +2 -2
- data/lib/blacklight/configuration/sort_field.rb +2 -2
- data/lib/blacklight/configuration/view_config.rb +4 -0
- data/lib/blacklight/engine.rb +8 -9
- data/lib/blacklight/exceptions.rb +4 -7
- data/lib/blacklight/{utils.rb → nested_open_struct_with_hash_access.rb} +9 -81
- data/lib/blacklight/open_struct_with_hash_access.rb +49 -0
- data/lib/blacklight/parameters.rb +1 -1
- data/lib/blacklight/routes/exportable.rb +1 -3
- data/lib/blacklight/routes/searchable.rb +3 -3
- data/lib/blacklight/runtime_registry.rb +2 -0
- data/lib/blacklight/search_builder.rb +28 -35
- data/lib/blacklight/search_state.rb +10 -8
- data/lib/blacklight/solr/repository.rb +4 -3
- data/lib/blacklight/solr/request.rb +1 -1
- data/lib/blacklight/solr/response.rb +29 -30
- data/lib/blacklight/solr/response/facets.rb +29 -31
- data/lib/blacklight/solr/response/group.rb +3 -3
- data/lib/blacklight/solr/response/group_response.rb +1 -1
- data/lib/blacklight/solr/response/more_like_this.rb +2 -2
- data/lib/blacklight/solr/response/response.rb +2 -2
- data/lib/blacklight/solr/response/spelling.rb +4 -3
- data/lib/blacklight/solr/search_builder_behavior.rb +25 -29
- data/lib/blacklight/version.rb +1 -1
- data/lib/generators/blacklight/assets_generator.rb +13 -12
- data/lib/generators/blacklight/controller_generator.rb +4 -5
- data/lib/generators/blacklight/document_generator.rb +1 -1
- data/lib/generators/blacklight/install_generator.rb +17 -27
- data/lib/generators/blacklight/search_builder_generator.rb +1 -1
- data/lib/generators/blacklight/{solr5_generator.rb → solr_generator.rb} +12 -6
- data/lib/generators/blacklight/templates/.solr_wrapper.yml +5 -0
- data/lib/generators/blacklight/templates/alternate_controller.rb +4 -4
- data/lib/generators/blacklight/templates/blacklight.scss +0 -2
- data/lib/generators/blacklight/templates/catalog_controller.rb +57 -50
- data/lib/generators/blacklight/templates/config/blacklight.yml +1 -13
- data/{solr → lib/generators/blacklight/templates/solr}/conf/_rest_managed.json +0 -0
- data/{solr → lib/generators/blacklight/templates/solr}/conf/admin-extra.html +0 -0
- data/{solr → lib/generators/blacklight/templates/solr}/conf/elevate.xml +0 -0
- data/{solr → lib/generators/blacklight/templates/solr}/conf/mapping-ISOLatin1Accent.txt +0 -0
- data/{solr → lib/generators/blacklight/templates/solr}/conf/protwords.txt +0 -0
- data/lib/generators/blacklight/templates/solr/conf/schema.xml +388 -0
- data/{solr → lib/generators/blacklight/templates/solr}/conf/scripts.conf +0 -0
- data/lib/generators/blacklight/templates/solr/conf/solrconfig.xml +195 -0
- data/{solr → lib/generators/blacklight/templates/solr}/conf/spellings.txt +0 -0
- data/{solr → lib/generators/blacklight/templates/solr}/conf/stopwords.txt +0 -0
- data/{solr → lib/generators/blacklight/templates/solr}/conf/stopwords_en.txt +0 -0
- data/{solr → lib/generators/blacklight/templates/solr}/conf/synonyms.txt +0 -0
- data/{solr → lib/generators/blacklight/templates/solr}/conf/xslt/example.xsl +0 -0
- data/{solr → lib/generators/blacklight/templates/solr}/conf/xslt/example_atom.xsl +0 -0
- data/{solr → lib/generators/blacklight/templates/solr}/conf/xslt/example_rss.xsl +0 -0
- data/{solr → lib/generators/blacklight/templates/solr}/conf/xslt/luke.xsl +0 -0
- data/lib/generators/blacklight/test_support_generator.rb +10 -10
- data/lib/generators/blacklight/user_generator.rb +5 -6
- data/lib/railties/blacklight.rake +7 -6
- data/package-lock.json +2195 -0
- data/package.json +29 -0
- data/spec/controllers/alternate_controller_spec.rb +5 -4
- data/spec/controllers/application_controller_spec.rb +1 -5
- data/spec/controllers/blacklight/base_spec.rb +6 -3
- data/spec/controllers/blacklight/catalog/component_configuration_spec.rb +11 -7
- data/spec/controllers/blacklight/facet_spec.rb +1 -2
- data/spec/controllers/blacklight/search_fields_spec.rb +25 -34
- data/spec/controllers/bookmarks_controller_spec.rb +13 -13
- data/spec/controllers/catalog_controller_spec.rb +332 -164
- data/spec/controllers/search_history_controller_spec.rb +6 -6
- data/spec/features/alternate_controller_spec.rb +4 -4
- data/spec/features/autocomplete_spec.rb +4 -2
- data/spec/features/bookmarks_spec.rb +10 -10
- data/spec/features/did_you_mean_spec.rb +7 -12
- data/spec/features/facets_spec.rb +16 -16
- data/spec/features/record_view_spec.rb +12 -18
- data/spec/features/search_context_spec.rb +6 -7
- data/spec/features/search_crawler_spec.rb +3 -5
- data/spec/features/search_filters_spec.rb +80 -80
- data/spec/features/search_formats_spec.rb +1 -1
- data/spec/features/search_history_spec.rb +6 -29
- data/spec/features/search_pagination_spec.rb +4 -2
- data/spec/features/search_results_spec.rb +14 -12
- data/spec/features/search_sort_spec.rb +2 -2
- data/spec/features/search_spec.rb +7 -12
- data/spec/features/sitelinks_search_box.rb +4 -4
- data/{solr → spec/fixtures}/sample_solr_documents.yml +688 -688
- data/spec/helpers/{configuration_helper_spec.rb → blacklight/configuration_helper_behavior_spec.rb} +97 -92
- data/spec/helpers/{facets_helper_spec.rb → blacklight/facets_helper_behavior_spec.rb} +72 -67
- data/spec/helpers/{hash_as_hidden_fields_spec.rb → blacklight/hash_as_hidden_fields_behavior_spec.rb} +2 -2
- data/spec/helpers/blacklight/icon_helper_behavior_spec.rb +10 -0
- data/spec/helpers/{layout_helper_spec.rb → blacklight/layout_helper_behavior_spec.rb} +5 -15
- data/spec/helpers/{render_constraints_helper_spec.rb → blacklight/render_constraints_helper_behavior_spec.rb} +10 -6
- data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +92 -0
- data/spec/helpers/{search_history_constraints_helper_spec.rb → blacklight/search_history_constraints_helper_behavior_spec.rb} +29 -30
- data/spec/helpers/{suggest_helper_spec.rb → blacklight/suggest_helper_behavior_spec.rb} +9 -2
- data/spec/helpers/{url_helper_spec.rb → blacklight/url_helper_behavior_spec.rb} +56 -54
- data/spec/helpers/blacklight_helper_spec.rb +62 -151
- data/spec/helpers/catalog_helper_spec.rb +80 -96
- data/spec/i18n_spec.rb +18 -0
- data/spec/integration/generators/blacklight/{solr5_generator_spec.rb → solr_generator_spec.rb} +21 -13
- data/spec/lib/blacklight/configuration/facet_field_spec.rb +13 -0
- data/spec/lib/blacklight/configuration/field_spec.rb +15 -0
- data/spec/lib/blacklight/nested_open_struct_with_hash_access_spec.rb +17 -0
- data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +148 -0
- data/spec/lib/blacklight/parameters_spec.rb +4 -2
- data/spec/lib/blacklight/search_state_spec.rb +53 -36
- data/spec/lib/blacklight_spec.rb +14 -15
- data/spec/lib/tasks/blacklight_task_spec.rb +4 -6
- data/spec/models/blacklight/configurable_spec.rb +24 -27
- data/spec/models/blacklight/configuration/context_spec.rb +9 -10
- data/spec/models/blacklight/configuration_spec.rb +188 -165
- data/spec/models/blacklight/document/active_model_shim_spec.rb +15 -6
- data/spec/models/blacklight/document/cache_key_spec.rb +9 -2
- data/spec/models/blacklight/document/dublin_core_spec.rb +17 -20
- data/spec/models/blacklight/document/email_spec.rb +10 -10
- data/spec/models/blacklight/document/sms_spec.rb +10 -10
- data/spec/models/blacklight/document_spec.rb +10 -22
- data/spec/models/blacklight/facet_paginator_spec.rb +40 -30
- data/spec/models/blacklight/icon_spec.rb +44 -0
- data/spec/models/blacklight/search_builder_spec.rb +41 -26
- data/spec/models/blacklight/solr/document_spec.rb +224 -216
- data/spec/models/blacklight/solr/facet_paginator_spec.rb +6 -4
- data/spec/models/blacklight/solr/repository_spec.rb +50 -42
- data/spec/models/blacklight/solr/request_spec.rb +17 -18
- data/spec/models/blacklight/solr/response/facets_spec.rb +58 -58
- data/spec/models/blacklight/solr/response/group_response_spec.rb +16 -22
- data/spec/models/blacklight/solr/response/group_spec.rb +18 -25
- data/spec/models/blacklight/solr/response_spec.rb +56 -55
- data/spec/models/blacklight/solr/search_builder_spec.rb +150 -164
- data/spec/models/blacklight/suggest/response_spec.rb +1 -0
- data/spec/models/blacklight/suggest_search_spec.rb +4 -4
- data/spec/models/blacklight/user_spec.rb +9 -11
- data/spec/models/bookmark_spec.rb +7 -6
- data/spec/models/record_mailer_spec.rb +23 -21
- data/spec/models/search_spec.rb +19 -18
- data/spec/models/solr_document_spec.rb +33 -5
- data/spec/presenters/blacklight/document_presenter_spec.rb +86 -0
- data/spec/presenters/{index_presenter_spec.rb → blacklight/index_presenter_spec.rb} +25 -62
- data/spec/presenters/blacklight/json_presenter_spec.rb +59 -0
- data/spec/presenters/blacklight/link_alternate_presenter_spec.rb +3 -0
- data/spec/presenters/blacklight/search_bar_presenter_spec.rb +79 -0
- data/spec/presenters/{show_presenter_spec.rb → blacklight/show_presenter_spec.rb} +47 -62
- data/spec/presenters/pipeline_spec.rb +18 -11
- data/spec/presenters/thumbnail_presenter_spec.rb +174 -0
- data/spec/routing/catalog_routing_spec.rb +13 -31
- data/spec/services/blacklight/search_service_spec.rb +488 -0
- data/spec/spec_helper.rb +22 -15
- data/spec/support/features.rb +1 -1
- data/spec/support/features/session_helpers.rb +4 -4
- data/spec/test_app_templates/Gemfile.extra +2 -5
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +12 -13
- data/spec/views/catalog/_constraints.html.erb_spec.rb +3 -6
- data/spec/views/catalog/_constraints_element.html.erb_spec.rb +17 -13
- data/spec/views/catalog/_document.html.erb_spec.rb +11 -11
- data/spec/views/catalog/_document_list.html.erb_spec.rb +2 -1
- data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +5 -5
- data/spec/views/catalog/_facet_layout.html.erb_spec.rb +6 -6
- data/spec/views/catalog/_facets.html.erb_spec.rb +10 -12
- data/spec/views/catalog/{_index_default.erb_spec.rb → _index.html.erb_spec.rb} +14 -15
- data/spec/views/catalog/{_index_header_default.html.erb_spec.rb → _index_header.html.erb_spec.rb} +6 -9
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +7 -30
- data/spec/views/catalog/_search_header.erb_spec.rb +1 -3
- data/spec/views/catalog/{_show_default.erb_spec.rb → _show.html.erb_spec.rb} +13 -14
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +6 -9
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +5 -5
- data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +1 -2
- data/spec/views/catalog/_sort_widget.html.erb_spec.rb +3 -1
- data/spec/views/catalog/{_thumbnail_default.erb_spec.rb → _thumbnail.html.erb_spec.rb} +7 -9
- data/spec/views/catalog/_view_type_group.html.erb_spec.rb +12 -10
- data/spec/views/catalog/email_success.html.erb_spec.rb +8 -0
- data/spec/views/catalog/facet.html.erb_spec.rb +4 -3
- data/spec/views/catalog/facet.json.jbuilder_spec.rb +3 -2
- data/spec/views/catalog/index.atom.builder_spec.rb +11 -6
- data/spec/views/catalog/index.html.erb_spec.rb +6 -8
- data/spec/views/catalog/index.json.jbuilder_spec.rb +119 -26
- data/spec/views/catalog/opensearch.xml.builder_spec.rb +1 -1
- data/spec/views/catalog/show.html.erb_spec.rb +8 -8
- data/spec/views/catalog/show.json.jbuilder_spec.rb +40 -0
- data/spec/views/catalog/sms_success.html.erb_spec.rb +8 -0
- data/spec/views/{_user_util_links.html.erb_spec.rb → shared/_user_util_links.html.erb_spec.rb} +4 -7
- data/tasks/blacklight.rake +8 -4
- data/template.demo.rb +3 -11
- metadata +175 -195
- data/app/assets/javascripts/blacklight/autofocus.js +0 -16
- data/app/assets/javascripts/blacklight/bookmark_toggle.js +0 -23
- data/app/assets/javascripts/blacklight/core.js +0 -30
- data/app/controllers/concerns/blacklight/request_builders.rb +0 -77
- data/app/controllers/concerns/blacklight/saved_searches.rb +0 -70
- data/app/controllers/concerns/blacklight/search_helper.rb +0 -161
- data/app/controllers/concerns/blacklight/suggest.rb +0 -25
- data/app/controllers/saved_searches_controller.rb +0 -4
- data/app/controllers/suggest_controller.rb +0 -4
- data/app/helpers/blacklight/deprecated_url_helper_behavior.rb +0 -57
- data/app/helpers/blacklight/render_partials_helper.rb +0 -205
- data/app/helpers/blacklight_configuration_helper.rb +0 -4
- data/app/helpers/blacklight_url_helper.rb +0 -4
- data/app/helpers/component_helper.rb +0 -4
- data/app/helpers/facets_helper.rb +0 -4
- data/app/helpers/hash_as_hidden_fields_helper.rb +0 -4
- data/app/helpers/layout_helper.rb +0 -4
- data/app/helpers/render_constraints_helper.rb +0 -4
- data/app/helpers/search_history_constraints_helper.rb +0 -4
- data/app/helpers/suggest_helper.rb +0 -4
- data/app/models/concerns/blacklight/solr/document/more_like_this.rb +0 -6
- data/app/views/_user_util_links.html.erb +0 -26
- data/app/views/blacklight/nav/_saved_searches.html.erb +0 -1
- data/app/views/catalog/_index_default.html.erb +0 -12
- data/app/views/catalog/_show_default.html.erb +0 -10
- data/app/views/catalog/_thumbnail_default.html.erb +0 -5
- data/app/views/saved_searches/index.html.erb +0 -32
- data/app/views/shared/_ajax_modal.html.erb +0 -6
- data/lib/generators/blacklight/solr4_generator.rb +0 -31
- data/lib/generators/blacklight/templates/config/jetty.yml +0 -13
- data/solr/conf/schema.xml +0 -627
- data/solr/conf/solrconfig.xml +0 -411
- data/spec/controllers/blacklight/search_helper_spec.rb +0 -489
- data/spec/controllers/saved_searches_controller_spec.rb +0 -32
- data/spec/controllers/suggest_controller_spec.rb +0 -17
- data/spec/features/saved_searches_spec.rb +0 -47
- data/spec/helpers/deprecated_url_helper_behavior_spec.rb +0 -101
- data/spec/lib/blacklight/utils_spec.rb +0 -167
- data/spec/models/blacklight/solr/document/more_like_this_spec.rb +0 -18
- data/spec/presenters/document_presenter_spec.rb +0 -438
- 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 "
|
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 "
|
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 "
|
32
|
+
it "returns the ngroups value" do
|
35
33
|
expect(group.total).to eq 3
|
36
34
|
end
|
37
35
|
end
|
@@ -41,25 +39,25 @@ 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 "
|
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 "
|
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 "
|
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
|
@@ -72,14 +70,10 @@ def create_response(response, params = {})
|
|
72
70
|
end
|
73
71
|
|
74
72
|
def sample_response
|
75
|
-
{"responseHeader" => {"params" =>{"rows" => 3, "group.limit" => 5}},
|
76
|
-
|
77
|
-
{'result_group_ssi' =>
|
78
|
-
{'groups' => [{'groupValue'=>"Group 1", 'doclist'=>{'numFound'=>2, 'docs'=>[{:
|
79
|
-
|
80
|
-
|
81
|
-
'ngroups' => "3"
|
82
|
-
}
|
83
|
-
}
|
84
|
-
}
|
73
|
+
{ "responseHeader" => { "params" => { "rows" => 3, "group.limit" => 5 } },
|
74
|
+
"grouped" =>
|
75
|
+
{ 'result_group_ssi' =>
|
76
|
+
{ 'groups' => [{ 'groupValue' => "Group 1", 'doclist' => { 'numFound' => 2, 'docs' => [{ id: 1 }] } },
|
77
|
+
{ 'groupValue' => "Group 2", 'doclist' => { 'numFound' => 3, 'docs' => [{ id: 2 }, id: 3] } }],
|
78
|
+
'ngroups' => "3" } } }
|
85
79
|
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 "
|
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 "
|
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 "
|
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 "
|
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 "
|
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
|
-
|
63
|
-
{'result_group_ssi' =>
|
64
|
-
{'groups' => [{'groupValue'=>"Group 1", 'doclist'=>{'numFound'=>2, 'start' => 0, 'docs'=>[{:
|
65
|
-
|
66
|
-
|
67
|
-
|
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
9
|
Blacklight::Solr::Response.new(raw_response,
|
8
|
-
raw_response['params']
|
10
|
+
raw_response['params'],
|
11
|
+
blacklight_config: config)
|
9
12
|
end
|
10
13
|
|
11
|
-
it '
|
14
|
+
it 'creates a valid response' do
|
12
15
|
expect(r).to respond_to(:header)
|
13
16
|
end
|
14
17
|
|
15
|
-
it '
|
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 '
|
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 '
|
32
|
+
it 'provides facet helpers' do
|
30
33
|
expect(r.aggregations.size).to eq 2
|
31
34
|
|
32
|
-
field_names = r.aggregations.collect{|
|
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
|
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 |
|
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,7 +60,7 @@ RSpec.describe Blacklight::Solr::Response do
|
|
57
60
|
end
|
58
61
|
end
|
59
62
|
|
60
|
-
it "
|
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)
|
@@ -70,96 +73,94 @@ RSpec.describe Blacklight::Solr::Response do
|
|
70
73
|
end
|
71
74
|
|
72
75
|
describe "FacetItem" do
|
73
|
-
it "
|
76
|
+
it "works with a field,value tuple" do
|
74
77
|
item = Blacklight::Solr::Response::Facets::FacetItem.new('value', 15)
|
75
78
|
expect(item.value).to eq 'value'
|
76
79
|
expect(item.hits).to eq 15
|
77
80
|
end
|
78
81
|
|
79
|
-
it "
|
80
|
-
item = Blacklight::Solr::Response::Facets::FacetItem.new('value', 15, :
|
82
|
+
it "works with a field,value + hash triple" do
|
83
|
+
item = Blacklight::Solr::Response::Facets::FacetItem.new('value', 15, a: 1, value: 'ignored')
|
81
84
|
expect(item.value).to eq 'value'
|
82
85
|
expect(item.hits).to eq 15
|
83
86
|
expect(item.a).to eq 1
|
84
87
|
end
|
85
88
|
|
86
|
-
it "
|
87
|
-
item = Blacklight::Solr::Response::Facets::FacetItem.new(:
|
88
|
-
|
89
|
+
it "works like an openstruct" do
|
90
|
+
item = Blacklight::Solr::Response::Facets::FacetItem.new(value: 'value', hits: 15)
|
91
|
+
|
89
92
|
expect(item.hits).to eq 15
|
90
93
|
expect(item.value).to eq 'value'
|
91
94
|
expect(item).to be_a_kind_of(OpenStruct)
|
92
95
|
end
|
93
96
|
|
94
|
-
it "
|
95
|
-
item = Blacklight::Solr::Response::Facets::FacetItem.new('value', :
|
97
|
+
it "provides a label accessor" do
|
98
|
+
item = Blacklight::Solr::Response::Facets::FacetItem.new('value', hits: 15)
|
96
99
|
expect(item.label).to eq 'value'
|
97
100
|
end
|
98
101
|
|
99
|
-
it "
|
100
|
-
item = Blacklight::Solr::Response::Facets::FacetItem.new('value', 15, :
|
102
|
+
it "uses a provided label" do
|
103
|
+
item = Blacklight::Solr::Response::Facets::FacetItem.new('value', 15, label: 'custom label')
|
101
104
|
expect(item.label).to eq 'custom label'
|
102
|
-
|
103
105
|
end
|
104
|
-
|
105
106
|
end
|
106
107
|
|
107
|
-
it '
|
108
|
+
it 'returns the correct value when calling facet_by_field_name' do
|
108
109
|
facet = r.aggregations['cat']
|
109
110
|
expect(facet.name).to eq 'cat'
|
110
111
|
end
|
111
112
|
|
112
|
-
it '
|
113
|
+
it 'provides the responseHeader params' do
|
113
114
|
raw_response = eval(mock_query_response)
|
114
115
|
raw_response['responseHeader']['params']['test'] = :test
|
115
116
|
r = Blacklight::Solr::Response.new(raw_response, raw_response['params'])
|
116
117
|
expect(r.params['test']).to eq :test
|
117
118
|
end
|
118
119
|
|
119
|
-
it '
|
120
|
+
it 'provides the solr-returned params and "rows" should be 11' do
|
120
121
|
raw_response = eval(mock_query_response)
|
121
122
|
r = Blacklight::Solr::Response.new(raw_response, {})
|
122
123
|
expect(r.params[:rows].to_s).to eq '11'
|
123
|
-
expect(r.params[:sort]).to eq '
|
124
|
+
expect(r.params[:sort]).to eq 'title_si asc, pub_date_si desc'
|
124
125
|
end
|
125
126
|
|
126
|
-
it '
|
127
|
+
it 'provides the ruby request params if responseHeader["params"] does not exist' do
|
127
128
|
raw_response = eval(mock_query_response)
|
128
129
|
raw_response.delete 'responseHeader'
|
129
|
-
r = Blacklight::Solr::Response.new(raw_response, :
|
130
|
+
r = Blacklight::Solr::Response.new(raw_response, rows: 999, sort: 'score desc, pub_date_si desc, title_si asc')
|
130
131
|
expect(r.params[:rows].to_s).to eq '999'
|
131
|
-
expect(r.params[:sort]).to eq 'score desc,
|
132
|
+
expect(r.params[:sort]).to eq 'score desc, pub_date_si desc, title_si asc'
|
132
133
|
end
|
133
134
|
|
134
|
-
it '
|
135
|
+
it 'provides spelling suggestions for regular spellcheck results' do
|
135
136
|
raw_response = eval(mock_response_with_spellcheck)
|
136
|
-
r = Blacklight::Solr::Response.new(raw_response,
|
137
|
+
r = Blacklight::Solr::Response.new(raw_response, {})
|
137
138
|
expect(r.spelling.words).to include("dell")
|
138
139
|
expect(r.spelling.words).to include("ultrasharp")
|
139
140
|
end
|
140
141
|
|
141
|
-
it '
|
142
|
+
it 'provides spelling suggestions for extended spellcheck results' do
|
142
143
|
raw_response = eval(mock_response_with_spellcheck_extended)
|
143
144
|
r = Blacklight::Solr::Response.new(raw_response, {})
|
144
145
|
expect(r.spelling.words).to include("dell")
|
145
146
|
expect(r.spelling.words).to include("ultrasharp")
|
146
147
|
end
|
147
148
|
|
148
|
-
it '
|
149
|
+
it 'provides no spelling suggestions when extended results and suggestion frequency is the same as original query frequency' do
|
149
150
|
raw_response = eval(mock_response_with_spellcheck_same_frequency)
|
150
151
|
r = Blacklight::Solr::Response.new(raw_response, {})
|
151
152
|
expect(r.spelling.words).to eq []
|
152
153
|
end
|
153
154
|
|
154
155
|
context "pre solr 5 spellcheck collation syntax" do
|
155
|
-
it '
|
156
|
+
it 'provides spelling suggestions for a regular spellcheck results with a collation' do
|
156
157
|
raw_response = eval(mock_response_with_spellcheck_collation)
|
157
158
|
r = Blacklight::Solr::Response.new(raw_response, {})
|
158
159
|
expect(r.spelling.words).to include("dell")
|
159
160
|
expect(r.spelling.words).to include("ultrasharp")
|
160
161
|
end
|
161
162
|
|
162
|
-
it '
|
163
|
+
it 'provides spelling suggestion collation' do
|
163
164
|
raw_response = eval(mock_response_with_spellcheck_collation)
|
164
165
|
r = Blacklight::Solr::Response.new(raw_response, {})
|
165
166
|
expect(r.spelling.collation).to eq 'dell ultrasharp'
|
@@ -167,14 +168,14 @@ RSpec.describe Blacklight::Solr::Response do
|
|
167
168
|
end
|
168
169
|
|
169
170
|
context "solr 5 spellcheck collation syntax" do
|
170
|
-
it '
|
171
|
+
it 'provides spelling suggestions for a regular spellcheck results with a collation' do
|
171
172
|
raw_response = eval(mock_response_with_spellcheck_collation_solr5)
|
172
173
|
r = Blacklight::Solr::Response.new(raw_response, {})
|
173
174
|
expect(r.spelling.words).to include("dell")
|
174
175
|
expect(r.spelling.words).to include("ultrasharp")
|
175
176
|
end
|
176
177
|
|
177
|
-
it '
|
178
|
+
it 'provides spelling suggestion collation' do
|
178
179
|
raw_response = eval(mock_response_with_spellcheck_collation_solr5)
|
179
180
|
r = Blacklight::Solr::Response.new(raw_response, {})
|
180
181
|
expect(r.spelling.collation).to eq 'dell ultrasharp'
|
@@ -182,7 +183,7 @@ RSpec.describe Blacklight::Solr::Response do
|
|
182
183
|
end
|
183
184
|
|
184
185
|
context 'solr 6.5 spellcheck collation syntax' do
|
185
|
-
it '
|
186
|
+
it 'provides spelling suggestions for a regular spellcheck results with a collation' do
|
186
187
|
raw_response = eval(mock_response_with_spellcheck_collation_solr65)
|
187
188
|
r = Blacklight::Solr::Response.new(raw_response, {})
|
188
189
|
expect(r.spelling.words).to include("dell")
|
@@ -190,57 +191,57 @@ RSpec.describe Blacklight::Solr::Response do
|
|
190
191
|
end
|
191
192
|
end
|
192
193
|
|
193
|
-
it "
|
194
|
+
it "provides MoreLikeThis suggestions" do
|
194
195
|
raw_response = eval(mock_response_with_more_like_this)
|
195
196
|
r = Blacklight::Solr::Response.new(raw_response, {})
|
196
|
-
expect(r.more_like(double(:
|
197
|
+
expect(r.more_like(double(id: '79930185'))).to have(2).items
|
197
198
|
end
|
198
199
|
|
199
|
-
it "
|
200
|
+
it "is empty when the response has no results" do
|
200
201
|
r = Blacklight::Solr::Response.new({}, {})
|
201
|
-
allow(r).to receive_messages(:
|
202
|
+
allow(r).to receive_messages(total: 0)
|
202
203
|
expect(r).to be_empty
|
203
204
|
end
|
204
|
-
|
205
|
+
|
205
206
|
describe "#export_formats" do
|
206
|
-
it "
|
207
|
+
it "collects the unique export formats for the current response" do
|
207
208
|
r = Blacklight::Solr::Response.new({}, {})
|
208
|
-
allow(r).to receive_messages(documents: [double(:
|
209
|
-
expect(r.export_formats).to include :a, :b
|
209
|
+
allow(r).to receive_messages(documents: [double(export_formats: { a: 1, b: 2 }), double(export_formats: { b: 1, c: 2 })])
|
210
|
+
expect(r.export_formats).to include :a, :b
|
210
211
|
end
|
211
212
|
end
|
212
213
|
|
213
214
|
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'=>'
|
215
|
+
%({'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
216
|
end
|
216
217
|
|
217
218
|
# These spellcheck responses are all Solr 1.4 responses
|
218
219
|
def mock_response_with_spellcheck
|
219
|
-
|
220
|
+
%({'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
221
|
end
|
221
222
|
|
222
223
|
def mock_response_with_spellcheck_extended
|
223
|
-
|
224
|
+
%({'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
225
|
end
|
225
226
|
|
226
227
|
def mock_response_with_spellcheck_same_frequency
|
227
|
-
|
228
|
+
%({'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
229
|
end
|
229
230
|
|
230
231
|
# it can be the case that extended results are off and collation is on
|
231
232
|
def mock_response_with_spellcheck_collation
|
232
|
-
|
233
|
+
%({'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
234
|
end
|
234
235
|
|
235
236
|
def mock_response_with_spellcheck_collation_solr5
|
236
|
-
|
237
|
+
%({'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
238
|
end
|
238
239
|
|
239
240
|
def mock_response_with_spellcheck_collation_solr65
|
240
|
-
|
241
|
+
%({'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
242
|
end
|
242
243
|
|
243
244
|
def mock_response_with_more_like_this
|
244
|
-
%({'responseHeader'=>{'status'=>0,'QTime'=>8,'params'=>{'facet'=>'false','mlt.mindf'=>'1','mlt.fl'=>'
|
245
|
+
%({'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
246
|
end
|
246
247
|
end
|