blacklight 6.20.0 → 7.3.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/.jshintrc +3 -1
- data/.npmignore +23 -0
- data/.rubocop.yml +40 -16
- data/.rubocop_todo.yml +478 -382
- data/.travis.yml +28 -31
- data/CONTRIBUTING.md +50 -0
- data/Gemfile +5 -2
- 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 +495 -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 +31 -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 +66 -92
- data/app/assets/stylesheets/blacklight/_header.scss +60 -47
- 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 +4 -13
- 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 +20 -30
- data/app/controllers/concerns/blacklight/catalog.rb +256 -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 +22 -8
- 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/searchable.rb +17 -0
- data/app/controllers/concerns/blacklight/token_based_user.rb +5 -7
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +37 -119
- data/app/helpers/blacklight/catalog_helper_behavior.rb +103 -93
- data/app/helpers/blacklight/component_helper_behavior.rb +21 -21
- data/app/helpers/blacklight/configuration_helper_behavior.rb +30 -58
- data/app/helpers/blacklight/facets_helper_behavior.rb +79 -54
- 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 -3
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +8 -6
- data/app/helpers/blacklight/render_partials_helper_behavior.rb +207 -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 +51 -42
- data/app/{assets/javascripts → javascript}/blacklight/autocomplete.js +3 -2
- data/app/javascript/blacklight/bookmark_toggle.js +25 -0
- data/app/javascript/blacklight/button_focus.js +9 -0
- data/app/javascript/blacklight/checkbox_submit.js +134 -0
- data/app/javascript/blacklight/core.js +41 -0
- data/app/javascript/blacklight/facet_load.js +22 -0
- data/app/{assets/javascripts/blacklight/ajax_modal.js → javascript/blacklight/modal.js} +62 -64
- data/app/javascript/blacklight/search_context.js +67 -0
- data/app/models/blacklight/facet_paginator.rb +3 -3
- data/app/models/blacklight/icon.rb +79 -0
- 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 +5 -5
- 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 +3 -3
- data/app/models/concerns/blacklight/user.rb +7 -6
- data/app/models/record_mailer.rb +8 -6
- data/app/models/search.rb +5 -7
- data/app/presenters/blacklight/document_presenter.rb +25 -140
- data/app/presenters/blacklight/field_presenter.rb +19 -14
- data/app/presenters/blacklight/index_presenter.rb +43 -71
- 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 +27 -10
- data/app/presenters/blacklight/rendering/terminator.rb +2 -0
- data/app/presenters/blacklight/search_bar_presenter.rb +41 -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 +153 -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 +27 -13
- 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} +20 -19
- 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_group.html.erb +19 -0
- data/app/views/catalog/_facet_index_navigation.html.erb +5 -4
- data/app/views/catalog/_facet_layout.html.erb +13 -8
- 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 +3 -21
- 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 +7 -8
- 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 +10 -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 +10 -8
- data/app/views/catalog/_show_tools.html.erb +10 -21
- 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 +8 -8
- 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/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 +28 -30
- 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 +8 -6
- 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 +40 -0
- data/app/views/layouts/catalog_result.html.erb +11 -0
- data/app/views/record_mailer/email_record.text.erb +6 -5
- data/app/views/search_history/index.html.erb +16 -21
- data/app/views/{_flash_msg.html.erb → shared/_flash_msg.html.erb} +5 -3
- 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 -12
- data/config/i18n-tasks.yml +17 -0
- data/config/locales/blacklight.de.yml +87 -83
- data/config/locales/blacklight.en.yml +32 -29
- data/config/locales/blacklight.es.yml +31 -28
- data/config/locales/blacklight.fr.yml +33 -35
- data/config/locales/blacklight.hu.yml +226 -0
- data/config/locales/blacklight.it.yml +32 -28
- data/config/locales/blacklight.nl.yml +226 -0
- data/config/locales/blacklight.pt-BR.yml +41 -31
- data/config/locales/blacklight.sq.yml +21 -30
- data/config/locales/blacklight.zh.yml +20 -28
- 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 +106 -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 +10 -10
- 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.rb +2 -0
- data/{app/models/concerns → lib}/blacklight/solr/document.rb +8 -8
- data/{app/models → lib}/blacklight/solr/facet_paginator.rb +3 -3
- 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 +38 -31
- data/lib/blacklight/solr/response/group.rb +3 -3
- data/lib/blacklight/solr/response/group_response.rb +11 -1
- data/lib/blacklight/solr/response/more_like_this.rb +2 -2
- data/lib/blacklight/solr/response/pagination_methods.rb +12 -0
- 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 +27 -31
- data/lib/blacklight/version.rb +1 -1
- data/lib/generators/blacklight/assets_generator.rb +28 -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 +15 -34
- data/lib/generators/blacklight/search_builder_generator.rb +1 -1
- data/lib/generators/blacklight/{solr5_generator.rb → solr_generator.rb} +12 -6
- data/{.solr_wrapper.yml → lib/generators/blacklight/templates/.solr_wrapper.yml} +0 -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 +2793 -0
- data/package.json +30 -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 +17 -13
- data/spec/controllers/catalog_controller_spec.rb +329 -161
- 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 +38 -17
- 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 +100 -80
- data/spec/features/search_formats_spec.rb +4 -5
- 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 +8 -9
- 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 -98
- data/spec/helpers/{facets_helper_spec.rb → blacklight/facets_helper_behavior_spec.rb} +82 -73
- 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 -5
- 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} +61 -54
- data/spec/helpers/blacklight_helper_spec.rb +104 -151
- data/spec/helpers/catalog_helper_spec.rb +89 -105
- 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 +10 -3
- 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 +82 -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 +97 -60
- data/spec/models/blacklight/solr/response/group_response_spec.rb +29 -22
- data/spec/models/blacklight/solr/response/group_spec.rb +18 -25
- data/spec/models/blacklight/solr/response_spec.rb +72 -68
- data/spec/models/blacklight/solr/search_builder_spec.rb +150 -164
- data/spec/models/blacklight/suggest/response_spec.rb +2 -1
- 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 +94 -0
- data/spec/presenters/{show_presenter_spec.rb → blacklight/show_presenter_spec.rb} +47 -62
- data/spec/presenters/pipeline_spec.rb +43 -16
- 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 +495 -0
- data/spec/spec_helper.rb +12 -24
- 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_group.html.erb_spec.rb +82 -0
- 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 +6 -46
- 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 +7 -10
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +6 -6
- 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 +9 -12
- data/template.demo.rb +4 -12
- metadata +178 -218
- data/app/assets/javascripts/blacklight/autofocus.js +0 -16
- data/app/assets/javascripts/blacklight/bookmark_toggle.js +0 -23
- data/app/assets/javascripts/blacklight/checkbox_submit.js +0 -139
- data/app/assets/javascripts/blacklight/collapsable.js +0 -9
- data/app/assets/javascripts/blacklight/core.js +0 -30
- data/app/assets/javascripts/blacklight/facet_load.js +0 -23
- data/app/assets/javascripts/blacklight/search_context.js +0 -42
- 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 -629
- 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,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 "
|
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
|
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
|
-
|
77
|
-
{'result_group_ssi' =>
|
78
|
-
{'groups' => [{'groupValue'=>"Group 1", 'doclist'=>{'numFound'=>2, 'docs'=>[{:
|
79
|
-
|
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 "
|
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
|
-
|
8
|
-
|
9
|
+
described_class.new(raw_response,
|
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,12 +60,15 @@ 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)
|
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 "
|
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 "
|
80
|
-
item = Blacklight::Solr::Response::Facets::FacetItem.new('value', 15, :
|
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 "
|
87
|
-
item = Blacklight::Solr::Response::Facets::FacetItem.new(:
|
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 "
|
95
|
-
item = Blacklight::Solr::Response::Facets::FacetItem.new('value', :
|
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 "
|
100
|
-
item = Blacklight::Solr::Response::Facets::FacetItem.new('value', 15, :
|
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 '
|
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 '
|
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 =
|
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 '
|
123
|
+
it 'provides the solr-returned params and "rows" should be 11' do
|
120
124
|
raw_response = eval(mock_query_response)
|
121
|
-
r =
|
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 '
|
127
|
+
expect(r.params[:sort]).to eq 'title_si asc, pub_date_si desc'
|
124
128
|
end
|
125
129
|
|
126
|
-
it '
|
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 =
|
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,
|
135
|
+
expect(r.params[:sort]).to eq 'score desc, pub_date_si desc, title_si asc'
|
132
136
|
end
|
133
137
|
|
134
|
-
it '
|
138
|
+
it 'provides spelling suggestions for regular spellcheck results' do
|
135
139
|
raw_response = eval(mock_response_with_spellcheck)
|
136
|
-
r =
|
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 '
|
145
|
+
it 'provides spelling suggestions for extended spellcheck results' do
|
142
146
|
raw_response = eval(mock_response_with_spellcheck_extended)
|
143
|
-
r =
|
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 '
|
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 =
|
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 '
|
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 =
|
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 '
|
166
|
+
it 'provides spelling suggestion collation' do
|
163
167
|
raw_response = eval(mock_response_with_spellcheck_collation)
|
164
|
-
r =
|
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 '
|
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 =
|
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 '
|
181
|
+
it 'provides spelling suggestion collation' do
|
178
182
|
raw_response = eval(mock_response_with_spellcheck_collation_solr5)
|
179
|
-
r =
|
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 '
|
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 =
|
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 "
|
197
|
+
it "provides MoreLikeThis suggestions" do
|
194
198
|
raw_response = eval(mock_response_with_more_like_this)
|
195
|
-
r =
|
196
|
-
expect(r.more_like(double(:
|
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 "
|
200
|
-
r =
|
201
|
-
allow(r).to receive_messages(:
|
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 "
|
207
|
-
r =
|
208
|
-
allow(r).to receive_messages(documents: [double(:
|
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'=>'
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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'=>'
|
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
|